From cc3300cce0f0cf02da4c411a926e00daeacf56f2 Mon Sep 17 00:00:00 2001 From: rar91279 Date: Mon, 20 Jul 2026 00:36:33 +0200 Subject: [PATCH 1/5] Add generic okhttp generator supporting Jackson 2/3, Gson and JSONB as serialisation library as well as JSpecify Nullability assertions. --- docs/generators/java.md | 24 +- .../codegen/languages/JavaClientCodegen.java | 77 +- .../okhttp/AbstractOpenApiSchema.mustache | 139 ++ .../libraries/okhttp/ApiCallback.mustache | 51 + .../Java/libraries/okhttp/ApiClient.mustache | 1983 +++++++++++++++++ .../libraries/okhttp/ApiResponse.mustache | 75 + .../okhttp/GzipRequestInterceptor.mustache | 74 + .../Java/libraries/okhttp/JSON.mustache | 1040 +++++++++ .../okhttp/ProgressRequestBody.mustache | 62 + .../okhttp/ProgressResponseBody.mustache | 59 + .../Java/libraries/okhttp/README.mustache | 195 ++ .../okhttp/additional_properties.mustache | 46 + .../libraries/okhttp/anyof_model.mustache | 632 ++++++ .../Java/libraries/okhttp/api.mustache | 626 ++++++ .../libraries/okhttp/apiException.mustache | 196 ++ .../Java/libraries/okhttp/api_doc.mustache | 110 + .../Java/libraries/okhttp/api_test.mustache | 65 + .../libraries/okhttp/auth/AWS4Auth.mustache | 105 + .../libraries/okhttp/auth/ApiKeyAuth.mustache | 70 + .../okhttp/auth/Authentication.mustache | 27 + .../okhttp/auth/HttpBasicAuth.mustache | 44 + .../okhttp/auth/HttpBearerAuth.mustache | 52 + .../Java/libraries/okhttp/auth/OAuth.mustache | 33 + .../okhttp/auth/OAuthOkHttpClient.mustache | 73 + .../okhttp/auth/RetryingOAuth.mustache | 214 ++ .../libraries/okhttp/build.gradle.mustache | 138 ++ .../Java/libraries/okhttp/model.mustache | 35 + .../Java/libraries/okhttp/modelEnum.mustache | 114 + .../libraries/okhttp/modelInnerEnum.mustache | 82 + .../Java/libraries/okhttp/model_test.mustache | 42 + .../libraries/okhttp/oneof_model.mustache | 738 ++++++ .../Java/libraries/okhttp/pojo.mustache | 670 ++++++ .../Java/libraries/okhttp/pom.mustache | 466 ++++ .../codegen/java/JavaClientCodegenTest.java | 177 +- 34 files changed, 8500 insertions(+), 34 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/AbstractOpenApiSchema.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiCallback.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiClient.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiResponse.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/GzipRequestInterceptor.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/JSON.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ProgressRequestBody.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ProgressResponseBody.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/README.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/additional_properties.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/anyof_model.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/apiException.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api_doc.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api_test.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/AWS4Auth.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/ApiKeyAuth.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/Authentication.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/HttpBasicAuth.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/HttpBearerAuth.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/OAuth.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/OAuthOkHttpClient.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/RetryingOAuth.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/build.gradle.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/model.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelEnum.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelInnerEnum.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/model_test.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/oneof_model.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/pojo.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/okhttp/pom.mustache diff --git a/docs/generators/java.md b/docs/generators/java.md index 6740780102b9..6c716e0189b7 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -11,7 +11,7 @@ title: Documentation for the java Generator | generator type | CLIENT | | | generator language | Java | | | generator default templating engine | mustache | | -| helpTxt | Generates a Java client library (HTTP lib: Jersey (1.x, 2.x), Retrofit (2.x), OpenFeign (10.x) and more. | | +| helpTxt | Generates a Java client library (HTTP lib: Jersey (1.x, 2.x), Retrofit (2.x), OpenFeign (10.x), OkHttp and more. | | ## CONFIG OPTIONS These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. @@ -32,7 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| |camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false| -|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false| +|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2, and okhttp libraries| |false| |configKey|Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.| |null| |configKeyFromClassName|If true, set tag as key in @RegisterRestClient. Default to false. Only `microprofile` supports this option.| |null| |containerDefaultToNull|Set containers (array, set, map) default to null| |false| @@ -51,7 +51,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response. With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enums are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| -|errorObjectType|Error Object type. (This option is for okhttp-gson only)| |null| +|errorObjectType|Error Object type. (This option is for okhttp-gson and okhttp only)| |null| |failOnUnknownProperties|Fail Jackson de-serialization on unknown properties| |false| |generateBuilders|Whether to generate builders for models| |false| |generateClientAsBean|For resttemplate, restclient and webclient, configure whether to create `ApiClient.java` and Apis clients as bean (with `@Component` annotation).| |false| @@ -64,7 +64,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null| |invokerPackage|root package for generated code| |org.openapitools.client| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| -|library|library template (sub-template) to use|
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.18.9
**jersey3**
HTTP client: Jersey client 3.1.11. JSON processing: Jackson 2.x (3.x if `useJackson3=true`, requires Java 17+)
**feign**
HTTP client: OpenFeign 13.2.1. JSON processing: Jackson 2.18.9 or Gson 2.10.1
**feign-hc5**
HTTP client: OpenFeign 13.2.1/HttpClient5 5.4.2. JSON processing: Jackson 2.18.9 or Gson 2.10.1
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**retrofit2**
HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1 (Retrofit 2.5.0) or Jackson 2.18.9. Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)
**resttemplate**
HTTP client: Spring RestTemplate 5.3.33 (6.2.x if `useJakartaEe=true`, 7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.x (3.x if `useJackson3=true`)
**webclient**
HTTP client: Spring WebClient 5.1.18 (7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`)
**restclient**
HTTP client: Spring RestClient 6.1.6 (7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`)
**resteasy**
HTTP client: Resteasy client 4.7.6. JSON processing: Jackson 2.18.9
**vertx**
HTTP client: VertX client 3.5.2. JSON processing: Jackson 2.18.9
**google-api-client**
HTTP client: Google API client 2.2.0. JSON processing: Jackson 2.18.9
**rest-assured**
HTTP client: rest-assured 5.3.2. JSON processing: Gson 2.10.1 or Jackson 2.18.9. Only for Java 8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`). Only for Java11+
**microprofile**
HTTP client: Microprofile client 2.0 (default, set desired version via `microprofileRestClientVersion=x.x.x`). JSON processing: JSON-B 1.0.2 or Jackson 2.18.9
**apache-httpclient**
HTTP client: Apache httpclient 5.2.1. JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`)
|okhttp-gson| +|library|library template (sub-template) to use|
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.18.9
**jersey3**
HTTP client: Jersey client 3.1.11. JSON processing: Jackson 2.x (3.x if `useJackson3=true`, requires Java 17+)
**feign**
HTTP client: OpenFeign 13.2.1. JSON processing: Jackson 2.18.9 or Gson 2.10.1
**feign-hc5**
HTTP client: OpenFeign 13.2.1/HttpClient5 5.4.2. JSON processing: Jackson 2.18.9 or Gson 2.10.1
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**okhttp**
HTTP client: OkHttp 5.4.0. JSON processing: Gson 2.10.1, Jackson 2.x/3.x, or JSON-B. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**retrofit2**
HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1 (Retrofit 2.5.0) or Jackson 2.18.9. Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)
**resttemplate**
HTTP client: Spring RestTemplate 5.3.33 (6.2.x if `useJakartaEe=true`, 7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.x (3.x if `useJackson3=true`)
**webclient**
HTTP client: Spring WebClient 5.1.18 (7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`)
**restclient**
HTTP client: Spring RestClient 6.1.6 (7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`)
**resteasy**
HTTP client: Resteasy client 4.7.6. JSON processing: Jackson 2.18.9
**vertx**
HTTP client: VertX client 3.5.2. JSON processing: Jackson 2.18.9
**google-api-client**
HTTP client: Google API client 2.2.0. JSON processing: Jackson 2.18.9
**rest-assured**
HTTP client: rest-assured 5.3.2. JSON processing: Gson 2.10.1 or Jackson 2.18.9. Only for Java 8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`). Only for Java11+
**microprofile**
HTTP client: Microprofile client 2.0 (default, set desired version via `microprofileRestClientVersion=x.x.x`). JSON processing: JSON-B 1.0.2 or Jackson 2.18.9
**apache-httpclient**
HTTP client: Apache httpclient 5.2.1. JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`)
|okhttp-gson| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null| @@ -74,7 +74,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |microprofileRestClientVersion|Version of MicroProfile Rest Client API.| |null| |modelPackage|package for generated models| |org.openapitools.client.model| |openApiNullable|Enable OpenAPI Jackson Nullable library. Not supported by `microprofile` library.| |true| -|parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson library.| |false| +|parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson and okhttp libraries.| |false| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| @@ -90,7 +90,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sourceFolder|source folder for generated code| |src/main/java| |supportStreaming|Support streaming endpoint (beta)| |false| -|supportUrlQuery|Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient` libraries.| |false| +|supportUrlQuery|Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient`, `okhttp`, `feign`, `restclient`, `resttemplate`, `webclient` libraries.| |false| |supportVertxFuture|Also generate api methods that return a vertx Future instead of taking a callback. Only `vertx` supports this option. Requires vertx 4 or greater.| |false| |testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| |useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, restclient, libraries| |false| @@ -98,23 +98,23 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useDeductionForOneOfInterfaces|Annotate discriminator-free oneOf interfaces with Jackson's @JsonTypeInfo(use = Id.DEDUCTION) and @JsonSubTypes so the concrete subtype is resolved from the JSON field set rather than a type-tag property. Has no effect when a discriminator is present (name-based resolution is used instead). Requires subtypes to have structurally distinct sets of properties.| |false| |useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false| |useGzipFeature|Send gzip-encoded requests| |false| -|useJackson3|Use Jackson 3 instead of Jackson 2. Supported for 'native', 'apache-httpclient', and 'jersey3' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).| |false| +|useJackson3|Use Jackson 3 instead of Jackson 2. Supported for 'native', 'apache-httpclient', 'jersey3', and 'okhttp' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).| |false| |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| -|useJspecify|Use Jspecify for null checks. Only supported for [native, restclient, resttemplate, webclient]| |false| -|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson support this option.| |false| +|useJspecify|Use Jspecify for null checks. Only supported for [native, restclient, resttemplate, webclient, okhttp]| |false| +|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson, okhttp support this option.| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |usePlayWS|Use Play! Async HTTP client (Play WS API)| |false| |useReflectionEqualsHashCode|Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.| |false| -|useRuntimeException|Use RuntimeException instead of Exception. Only jersey2, jersey3, okhttp-gson, vertx, microprofile support this option.| |false| +|useRuntimeException|Use RuntimeException instead of Exception. Only jersey2, jersey3, okhttp-gson, okhttp, vertx, microprofile support this option.| |false| |useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false| |useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false| |useSealedOneOfInterfaces|Generate the oneOf interfaces as sealed interfaces. Only supported for WebClient, RestClient and Microprofile (with Jackson).| |false| -|useSingleRequestParameter|Setting this property to "true" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY native, jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to "static" does the same as "true", but also makes the generated arguments class static with single parameter instantiation.| |false| +|useSingleRequestParameter|Setting this property to "true" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY native, jersey2, jersey3, okhttp-gson, okhttp, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to "static" does the same as "true", but also makes the generated arguments class static with single parameter instantiation.| |false| |useSpringBoot4|Generate code and provide dependencies for use with Spring Boot 4.x.| |false| |useUnaryInterceptor|If true it will generate ResponseInterceptors using a UnaryOperator. This can be usefull for manipulating the request before it gets passed, for example doing your own decryption| |false| |useVertx5|Whether to use Vert.x 5 syntax.| |false| |webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false| -|withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false| +|withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson and okhttp libraries)| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 0bcd7a12a6d3..4285999dbf02 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -95,6 +95,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String JERSEY3 = "jersey3"; public static final String NATIVE = "native"; public static final String OKHTTP_GSON = "okhttp-gson"; + public static final String OKHTTP = "okhttp"; public static final String RESTEASY = "resteasy"; public static final String RESTTEMPLATE = "resttemplate"; public static final String WEBCLIENT = "webclient"; @@ -184,7 +185,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen @Setter protected int maxAttemptsForRetry = 1; @Setter protected long waitTimeMillis = 10l; - private final Set JSPECIFY_SUPPORTED_LIBRARIES = new TreeSet<>(Arrays.asList(RESTCLIENT, WEBCLIENT, NATIVE, RESTTEMPLATE)); + private final Set JSPECIFY_SUPPORTED_LIBRARIES = new TreeSet<>(Arrays.asList(RESTCLIENT, WEBCLIENT, NATIVE, RESTTEMPLATE, OKHTTP)); private static class MpRestClientVersion { public final String rootPackage; @@ -250,16 +251,16 @@ public JavaClientCodegen() { cliOptions.add(CliOption.newBoolean(USE_RX_JAVA2, "Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.")); cliOptions.add(CliOption.newBoolean(USE_RX_JAVA3, "Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.")); - cliOptions.add(CliOption.newBoolean(PARCELABLE_MODEL, "Whether to generate models for Android that implement Parcelable with the okhttp-gson library.")); + cliOptions.add(CliOption.newBoolean(PARCELABLE_MODEL, "Whether to generate models for Android that implement Parcelable with the okhttp-gson and okhttp libraries.")); cliOptions.add(CliOption.newBoolean(USE_VERTX_5, "Whether to use Vert.x 5 syntax.")); cliOptions.add(CliOption.newBoolean(USE_PLAY_WS, "Use Play! Async HTTP client (Play WS API)")); cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations")); cliOptions.add(CliOption.newBoolean(PERFORM_BEANVALIDATION, "Perform BeanValidation")); cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE, "Send gzip-encoded requests")); - cliOptions.add(CliOption.newBoolean(USE_RUNTIME_EXCEPTION, "Use RuntimeException instead of Exception. Only jersey2, jersey3, okhttp-gson, vertx, microprofile support this option.")); + cliOptions.add(CliOption.newBoolean(USE_RUNTIME_EXCEPTION, "Use RuntimeException instead of Exception. Only jersey2, jersey3, okhttp-gson, okhttp, vertx, microprofile support this option.")); cliOptions.add(CliOption.newBoolean(ASYNC_NATIVE, "If true, async handlers will be used, instead of the sync version")); cliOptions.add(CliOption.newBoolean(USE_REFLECTION_EQUALS_HASHCODE, "Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.")); - cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries")); + cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + ", and " + OKHTTP + " libraries")); cliOptions.add(CliOption.newString(MICROPROFILE_FRAMEWORK, "Framework for microprofile. Possible values \"kumuluzee\"")); cliOptions.add(CliOption.newString(MICROPROFILE_MUTINY, "Whether to use async types for microprofile (currently only Smallrye Mutiny is supported).")); cliOptions.add(CliOption.newString(MICROPROFILE_REGISTER_EXCEPTION_MAPPER, "Should generated API Clients be annotated with @RegisterProvider(ApiExceptionMapper.class).").defaultValue("true")); @@ -267,17 +268,17 @@ public JavaClientCodegen() { cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, restclient, libraries")); cliOptions.add(CliOption.newBoolean(DYNAMIC_OPERATIONS, "Generate operations dynamically at runtime from an OAS", this.dynamicOperations)); cliOptions.add(CliOption.newBoolean(SUPPORT_STREAMING, "Support streaming endpoint (beta)", this.supportStreaming)); - cliOptions.add(CliOption.newBoolean(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT, CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT_DESC + " (only available for okhttp-gson library)", this.withAWSV4Signature)); + cliOptions.add(CliOption.newBoolean(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT, CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT_DESC + " (only available for okhttp-gson and okhttp libraries)", this.withAWSV4Signature)); cliOptions.add(CliOption.newString(GRADLE_PROPERTIES, "Append additional Gradle properties to the gradle.properties file")); - cliOptions.add(CliOption.newString(ERROR_OBJECT_TYPE, "Error Object type. (This option is for okhttp-gson only)")); + cliOptions.add(CliOption.newString(ERROR_OBJECT_TYPE, "Error Object type. (This option is for okhttp-gson and okhttp only)")); cliOptions.add(CliOption.newString(CONFIG_KEY, "Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.")); cliOptions.add(CliOption.newString(CONFIG_KEY_FROM_CLASS_NAME, "If true, set tag as key in @RegisterRestClient. Default to false. Only `microprofile` supports this option.")); - cliOptions.add(CliOption.newBoolean(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC + " Only jersey2, jersey3, native, okhttp-gson support this option.")); + cliOptions.add(CliOption.newBoolean(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC + " Only jersey2, jersey3, native, okhttp-gson, okhttp support this option.")); cliOptions.add(CliOption.newString(MICROPROFILE_REST_CLIENT_VERSION, "Version of MicroProfile Rest Client API.")); - cliOptions.add(CliOption.newString(CodegenConstants.USE_SINGLE_REQUEST_PARAMETER, "Setting this property to \"true\" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY native, jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to \"static\" does the same as \"true\", but also makes the generated arguments class static with single parameter instantiation.").defaultValue("false")); + cliOptions.add(CliOption.newString(CodegenConstants.USE_SINGLE_REQUEST_PARAMETER, "Setting this property to \"true\" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY native, jersey2, jersey3, okhttp-gson, okhttp, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to \"static\" does the same as \"true\", but also makes the generated arguments class static with single parameter instantiation.").defaultValue("false")); cliOptions.add(CliOption.newBoolean(WEBCLIENT_BLOCKING_OPERATIONS, "Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync", this.webclientBlockingOperations)); cliOptions.add(CliOption.newBoolean(GENERATE_CLIENT_AS_BEAN, "For resttemplate, restclient and webclient, configure whether to create `ApiClient.java` and Apis clients as bean (with `@Component` annotation).", this.generateClientAsBean)); - cliOptions.add(CliOption.newBoolean(SUPPORT_URL_QUERY, "Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient` libraries.")); + cliOptions.add(CliOption.newBoolean(SUPPORT_URL_QUERY, "Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient`, `okhttp`, `feign`, `restclient`, `resttemplate`, `webclient` libraries.")); cliOptions.add(CliOption.newBoolean(USE_ENUM_CASE_INSENSITIVE, "Use `equalsIgnoreCase` when String for enum comparison", useEnumCaseInsensitive)); cliOptions.add(CliOption.newBoolean(FAIL_ON_UNKNOWN_PROPERTIES, "Fail Jackson de-serialization on unknown properties", this.failOnUnknownProperties)); cliOptions.add(CliOption.newBoolean(USE_JACKSON_3, "Use Jackson 3 instead of Jackson 2. Supported for 'native', 'apache-httpclient', and 'jersey3' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).", this.useJackson3)); @@ -292,6 +293,7 @@ public JavaClientCodegen() { supportedLibraries.put(FEIGN, "HTTP client: OpenFeign 13.2.1. JSON processing: Jackson 2.18.9 or Gson 2.10.1"); supportedLibraries.put(FEIGN_HC5, "HTTP client: OpenFeign 13.2.1/HttpClient5 5.4.2. JSON processing: Jackson 2.18.9 or Gson 2.10.1"); supportedLibraries.put(OKHTTP_GSON, "[DEFAULT] HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'."); + supportedLibraries.put(OKHTTP, "HTTP client: OkHttp 5.4.0. JSON processing: Gson 2.10.1, Jackson 2.x/3.x, or JSON-B. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'."); supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1 (Retrofit 2.5.0) or Jackson 2.18.9. Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)"); supportedLibraries.put(RESTTEMPLATE, "HTTP client: Spring RestTemplate 5.3.33 (6.2.x if `useJakartaEe=true`, 7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.x (3.x if `useJackson3=true`)"); supportedLibraries.put(WEBCLIENT, "HTTP client: Spring WebClient 5.1.18 (7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`)"); @@ -385,6 +387,7 @@ public void processOpts() { final boolean libJersey3 = isLibrary(JERSEY3); final boolean libMicroprofile = isLibrary(MICROPROFILE); final boolean libNative = isLibrary(NATIVE); + final boolean libOkHttp = isLibrary(OKHTTP); final boolean libOkHttpGson = isLibrary(OKHTTP_GSON) || StringUtils.isBlank(getLibrary()); final boolean libRestAssured = isLibrary(REST_ASSURED); final boolean libRestClient = isLibrary(RESTCLIENT); @@ -395,15 +398,30 @@ public void processOpts() { final boolean libWebClient = isLibrary(WEBCLIENT); // default jackson unless overridden by setSerializationLibrary - this.jackson = !additionalProperties.containsKey(CodegenConstants.SERIALIZATION_LIBRARY) || - SERIALIZATION_LIBRARY_JACKSON.equals(additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY)); + if (additionalProperties.containsKey(CodegenConstants.SERIALIZATION_LIBRARY)) { + this.serializationLibrary = String.valueOf(additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY)); + } + + if (this.serializationLibrary == null) { + if (libOkHttp || libOkHttpGson) { + this.serializationLibrary = SERIALIZATION_LIBRARY_GSON; + } else if (libMicroprofile) { + this.serializationLibrary = SERIALIZATION_LIBRARY_JSONB; + } + } + additionalProperties.put(CodegenConstants.SERIALIZATION_LIBRARY, serializationLibrary); + + this.jackson = SERIALIZATION_LIBRARY_JACKSON.equals(serializationLibrary); + additionalProperties.put("isJackson", jackson); + additionalProperties.put("isGson", SERIALIZATION_LIBRARY_GSON.equals(serializationLibrary)); + additionalProperties.put("isJsonb", SERIALIZATION_LIBRARY_JSONB.equals(serializationLibrary)); convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, this::setUseOneOfDiscriminatorLookup); convertPropertyToBooleanAndWriteBack(USE_JACKSON_3, this::setUseJackson3); convertPropertyToBooleanAndWriteBack(USE_SPRING_BOOT4, this::setUseSpringBoot4); if (useJackson3 && (libRestClient || libRestTemplate || libWebClient) && !useSpringBoot4) { throw new IllegalArgumentException("useJackson3 for the restclient, resttemplate, and webclient libraries requires useSpringBoot4=true"); - } else if (useJackson3 && !libNative && !libApache && !libJersey3 && !libRestClient && !libRestTemplate && !libWebClient) { - throw new IllegalArgumentException("useJackson3 is only supported for the 'native', 'apache-httpclient', 'jersey3', 'restclient', 'resttemplate', and 'webclient' libraries. " + + } else if (useJackson3 && !libNative && !libApache && !libJersey3 && !libRestClient && !libRestTemplate && !libWebClient && !libOkHttp) { + throw new IllegalArgumentException("useJackson3 is only supported for the 'native', 'apache-httpclient', 'jersey3', 'restclient', 'resttemplate', 'webclient', and 'okhttp' libraries. " + "The Spring libraries also require useSpringBoot4=true."); } @@ -567,7 +585,7 @@ public void processOpts() { supportingFiles.add(new SupportingFile("auth/HttpBasicAuth.mustache", authFolder, "HttpBasicAuth.java")); supportingFiles.add(new SupportingFile("auth/HttpBearerAuth.mustache", authFolder, "HttpBearerAuth.java")); supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.mustache", authFolder, "ApiKeyAuth.java")); - if (libOkHttpGson && withAWSV4Signature) { + if ((libOkHttp || libOkHttpGson) && withAWSV4Signature) { supportingFiles.add(new SupportingFile("auth/AWS4Auth.mustache", authFolder, "AWS4Auth.java")); } } @@ -586,8 +604,6 @@ public void processOpts() { "BeanValidationException.java")); } - convertPropertyToStringAndWriteBack(CodegenConstants.SERIALIZATION_LIBRARY, this::setSerializationLibrary); - //TODO: add auto-generated doc to feign if (libFeign) { modelDocTemplateFiles.remove("model_doc.mustache"); @@ -626,6 +642,21 @@ public void processOpts() { } supportingFiles.add(new SupportingFile("EncodingUtils.mustache", invokerFolder, "EncodingUtils.java")); + // Composed schemas can have the 'additionalProperties' keyword, as specified in JSON schema. + // In principle, this should be enabled by default for all code generators. However due to limitations + // in other code generators, support needs to be enabled on a case-by-case basis. + // The flag below should be set for all Java libraries, but the templates need to be ported + // one by one for each library. + supportsAdditionalPropertiesWithComposedSchema = true; + } else if (libOkHttp) { + // the "okhttp" library template requires "ApiCallback.mustache" for async call + supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java")); + supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java")); + supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java")); + supportingFiles.add(new SupportingFile("ProgressRequestBody.mustache", invokerFolder, "ProgressRequestBody.java")); + supportingFiles.add(new SupportingFile("ProgressResponseBody.mustache", invokerFolder, "ProgressResponseBody.java")); + supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", modelsFolder, "AbstractOpenApiSchema.java")); + // Composed schemas can have the 'additionalProperties' keyword, as specified in JSON schema. // In principle, this should be enabled by default for all code generators. However due to limitations // in other code generators, support needs to be enabled on a case-by-case basis. @@ -850,7 +881,7 @@ public void processOpts() { additionalProperties.remove(SERIALIZATION_LIBRARY_GSON); additionalProperties.remove(SERIALIZATION_LIBRARY_JSONB); supportingFiles.add(new SupportingFile("RFC3339DateFormat.mustache", invokerFolder, "RFC3339DateFormat.java")); - if (!useJackson3 || libNative || libApache || libJersey3 || libRestTemplate || libWebClient) { + if (!useJackson3 || libNative || libApache || libJersey3 || libRestTemplate || libWebClient || libOkHttp) { supportingFiles.add(new SupportingFile("RFC3339InstantDeserializer.mustache", invokerFolder, "RFC3339InstantDeserializer.java")); supportingFiles.add(new SupportingFile("RFC3339JavaTimeModule.mustache", invokerFolder, "RFC3339JavaTimeModule.java")); } @@ -889,8 +920,8 @@ public void processOpts() { // authentication related files // has OAuth defined if (ProcessUtils.hasOAuthMethods(openAPI)) { - // for okhttp-gson (default), check to see if OAuth is defined and included OAuth-related files accordingly - if (libOkHttpGson) { + // for okhttp-gson (default) or okhttp, check to see if OAuth is defined and included OAuth-related files accordingly + if (libOkHttpGson || libOkHttp) { supportingFiles.add(new SupportingFile("auth/OAuthOkHttpClient.mustache", authFolder, "OAuthOkHttpClient.java")); supportingFiles.add(new SupportingFile("auth/RetryingOAuth.mustache", authFolder, "RetryingOAuth.java")); } @@ -915,7 +946,7 @@ public void processOpts() { public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { super.postProcessOperationsWithModels(objs, allModels); - if (this.getSingleRequestParameter() && (isLibrary(JERSEY2) || isLibrary(JERSEY3) || isLibrary(OKHTTP_GSON) || isLibrary(NATIVE))) { + if (this.getSingleRequestParameter() && (isLibrary(JERSEY2) || isLibrary(JERSEY3) || isLibrary(OKHTTP_GSON) || isLibrary(NATIVE) || isLibrary(OKHTTP))) { // loop through operations to set x-group-parameters extension to true if useSingleRequestParameter option is enabled OperationMap operations = objs.getOperations(); if (operations != null) { @@ -1265,6 +1296,10 @@ public ModelsMap postProcessModels(ModelsMap objs) { for (ModelMap mo : models) { CodegenModel cm = mo.getModel(); + if (supportsAdditionalPropertiesWithComposedSchema) { + cm.isAdditionalPropertiesTrue = true; + } + cm.getVendorExtensions().putIfAbsent(X_IMPLEMENTS, new ArrayList()); if (isLibrary(JERSEY2) || isLibrary(JERSEY3) || isLibrary(NATIVE) || isLibrary(OKHTTP_GSON)) { if (cm.oneOf != null && !cm.oneOf.isEmpty() && cm.oneOf.contains("ModelNull")) { @@ -1379,7 +1414,7 @@ public String toApiVarName(String name) { @Override public void addImportsToOneOfInterface(List> imports) { - if (additionalProperties.containsKey(SERIALIZATION_LIBRARY_JACKSON)) { + if (jackson) { for (String i : Arrays.asList("JsonSubTypes", "JsonTypeInfo", "JsonIgnoreProperties")) { Map oneImport = new HashMap<>(); oneImport.put("import", importMapping.get(i)); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/AbstractOpenApiSchema.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/AbstractOpenApiSchema.mustache new file mode 100644 index 000000000000..3949e023fbb4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/AbstractOpenApiSchema.mustache @@ -0,0 +1,139 @@ +{{>licenseInfo}} + +package {{modelPackage}}; + +import {{invokerPackage}}.ApiException; +{{#isJackson}} +import com.fasterxml.jackson.annotation.JsonValue; +{{/isJackson}} +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +{{>generatedAnnotation}} + +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 oneOf/anyOf composed 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 + */ + {{#isJackson}} + @JsonValue + {{/isJackson}} + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + +{{>additional_properties}} + + +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiCallback.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiCallback.mustache new file mode 100644 index 000000000000..53b6a7b8e34f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiCallback.mustache @@ -0,0 +1,51 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiClient.mustache new file mode 100644 index 000000000000..485dcb1d1499 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiClient.mustache @@ -0,0 +1,1983 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +{{#dynamicOperations}} +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.PathItem; +import io.swagger.v3.oas.models.parameters.Parameter; +import io.swagger.v3.oas.models.parameters.Parameter.StyleEnum; +import io.swagger.v3.parser.OpenAPIV3Parser; +{{/dynamicOperations}} +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +{{#joda}} +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormatter; +{{/joda}} +{{#hasOAuthMethods}} +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; +{{/hasOAuthMethods}} + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +{{#jsr310}} +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +{{/jsr310}} +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import {{invokerPackage}}.auth.Authentication; +import {{invokerPackage}}.auth.HttpBasicAuth; +import {{invokerPackage}}.auth.HttpBearerAuth; +import {{invokerPackage}}.auth.ApiKeyAuth; +{{#hasOAuthMethods}} +import {{invokerPackage}}.auth.OAuth; +import {{invokerPackage}}.auth.RetryingOAuth; +import {{invokerPackage}}.auth.OAuthFlow; +{{/hasOAuthMethods}} +{{#withAWSV4Signature}} +import {{invokerPackage}}.auth.AWS4Auth; +{{/withAWSV4Signature}} + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "{{{basePath}}}"; + protected List servers = new ArrayList({{#servers}}{{#-first}}Arrays.asList( +{{/-first}} new ServerConfiguration( + "{{{url}}}", + "{{{description}}}{{^description}}No description provided{{/description}}", + new HashMap(){{#variables}}{{#-first}} {{ +{{/-first}} put("{{{name}}}", new ServerVariable( + "{{{description}}}{{^description}}No description provided{{/description}}", + "{{{defaultValue}}}", + new HashSet( + {{#enumValues}} + {{#-first}} + Arrays.asList( + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + ) + {{/-last}} + {{/enumValues}} + ) + )); + {{#-last}} + }}{{/-last}}{{/variables}} + ){{^-last}},{{/-last}} + {{#-last}} + ){{/-last}}{{/servers}}); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + {{#dynamicOperations}} + protected Map operationLookupMap = new HashMap<>(); + + {{/dynamicOperations}} + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} + authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}{{#withAWSV4Signature}} + authentications.put("AWS4Auth", new AWS4Auth());{{/withAWSV4Signature}} + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} + authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}{{#withAWSV4Signature}} + authentications.put("AWS4Auth", new AWS4Auth());{{/withAWSV4Signature}} + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + {{#hasOAuthMethods}} + {{#oauthMethods}} + {{#-first}} + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = "{{{tokenUrl}}}"; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.{{#lambda.uppercase}}{{#lambda.snakecase}}{{flow}}{{/lambda.snakecase}}{{/lambda.uppercase}}, clientSecret, parameters); + authentications.put( + "{{name}}", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{/authMethods}}{{#withAWSV4Signature}} + authentications.put("AWS4Auth", new AWS4Auth());{{/withAWSV4Signature}} + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + {{/-first}} + {{/oauthMethods}} + {{/hasOAuthMethods}} + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + {{#useGzipFeature}} + // Enable gzip request compression + builder.addInterceptor(new GzipRequestInterceptor()); + {{/useGzipFeature}} + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); + + authentications = new HashMap(); + {{#dynamicOperations}} + + OpenAPI openAPI = new OpenAPIV3Parser().read("openapi/openapi.yaml"); + createOperationLookupMap(openAPI); + {{/dynamicOperations}} + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g {{{basePath}}}) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link {{invokerPackage}}.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link {{invokerPackage}}.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + {{#joda}} + public ApiClient setDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setDateTimeFormat(dateFormat); + return this; + } + + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + {{/joda}} + {{#jsr310}} + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link {{invokerPackage}}.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link {{invokerPackage}}.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + {{/jsr310}} + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link {{invokerPackage}}.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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); + } + + {{#hasHttpBearerMethods}} + /** + * Helper method to set access token for the first Bearer authentication. + * @param bearerToken Bearer token + */ + public void setBearerToken(String bearerToken) { + setBearerToken(() -> bearerToken); + } + + /** + * Helper method to set the supplier of access tokens for Bearer authentication. + * + * @param tokenSupplier The supplier of bearer tokens + */ + public void setBearerToken(Supplier tokenSupplier) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(tokenSupplier); + return; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + {{/hasHttpBearerMethods}} + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + {{#hasOAuthMethods}} + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + {{/hasOAuthMethods}} + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + {{#withAWSV4Signature}} + for (Authentication auth : authentications.values()) { + if (auth instanceof AWS4Auth) { + ((AWS4Auth) auth).setCredentials(accessKey, secretKey); + ((AWS4Auth) auth).setRegion(region); + ((AWS4Auth) auth).setService(service); + return; + } + } + {{/withAWSV4Signature}} + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + {{#withAWSV4Signature}} + for (Authentication auth : authentications.values()) { + if (auth instanceof AWS4Auth) { + ((AWS4Auth) auth).setCredentials(accessKey, secretKey, sessionToken); + ((AWS4Auth) auth).setRegion(region); + ((AWS4Auth) auth).setService(service); + return; + } + } + {{/withAWSV4Signature}} + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + {{#hasOAuthMethods}} + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + {{/hasOAuthMethods}} + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date {{#joda}}|| param instanceof DateTime || param instanceof LocalDate{{/joda}}{{#jsr310}}|| param instanceof OffsetDateTime || param instanceof LocalDate{{/jsr310}}) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + {{^dynamicOperations}} + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + {{/dynamicOperations}} + {{#dynamicOperations}} + public List parameterToPairs(Parameter param, Collection value) { + List params = new ArrayList(); + + // preconditions + if (param == null || param.getName() == null || param.getName().isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if (StyleEnum.FORM.equals(param.getStyle()) && Boolean.TRUE.equals(param.getExplode())) { + for (Object item : value) { + params.add(new Pair(param.getName(), escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if (StyleEnum.SPACEDELIMITED.equals(param.getStyle())) { + delimiter = escapeString(" "); + } else if (StyleEnum.PIPEDELIMITED.equals(param.getStyle())) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(param.getName(), sb.substring(delimiter.length()))); + + return params; + } + {{/dynamicOperations}} + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws {{invokerPackage}}.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws {{invokerPackage}}.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws {{invokerPackage}}.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws {{invokerPackage}}.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws {{invokerPackage}}.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + {{#supportStreaming}} + /** + *

Execute stream.

+ * + * @param call a {@link okhttp3.Call} object + * @param returnType a {@link java.lang.reflect.Type} object + * @return a {@link java.io.InputStream} object + * @throws {{invokerPackage}}.ApiException if any. + */ + public InputStream executeStream(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + if (!response.isSuccessful()) { + throw new ApiException(response.code(), response.message(), response.headers().toMultimap(), null); + } + if (response.body() == null) { + return null; + } + return response.body().byteStream(); + } catch (IOException e) { + throw new ApiException(e); + } + } + + {{/supportStreaming}} + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws {{invokerPackage}}.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws {{invokerPackage}}.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws {{invokerPackage}}.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws {{invokerPackage}}.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + {{#dynamicOperations}} + + public ApiClient createOperationLookupMap(OpenAPI openAPI) { + operationLookupMap = new HashMap<>(); + for (Map.Entry pathItemEntry : openAPI.getPaths().entrySet()) { + String path = pathItemEntry.getKey(); + PathItem pathItem = pathItemEntry.getValue(); + addOperationLookupEntry(path, "GET", pathItem.getGet()); + addOperationLookupEntry(path, "PUT", pathItem.getPut()); + addOperationLookupEntry(path, "POST", pathItem.getPost()); + addOperationLookupEntry(path, "DELETE", pathItem.getDelete()); + addOperationLookupEntry(path, "OPTIONS", pathItem.getOptions()); + addOperationLookupEntry(path, "HEAD", pathItem.getHead()); + addOperationLookupEntry(path, "PATCH", pathItem.getPatch()); + addOperationLookupEntry(path, "TRACE", pathItem.getTrace()); + } + return this; + } + + protected void addOperationLookupEntry(String path, String method, Operation operation) { + if ( operation != null && operation.getOperationId() != null) { + operationLookupMap.put( + operation.getOperationId(), + new ApiOperation(path, method, operation)); + } + } + + public Map getOperationLookupMap() { + return operationLookupMap; + } + + public String fillParametersFromOperation( + Operation operation, + Map paramMap, + String path, + List queryParams, + List collectionQueryParams, + Map headerParams, + Map cookieParams + ) { + for (Map.Entry entry : paramMap.entrySet()) { + Object value = entry.getValue(); + for (Parameter param : operation.getParameters()) { + if (entry.getKey().equals(param.getName())) { + switch (param.getIn()) { + case "path": + path = path.replace("{" + param.getName() + "}", escapeString(value.toString())); + break; + case "query": + if (value instanceof Collection) { + collectionQueryParams.addAll(parameterToPairs(param, (Collection) value)); + } else { + queryParams.addAll(parameterToPair(param.getName(), value)); + } + break; + case "header": + headerParams.put(param.getName(), parameterToString(value)); + break; + case "cookie": + cookieParams.put(param.getName(), parameterToString(value)); + break; + default: + throw new IllegalStateException("Unexpected param in: " + param.getIn()); + } + + } + } + } + return path; + } + {{/dynamicOperations}} + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws {{invokerPackage}}.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiResponse.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiResponse.mustache new file mode 100644 index 000000000000..cecbaac1df27 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiResponse.mustache @@ -0,0 +1,75 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.util.List; +import java.util.Map; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} + +/** + * API response returned by API call. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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; + {{#caseInsensitiveResponseHeaders}} + Map> responseHeaders = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : headers.entrySet()){ + responseHeaders.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.headers = {{#caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}; + this.data = data; + } + + /** + *

Get the status code.

+ * + * @return the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/GzipRequestInterceptor.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/GzipRequestInterceptor.mustache new file mode 100644 index 000000000000..b633aa8f5864 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/GzipRequestInterceptor.mustache @@ -0,0 +1,74 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import okhttp3.*; +import okio.Buffer; +import okio.BufferedSink; +import okio.GzipSink; +import okio.Okio; + +import java.io.IOException; + +/** + * Encodes request bodies using gzip. + * + * Taken from https://github.com/square/okhttp/issues/350 + */ +class GzipRequestInterceptor implements Interceptor { + @Override + public Response intercept(Chain chain) throws IOException { + Request originalRequest = chain.request(); + if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { + return chain.proceed(originalRequest); + } + + Request compressedRequest = originalRequest.newBuilder() + .header("Content-Encoding", "gzip") + .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) + .build(); + return chain.proceed(compressedRequest); + } + + private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return new RequestBody() { + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() { + return buffer.size(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + sink.write(buffer.snapshot()); + } + }; + } + + private RequestBody gzip(final RequestBody body) { + return new RequestBody() { + @Override + public MediaType contentType() { + return body.contentType(); + } + + @Override + public long contentLength() { + return -1; // We don't know the compressed length in advance! + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); + body.writeTo(gzipSink); + gzipSink.close(); + } + }; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/JSON.mustache new file mode 100644 index 000000000000..3245901a6563 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/JSON.mustache @@ -0,0 +1,1040 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import {{modelPackage}}.AbstractOpenApiSchema; + +{{#isGson}} +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; +{{/isGson}} +{{#isJackson}} +import {{jacksonPackage}}.core.JsonGenerator; +import {{jacksonPackage}}.core.JsonParser; +import {{jacksonPackage}}.core.JsonToken; +{{#useJackson3}} +import {{jacksonPackage}}.core.JacksonException; +{{/useJackson3}} +import com.fasterxml.jackson.annotation.*; +import {{jacksonPackage}}.databind.*; +import {{jacksonPackage}}.databind.json.JsonMapper; +{{^useJackson3}} +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +{{/useJackson3}} +{{#useJackson3}} +import {{jacksonPackage}}.databind.cfg.DateTimeFeature; +import {{jacksonPackage}}.databind.cfg.EnumFeature; +{{/useJackson3}} +{{#openApiNullable}} +import org.openapitools.jackson.nullable.{{#useJackson3}}JsonNullableJackson3Module{{/useJackson3}}{{^useJackson3}}JsonNullableModule{{/useJackson3}}; +{{/openApiNullable}} +{{/isJackson}} +{{#isJsonb}} +import jakarta.json.bind.Jsonb; +import jakarta.json.bind.JsonbBuilder; +import jakarta.json.bind.JsonbConfig; +{{/isJsonb}} + +{{#joda}} +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +{{#isGson}} +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.DateTimeFormatterBuilder; +import org.joda.time.format.ISODateTimeFormat; +{{/isGson}} +{{#isJackson}} +import {{jacksonPackage}}.datatype.joda.JodaModule; +{{/isJackson}} +{{/joda}} + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +{{#jsr310}} +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +{{/jsr310}} +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + {{#isGson}} + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + {{#joda}} + private static DateTimeTypeAdapter dateTimeTypeAdapter = new DateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + {{/joda}} + {{#jsr310}} + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + {{/jsr310}} + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + {{/isGson}} + {{#isJackson}} + private static ObjectMapper mapper; + {{/isJackson}} + {{#isJsonb}} + private static Jsonb jsonb; + {{/isJsonb}} + + public JSON() { + {{#isGson}} + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + {{#models}} + {{#model}} + {{#discriminator}} + fireBuilder.registerTypeSelector({{modelPackage}}.{{classname}}.class, new TypeSelector<{{modelPackage}}.{{classname}}>() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + {{#mappedModels}} + classByDiscriminatorValue.put("{{mappingName}}"{{^discriminatorCaseSensitive}}.toUpperCase(Locale.ROOT){{/discriminatorCaseSensitive}}, {{modelPackage}}.{{modelName}}.class); + {{/mappedModels}} + classByDiscriminatorValue.put("{{name}}"{{^discriminatorCaseSensitive}}.toUpperCase(Locale.ROOT){{/discriminatorCaseSensitive}}, {{modelPackage}}.{{classname}}.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "{{{propertyBaseName}}}")); + } + }); + {{/discriminator}} + {{/model}} + {{/models}} + GsonBuilder builder = fireBuilder.createGsonBuilder(); + {{#disableHtmlEscaping}} + builder.disableHtmlEscaping(); + {{/disableHtmlEscaping}} + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + {{#joda}} + builder.registerTypeAdapter(DateTime.class, dateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + {{/joda}} + {{#jsr310}} + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + {{/jsr310}} + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + {{#models}} + {{#model}} + {{^isEnum}} + {{^hasChildren}} + builder.registerTypeAdapterFactory(new {{modelPackage}}.{{{classname}}}.CustomTypeAdapterFactory()); + {{/hasChildren}} + {{/isEnum}} + {{/model}} + {{/models}} + gson = builder.create(); + {{/isGson}} + {{#isJackson}} + if (mapper == null) { + {{^useJackson3}} + mapper = JsonMapper.builder() + .serializationInclusion(JsonInclude.Include.NON_NULL) + .disable(MapperFeature.ALLOW_COERCION_OF_SCALARS) + {{#failOnUnknownProperties}} + .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + {{/failOnUnknownProperties}} + {{^failOnUnknownProperties}} + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + {{/failOnUnknownProperties}} + .enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()) + .addModule(new JavaTimeModule()) + .build(); + {{#joda}} + mapper.registerModule(new JodaModule()); + {{/joda}} + {{#openApiNullable}} + mapper.registerModule(new JsonNullableModule()); + {{/openApiNullable}} + {{/useJackson3}} + {{#useJackson3}} + JsonMapper.Builder jsonMapperBuilder = JsonMapper.builder() + .changeDefaultPropertyInclusion(v -> v.withValueInclusion(JsonInclude.Include.NON_NULL)) + {{#failOnUnknownProperties}} + .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + {{/failOnUnknownProperties}} + {{^failOnUnknownProperties}} + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + {{/failOnUnknownProperties}} + .enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE) + .disable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(EnumFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(EnumFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()); + {{#joda}} + jsonMapperBuilder.addModule(new JodaModule()); + {{/joda}} + {{#openApiNullable}} + jsonMapperBuilder.addModule(new JsonNullableJackson3Module()); + {{/openApiNullable}} + mapper = jsonMapperBuilder.build(); + {{/useJackson3}} + } + {{/isJackson}} + {{#isJsonb}} + if (jsonb == null) { + JsonbConfig config = new JsonbConfig(); + jsonb = JsonbBuilder.create(config); + } + {{/isJsonb}} + } + + {{#isGson}} + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue{{^discriminatorCaseSensitive}}.toUpperCase(Locale.ROOT){{/discriminatorCaseSensitive}}); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + {{/isGson}} + {{#isJackson}} + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + * @return the target model class. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + {{^useJackson3}} + String discrValue = node.asText(); + {{/useJackson3}} + {{#useJackson3}} + String discrValue = node.asString(); + {{/useJackson3}} + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + * @return the target model class. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + * @param visitedClasses The set of classes that have already been visited. + * @return true if inst is an instance of modelClass in the OpenAPI model hierarchy. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map> descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (Class childType : descendants.values()) { + if (isInstanceOf(childType, inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map>> modelDescendants = new HashMap<>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map> descendants) { + modelDescendants.put(modelClass, descendants); + } + {{/isJackson}} + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + {{#isGson}} + return gson; + {{/isGson}} + {{#isJackson}} + return mapper; + {{/isJackson}} + {{#isJsonb}} + return jsonb; + {{/isJsonb}} + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + {{#isGson}} + JSON.gson = (Gson) serializer; + {{/isGson}} + {{#isJackson}} + JSON.mapper = (ObjectMapper) serializer; + {{/isJackson}} + {{#isJsonb}} + JSON.jsonb = (Jsonb) serializer; + {{/isJsonb}} + } + + {{#isJsonb}} + /** + * Helper class to get the Type of a generic class. + */ + public static class GenericType { + private final Type type; + + protected GenericType() { + Type superclass = getClass().getGenericSuperclass(); + this.type = ((ParameterizedType) superclass).getActualTypeArguments()[0]; + } + + public Type getType() { + return type; + } + } + {{/isJsonb}} + {{#isGson}} + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + {{/isGson}} + + {{#isJackson}} + public static ObjectMapper getMapper() { + return mapper; + } + + public static void setMapper(ObjectMapper mapper) { + JSON.mapper = mapper; + } + + public static void setDateFormat(DateFormat dateFormat) { + {{^useJackson3}} + mapper.setDateFormat(dateFormat); + {{/useJackson3}} + {{#useJackson3}} + mapper = ((JsonMapper) mapper).rebuild().defaultDateFormat(dateFormat).build(); + {{/useJackson3}} + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + // TODO: implement for Jackson + } + + public static void setLenientOnJson(boolean lenientOnJson) { + // TODO: implement for Jackson + } + {{/isJackson}} + + {{#isJsonb}} + public static Jsonb getJsonb() { + return jsonb; + } + + public static void setJsonb(Jsonb jsonb) { + JSON.jsonb = jsonb; + } + + public static void setDateFormat(DateFormat dateFormat) { + // TODO: implement for JSON-B + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + // TODO: implement for JSON-B + } + + public static void setLenientOnJson(boolean lenientOnJson) { + // TODO: implement for JSON-B + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + {{/isJsonb}} + + {{#jsr310}} + {{#isGson}} + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + {{/isGson}} + {{#isJackson}} + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + // TODO: implement for Jackson + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + // TODO: implement for Jackson + } + {{/isJackson}} + {{#isJsonb}} + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + // TODO: implement for JSON-B + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + // TODO: implement for JSON-B + } + {{/isJsonb}} + {{/jsr310}} + + {{#joda}} + {{#isGson}} + public static void setDateTimeFormat(DateTimeFormatter dateFormat) { + dateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + {{/isGson}} + {{#isJackson}} + public static void setDateTimeFormat(DateTimeFormatter dateFormat) { + // TODO: implement for Jackson + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + // TODO: implement for Jackson + } + {{/isJackson}} + {{#isJsonb}} + public static void setDateTimeFormat(DateTimeFormatter dateFormat) { + // TODO: implement for JSON-B + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + // TODO: implement for JSON-B + } + {{/isJsonb}} + {{/joda}} + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + {{#isGson}} + return gson.toJson(obj); + {{/isGson}} + {{#isJackson}} + try { + return mapper.writeValueAsString(obj); + } catch ({{#useJackson3}}JacksonException{{/useJackson3}}{{^useJackson3}}IOException{{/useJackson3}} e) { + throw new RuntimeException(e); + } + {{/isJackson}} + {{#isJsonb}} + return jsonb.toJson(obj); + {{/isJsonb}} + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + {{#isGson}} + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + {{/isGson}} + {{#isJackson}} + try { + JavaType type = mapper.getTypeFactory().constructType(returnType); + return mapper.readValue(body, type); + } catch ({{#useJackson3}}JacksonException{{/useJackson3}}{{^useJackson3}}IOException{{/useJackson3}} e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw new RuntimeException(e); + } + } + {{/isJackson}} + {{#isJsonb}} + return jsonb.fromJson(body, returnType); + {{/isJsonb}} + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + {{#isGson}} + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + {{/isGson}} + {{#isJackson}} + JavaType type = mapper.getTypeFactory().constructType(returnType); + return mapper.readValue(inputStream, type); + {{/isJackson}} + {{#isJsonb}} + return jsonb.fromJson(inputStream, returnType); + {{/isJsonb}} + } + + {{#isGson}} + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + {{#joda}} + /** + * Gson TypeAdapter for Joda DateTime type + */ + public static class DateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public DateTimeTypeAdapter() { + this(new DateTimeFormatterBuilder() + .append(ISODateTimeFormat.dateTime().getPrinter(), ISODateTimeFormat.dateOptionalTimeParser().getParser()) + .toFormatter()); + } + + public DateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, DateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public DateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseDateTime(date); + } + } + } + + /** + * Gson TypeAdapter for Joda LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(ISODateTimeFormat.date()); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseLocalDate(date); + } + } + } + {{/joda}} + {{#jsr310}} + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + {{/jsr310}} + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + {{/isGson}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ProgressRequestBody.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ProgressRequestBody.mustache new file mode 100644 index 000000000000..71e1e2b4cbe8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ProgressRequestBody.mustache @@ -0,0 +1,62 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ProgressResponseBody.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ProgressResponseBody.mustache new file mode 100644 index 000000000000..45115940b665 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ProgressResponseBody.mustache @@ -0,0 +1,59 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/README.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/README.mustache new file mode 100644 index 000000000000..de3afa6c1875 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/README.mustache @@ -0,0 +1,195 @@ +# {{artifactId}} + +{{appName}} +- API version: {{appVersion}} +{{^hideGenerationTimestamp}} + - Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} + - Generator version: {{generatorVersion}} + +{{{appDescriptionWithNewLines}}} + +{{#infoUrl}} + For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + {{{groupId}}} + {{{artifactId}}} + {{{artifactVersion}}} + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the '{{{artifactId}}}' jar has been published to maven central. + mavenLocal() // Needed if the '{{{artifactId}}}' jar has been published to the local maven repo. + } + + dependencies { + implementation "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/{{{artifactId}}}-{{{artifactVersion}}}.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} +// Import classes: +import {{{invokerPackage}}}.ApiClient; +import {{{invokerPackage}}}.ApiException; +import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} +import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} +import {{{modelPackage}}}.*; +import {{{package}}}.{{{classname}}}; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("{{{basePath}}}"); + {{#withAWSV4Signature}} + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + {{/withAWSV4Signature}} + {{#hasAuthMethods}} + {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + // Configure HTTP basic authorization: {{{name}}} + HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setUsername("YOUR USERNAME"); + {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} + // Configure HTTP bearer authorization: {{{name}}} + HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} + {{/authMethods}} + {{/hasAuthMethods}} + + {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); + {{#allParams}} + {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} + {{/allParams}} + try { + {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} + .{{{paramName}}}({{{paramName}}}){{/optionalParams}} + .execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}} + System.out.println(result);{{/returnType}} + } catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation for Models + +{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) +{{/model}}{{/models}} + + +## Documentation for Authorization + +{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} +{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} +{{#authMethods}} + +### {{name}} + +{{#isApiKey}}- **Type**: API key +- **API key parameter name**: {{keyParamName}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasicBasic}}- **Type**: HTTP basic authentication +{{/isBasicBasic}} +{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} +{{/isBasicBearer}} +{{#isHttpSignature}}- **Type**: HTTP signature authentication +{{/isHttpSignature}} +{{#isOAuth}}- **Type**: OAuth +- **Flow**: {{flow}} +- **Authorization URL**: {{authorizationUrl}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - {{scope}}: {{description}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/additional_properties.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/additional_properties.mustache new file mode 100644 index 000000000000..bca54f84d575 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/additional_properties.mustache @@ -0,0 +1,46 @@ +{{#isAdditionalPropertiesTrue}} + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the {{classname}} instance itself + */ + public {{classname}} putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } +{{/isAdditionalPropertiesTrue}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/anyof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/anyof_model.mustache new file mode 100644 index 000000000000..ceb1e7e0ed12 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/anyof_model.mustache @@ -0,0 +1,632 @@ +{{#isGson}} +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +{{/isGson}} +{{#isJackson}} +import {{jacksonPackage}}.core.JsonGenerator; +import {{jacksonPackage}}.core.JsonParser; +import {{jacksonPackage}}.core.JsonToken; +import {{jacksonPackage}}.core.type.TypeReference; +import {{jacksonPackage}}.databind.DeserializationContext; +{{^useJackson3}} +import {{jacksonPackage}}.databind.JsonMappingException; +{{/useJackson3}} +import {{jacksonPackage}}.databind.JsonNode; +import {{jacksonPackage}}.databind.MapperFeature; +{{^useJackson3}} +import {{jacksonPackage}}.databind.SerializerProvider; +{{/useJackson3}} +import {{jacksonPackage}}.databind.annotation.JsonDeserialize; +import {{jacksonPackage}}.databind.annotation.JsonSerialize; +import {{jacksonPackage}}.databind.deser.std.StdDeserializer; +import {{jacksonPackage}}.databind.ser.std.StdSerializer; +import {{jacksonPackage}}.databind.JavaType; +{{#useJackson3}} +import {{jacksonPackage}}.core.JacksonException; +import {{jacksonPackage}}.databind.DatabindException; +import {{jacksonPackage}}.databind.SerializationContext; +{{/useJackson3}} +{{/isJackson}} + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import {{invokerPackage}}.JSON; + +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} +{{#isJackson}} +@JsonDeserialize(using = {{classname}}.{{classname}}Deserializer.class) +@JsonSerialize(using = {{classname}}.{{classname}}Serializer.class) +{{/isJackson}} +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} { + private static final Logger log = Logger.getLogger({{classname}}.class.getName()); + + {{#isGson}} + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to {{classname}} + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + List errorMessages = new ArrayList<>(); + int matches = 0; + + {{#composedSchemas}} + {{#anyOf}} + {{^vendorExtensions.x-duplicated-data-type}} + try { + // validate the JSON object to see if any exception is thrown + {{#isModel}} + {{#hasChildren}} + {{{dataType}}}.validateJsonElement(jsonElement); + {{/hasChildren}} + {{^hasChildren}} + {{#isArray}} + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isArray}} + {{^isArray}} + {{#isMap}} + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isMap}} + {{^isMap}} + {{{dataType}}}.validateJsonElement(jsonElement); + {{/isMap}} + {{/isArray}} + {{/hasChildren}} + {{/isModel}} + {{#isPrimitiveType}} + {{#isArray}} + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isArray}} + {{^isArray}} + {{#isMap}} + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isMap}} + {{^isMap}} + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isMap}} + {{/isArray}} + {{/isPrimitiveType}} + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage())); + } + + {{/vendorExtensions.x-duplicated-data-type}} + {{/anyOf}} + {{/composedSchemas}} + + if (matches == 0) { + throw new IOException(String.format("Failed deserialization for {{classname}}: no match found. %s", errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!{{classname}}.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes '{{classname}}' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + {{#composedSchemas}} + {{#anyOf}} + {{^isArray}} + {{^vendorExtensions.x-duplicated-data-type}} + final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}} = gson.getDelegateAdapter(this, TypeToken.get({{{dataType}}}.class)); + {{/vendorExtensions.x-duplicated-data-type}} + {{/isArray}} + {{#isArray}} + final Type typeInstance{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}} = new TypeToken<{{{dataType}}}>(){}.getType(); + final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance)); + {{/isArray}} + {{/anyOf}} + {{/composedSchemas}} + + return (TypeAdapter) new TypeAdapter<{{classname}}>() { + @Override + public void write(JsonWriter out, {{classname}} value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + {{#composedSchemas}} + {{#anyOf}} + {{^vendorExtensions.x-duplicated-data-type}} + // check if the actual instance is of the type `{{{dataType}}}` + if (value.getActualInstance() instanceof {{#isArray}}List{{/isArray}}{{^isArray}}{{{dataType}}}{{/isArray}}) { + {{#isPrimitiveType}} + JsonPrimitive primitive = adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}}.toJsonTree(({{{dataType}}})value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isArray}} + List list = (List) value.getActualInstance(); + if (!list.isEmpty() && list.get(0) instanceof {{{items.dataType}}}) { + JsonArray array = adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}}.toJsonTree(({{{dataType}}})value.getActualInstance()).getAsJsonArray(); + elementAdapter.write(out, array); + return; + } + {{/isArray}} + {{/isPrimitiveType}} + {{^isArray}} + {{^isPrimitiveType}} + JsonElement element = adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}}.toJsonTree(({{{dataType}}})value.getActualInstance()); + elementAdapter.write(out, element); + return; + {{/isPrimitiveType}} + {{/isArray}} + } + {{/vendorExtensions.x-duplicated-data-type}} + {{/anyOf}} + {{/composedSchemas}} + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}"); + } + + @Override + public {{classname}} read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + {{#composedSchemas}} + {{#anyOf}} + {{^vendorExtensions.x-duplicated-data-type}} + // deserialize {{{dataType}}} + try { + // validate the JSON object to see if any exception is thrown + {{#isModel}} + {{#hasChildren}} + {{{dataType}}}.validateJsonElement(jsonElement); + {{/hasChildren}} + {{^hasChildren}} + {{#isArray}} + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isArray}} + {{^isArray}} + {{#isMap}} + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isMap}} + {{^isMap}} + {{{dataType}}}.validateJsonElement(jsonElement); + {{/isMap}} + {{/isArray}} + {{/hasChildren}} + {{/isModel}} + {{#isPrimitiveType}} + {{#isArray}} + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isArray}} + {{^isArray}} + {{#isMap}} + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isMap}} + {{^isMap}} + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isMap}} + {{/isArray}} + {{/isPrimitiveType}} + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}}.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema '{{{dataType}}}'", e); + } + + {{/vendorExtensions.x-duplicated-data-type}} + {{/anyOf}} + {{/composedSchemas}} + + throw new IOException(String.format("Failed deserialization for {{classname}}: no match found. %s", errorMessages)); + } + }; + } + } + {{/isGson}} + + {{#isJackson}} + public static class {{classname}}Serializer extends StdSerializer<{{classname}}> { + public {{classname}}Serializer(Class<{{classname}}> t) { + super(t); + } + + public {{classname}}Serializer() { + this(null); + } + + @Override + public void serialize({{classname}} value, JsonGenerator jgen, {{^useJackson3}}SerializerProvider provider{{/useJackson3}}{{#useJackson3}}SerializationContext serializationContext{{/useJackson3}}) throws {{^useJackson3}}IOException{{/useJackson3}}{{#useJackson3}}JacksonException{{/useJackson3}} { + {{^useJackson3}} + jgen.writeObject(value.getActualInstance()); + {{/useJackson3}} + {{#useJackson3}} + serializationContext.writeValue(jgen, value.getActualInstance()); + {{/useJackson3}} + } + } + + public static class {{classname}}Deserializer extends StdDeserializer<{{classname}}> { + public {{classname}}Deserializer() { + this({{classname}}.class); + } + + public {{classname}}Deserializer(Class vc) { + super(vc); + } + + @Override + public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws {{^useJackson3}}IOException{{/useJackson3}}{{#useJackson3}}JacksonException{{/useJackson3}} { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + {{#discriminator}} + Class cls = JSON.getClassForElement(tree, new {{classname}}().getClass()); + if (cls != null) { + {{^useJackson3}} + deserialized = tree.traverse(jp.getCodec()).readValueAs(cls); + {{/useJackson3}} + {{#useJackson3}} + deserialized = ctxt.readTreeAsValue(tree, ctxt.constructType(cls)); + {{/useJackson3}} + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(deserialized); + return ret; + } + {{/discriminator}} + {{#anyOf}} + // deserialize {{{.}}} + try { + {{^useJackson3}} + deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.class); + {{/useJackson3}} + {{#useJackson3}} + deserialized = ctxt.readTreeAsValue(tree, {{{.}}}.class); + {{/useJackson3}} + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e); + } + + {{/anyOf}} + {{^useJackson3}} + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for {{classname}}: no match found")); + {{/useJackson3}} + {{#useJackson3}} + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for {{classname}}: no match found")); + {{/useJackson3}} + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + {{^useJackson3}} + public {{classname}} getNullValue(DeserializationContext ctxt) throws JsonMappingException { + {{/useJackson3}} + {{#useJackson3}} + public {{classname}} getNullValue(DeserializationContext ctxt) { + {{/useJackson3}} + {{#isNullable}} + return null; + {{/isNullable}} + {{^isNullable}} + {{^useJackson3}} + throw new JsonMappingException(ctxt.getParser(), "{{classname}} cannot be null"); + {{/useJackson3}} + {{#useJackson3}} + throw DatabindException.from(ctxt.getParser(), "{{classname}} cannot be null"); + {{/useJackson3}} + {{/isNullable}} + } + } + {{/isJackson}} + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public {{classname}}() { + super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + } + + {{#anyOf}} + public {{classname}}({{{.}}} o) { + super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + setActualInstance(o); + } + + {{/anyOf}} + static { + {{#anyOf}} + schemas.put("{{{.}}}", {{{.}}}.class); + {{/anyOf}} + {{#isJackson}} + JSON.registerDescendants({{classname}}.class, Collections.unmodifiableMap(schemas)); + {{#discriminator}} + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + {{#mappedModels}} + mappings.put("{{mappingName}}", {{modelName}}.class); + {{/mappedModels}} + mappings.put("{{name}}", {{classname}}.class); + JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings); + {{/discriminator}} + {{/isJackson}} + } + + @Override + public Map> getSchemas() { + return {{classname}}.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}} + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + {{#isNullable}} + if (instance == null) { + super.setActualInstance(instance); + return; + } + + {{/isNullable}} + {{#anyOf}} + if (JSON.isInstanceOf({{{.}}}.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + {{/anyOf}} + throw new RuntimeException("Invalid instance type. Must be {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}"); + } + + /** + * Get the actual instance, which can be the following: + * {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}} + * + * @return The actual instance ({{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + {{#anyOf}} + /** + * Get the actual instance of `{{{.}}}`. If the actual instance is not `{{{.}}}`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `{{{.}}}` + * @throws ClassCastException if the instance is not `{{{.}}}` + */ + public {{{.}}} get{{{.}}}() throws ClassCastException { + return ({{{.}}})super.getActualInstance(); + } + + {{/anyOf}} + +{{#supportUrlQuery}} + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + {{#composedSchemas.oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + if (getActualInstance() instanceof {{{dataType}}}) { + {{#isArray}} + {{#items.isPrimitiveType}} + {{#uniqueItems}} + if (getActualInstance() != null) { + int i = 0; + for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(String.valueOf(_item)))); + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if (getActualInstance() != null) { + for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(String.valueOf(getActualInstance().get(i))))); + } + } + {{/uniqueItems}} + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + {{#items.isModel}} + {{#uniqueItems}} + if (getActualInstance() != null) { + int i = 0; + for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) { + if (_item != null) { + joiner.add(_item.toUrlQueryString(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if (getActualInstance() != null) { + for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) { + if ((({{{dataType}}})getActualInstance()).get(i) != null) { + joiner.add((({{{items.dataType}}})getActualInstance()).get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{^items.isModel}} + {{#uniqueItems}} + if (getActualInstance() != null) { + int i = 0; + for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) { + if (_item != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(String.valueOf(_item)))); + } + i++; + } + } + {{/uniqueItems}} + {{^uniqueItems}} + if (getActualInstance() != null) { + for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) { + if (getActualInstance().get(i) != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(String.valueOf((({{{dataType}}})getActualInstance()).get(i))))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{/items.isPrimitiveType}} + {{/isArray}} + {{^isArray}} + {{#isMap}} + {{#items.isPrimitiveType}} + if (getActualInstance() != null) { + for (String _key : (({{{dataType}}})getActualInstance()).keySet()) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix), + getActualInstance().get(_key), ApiClient.urlEncode(String.valueOf((({{{dataType}}})getActualInstance()).get(_key))))); + } + } + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + if (getActualInstance() != null) { + for (String _key : (({{{dataType}}})getActualInstance()).keySet()) { + if ((({{{dataType}}})getActualInstance()).get(_key) != null) { + joiner.add((({{{items.dataType}}})getActualInstance()).get(_key).toUrlQueryString(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix)))); + } + } + } + {{/items.isPrimitiveType}} + {{/isMap}} + {{^isMap}} + {{#isPrimitiveType}} + if (getActualInstance() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(String.valueOf(getActualInstance())))); + } + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isModel}} + if (getActualInstance() != null) { + joiner.add((({{{dataType}}})getActualInstance()).toUrlQueryString(prefix + "{{{baseName}}}" + suffix)); + } + {{/isModel}} + {{^isModel}} + if (getActualInstance() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(String.valueOf(getActualInstance())))); + } + {{/isModel}} + {{/isPrimitiveType}} + {{/isMap}} + {{/isArray}} + return joiner.toString(); + } + {{/vendorExtensions.x-duplicated-data-type}} + {{/composedSchemas.oneOf}} + return null; + } +{{/supportUrlQuery}} + +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api.mustache new file mode 100644 index 000000000000..699de9167f40 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api.mustache @@ -0,0 +1,626 @@ +{{>licenseInfo}} + +package {{package}}; + +import {{invokerPackage}}.ApiCallback; +import {{invokerPackage}}.ApiClient; +import {{invokerPackage}}.ApiException; +{{#dynamicOperations}} +import {{invokerPackage}}.ApiOperation; +{{/dynamicOperations}} +import {{invokerPackage}}.ApiResponse; +import {{invokerPackage}}.JSON; +import {{invokerPackage}}.Configuration; +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ProgressRequestBody; +import {{invokerPackage}}.ProgressResponseBody; +{{#performBeanValidation}} +import {{invokerPackage}}.BeanValidationException; +{{/performBeanValidation}} + +{{#isGson}} +import com.google.gson.reflect.TypeToken; +{{/isGson}} +{{#isJackson}} +import {{jacksonPackage}}.core.type.TypeReference; +{{/isJackson}} +{{#dynamicOperations}} +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.parameters.Parameter; +{{/dynamicOperations}} + +import java.io.IOException; + +{{#useBeanValidation}} +import {{javaxPackage}}.validation.constraints.*; +import {{javaxPackage}}.validation.Valid; +{{/useBeanValidation}} +{{#performBeanValidation}} +import {{javaxPackage}}.validation.ConstraintViolation; +import {{javaxPackage}}.validation.Validation; +import {{javaxPackage}}.validation.ValidatorFactory; +import {{javaxPackage}}.validation.executable.ExecutableValidator; +import java.util.Set; +import java.lang.reflect.Method; +import java.lang.reflect.Type; +{{/performBeanValidation}} + +{{#imports}}import {{import}}; +{{/imports}} + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{#supportStreaming}} +import java.io.InputStream; +{{/supportStreaming}} + +{{#operations}} +public class {{classname}} { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public {{classname}}() { + this(Configuration.getDefaultApiClient()); + } + + public {{classname}}(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + {{#operation}} + {{^vendorExtensions.x-group-parameters}}/** + * Build call for {{operationId}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + {{#responses.0}} + * @http.response.details + + + + {{#responses}} + + {{/responses}} +
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Call({{#allParams}}{{>nullableArgument}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { {{#servers}}"{{{url}}}"{{^-last}}, {{/-last}}{{/servers}} }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + + // create path and map variables + {{^dynamicOperations}} + String localVarPath = "{{{path}}}"{{#pathParams}} + .replace("{" + "{{baseName}}" + "}", localVarApiClient.escapeString({{#collectionFormat}}localVarApiClient.collectionPathParameterToString("{{{collectionFormat}}}", {{{paramName}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}.toString(){{/collectionFormat}})){{/pathParams}}; + {{/dynamicOperations}} + {{#dynamicOperations}} + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("{{{operationId}}}"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + {{#allParams}} + {{^isFormParam}} + {{^isBodyParam}} + paramMap.put("{{baseName}}", {{paramName}}); + {{/isBodyParam}} + {{/isFormParam}} + {{/allParams}} + {{/dynamicOperations}} + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + {{#formParams}} + if ({{paramName}} != null) { + localVarFormParams.put("{{baseName}}", {{paramName}}); + } + + {{/formParams}} + {{^dynamicOperations}} + {{#queryParams}} + if ({{paramName}} != null) { + {{#isFreeFormObject}}localVarQueryParams.addAll(localVarApiClient.freeFormParameterToPairs({{paramName}}));{{/isFreeFormObject}}{{^isFreeFormObject}}{{#collectionFormat}}localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(localVarApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}}));{{/isFreeFormObject}} + } + + {{/queryParams}} + {{#constantParams}} + {{#isQueryParam}} + // Set client side default value of Query Param "{{baseName}}". + localVarCollectionQueryParams.add(new Pair("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}})); + + {{/isQueryParam}} + {{/constantParams}} + {{#constantParams}} + {{#isHeaderParam}} + // Set client side default value of Header Param "{{baseName}}". + localVarHeaderParams.put("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}}); + + {{/isHeaderParam}} + {{/constantParams}} + {{#cookieParams}} + if ({{paramName}} != null) { + localVarCookieParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); + } + + {{/cookieParams}} + {{#constantParams}} + {{#isCookieParam}} + // Set client side default value of Cookie Param "{{baseName}}". + localVarCookieParams.put("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}}); + + {{/isCookieParam}} + {{/constantParams}} + {{/dynamicOperations}} + {{#dynamicOperations}} + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + {{/dynamicOperations}} + final String[] localVarAccepts = { + {{#produces}} + "{{{mediaType}}}"{{^-last}},{{/-last}} + {{/produces}} + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + {{#consumes}} + "{{{mediaType}}}"{{^-last}},{{/-last}} + {{/consumes}} + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + {{^dynamicOperations}} + {{#headerParams}} + + if ({{paramName}} != null) { + localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); + } + + {{/headerParams}} + {{/dynamicOperations}} + + String[] localVarAuthNames = new String[] { {{#withAWSV4Signature}}"AWS4Auth"{{/withAWSV4Signature}}{{#authMethods}}{{#-first}}{{#withAWSV4Signature}}, {{/withAWSV4Signature}}{{/-first}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + return localVarApiClient.buildCall(basePath, localVarPath, {{^dynamicOperations}}"{{httpMethod}}"{{/dynamicOperations}}{{#dynamicOperations}}apiOperation.getMethod(){{/dynamicOperations}}, localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + @SuppressWarnings("rawtypes") + private okhttp3.Call {{operationId}}ValidateBeforeCall({{#allParams}}{{>nullableArgument}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { + {{^performBeanValidation}} + {{#allParams}} + {{#required}} + // verify the required parameter '{{paramName}}' is set + if ({{paramName}} == null) { + throw new ApiException("Missing the required parameter '{{paramName}}' when calling {{operationId}}(Async)"); + } + + {{/required}} + {{/allParams}} + return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); + + {{/performBeanValidation}} + {{#performBeanValidation}} + try { + ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); + ExecutableValidator executableValidator = factory.getValidator().forExecutables(); + + Object[] parameterValues = { {{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }; + Method method = this.getClass().getMethod("{{operationId}}WithHttpInfo"{{#allParams}}, {{#isArray}}java.util.List{{/isArray}}{{#isMap}}java.util.Map{{/isMap}}{{^isArray}}{{^isMap}}{{>nullable_var_annotations}} {{{dataType}}}{{/isMap}}{{/isArray}}.class{{/allParams}}); + Set> violations = executableValidator.validateParameters(this, method, + parameterValues); + + if (violations.size() == 0) { + return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); + } else { + throw new BeanValidationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + {{/performBeanValidation}} + } + + {{^vendorExtensions.x-group-parameters}} + /** + * {{summary}} + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#returnType}} + * @return {{.}}{{/returnType}} + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + + {{#responses}} + + {{/responses}} +
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + {{#vendorExtensions.x-streaming}} + public {{#returnType}}InputStream {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{>nullableArgument}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}InputStream localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + return localVarResp;{{/returnType}} + } + {{/vendorExtensions.x-streaming}} + {{^vendorExtensions.x-streaming}} + public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{>nullableArgument}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + return localVarResp.getData();{{/returnType}} + } + {{/vendorExtensions.x-streaming}} + {{/vendorExtensions.x-group-parameters}} + + {{^vendorExtensions.x-group-parameters}}/** + * {{summary}} + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + + {{#responses}} + + {{/responses}} +
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-streaming}} InputStream {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); + {{#returnType}} + {{#errorObjectType}} + try { + {{#isGson}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();{{/isGson}} + {{#isJackson}}Type localVarReturnType = new TypeReference<{{{returnType}}}>(){}.getType();{{/isJackson}} + {{#isJsonb}}Type localVarReturnType = new JSON.GenericType<{{{returnType}}}>(){}.getType();{{/isJsonb}} + return localVarApiClient.executeStream(localVarCall, localVarReturnType); + } catch (ApiException e) { + {{#isGson}}e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<{{{errorObjectType}}}>(){}.getType()));{{/isGson}} + {{#isJsonb}}e.setErrorObject(localVarApiClient.getJSON().deserialize(e.getResponseBody(), new JSON.GenericType<{{{errorObjectType}}}>(){}.getType()));{{/isJsonb}} + throw e; + } + {{/errorObjectType}} + {{^errorObjectType}} + {{#isGson}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();{{/isGson}} + {{#isJackson}}Type localVarReturnType = new TypeReference<{{{returnType}}}>(){}.getType();{{/isJackson}} + {{#isJsonb}}Type localVarReturnType = new JSON.GenericType<{{{returnType}}}>(){}.getType();{{/isJsonb}} + return localVarApiClient.executeStream(localVarCall, localVarReturnType); + {{/errorObjectType}} + {{/returnType}} + } + {{/vendorExtensions.x-streaming}}{{^vendorExtensions.x-streaming}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{>nullableArgument}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); + {{^returnType}} + return localVarApiClient.execute(localVarCall); + {{/returnType}} + {{#returnType}} + {{#errorObjectType}} + try { + {{#isGson}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();{{/isGson}} + {{#isJackson}}Type localVarReturnType = new TypeReference<{{{returnType}}}>(){}.getType();{{/isJackson}} + {{#isJsonb}}Type localVarReturnType = new JSON.GenericType<{{{returnType}}}>(){}.getType();{{/isJsonb}} + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + {{#isGson}}e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<{{{errorObjectType}}}>(){}.getType()));{{/isGson}} + {{#isJsonb}}e.setErrorObject(localVarApiClient.getJSON().deserialize(e.getResponseBody(), new JSON.GenericType<{{{errorObjectType}}}>(){}.getType()));{{/isJsonb}} + throw e; + } + {{/errorObjectType}} + {{^errorObjectType}} + {{#isGson}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();{{/isGson}} + {{#isJackson}}Type localVarReturnType = new TypeReference<{{{returnType}}}>(){}.getType();{{/isJackson}} + {{#isJsonb}}Type localVarReturnType = new JSON.GenericType<{{{returnType}}}>(){}.getType();{{/isJsonb}} + return localVarApiClient.execute(localVarCall, localVarReturnType); + {{/errorObjectType}} + {{/returnType}} + } + {{/vendorExtensions.x-streaming}} + + {{^vendorExtensions.x-group-parameters}}/** + * {{summary}} (asynchronously) + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + {{#responses.0}} + * @http.response.details + + + + {{#responses}} + + {{/responses}} +
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Async({{#allParams}}{{>nullableArgument}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { + + okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_callback); + {{#returnType}}{{#isGson}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();{{/isGson}}{{#isJackson}}Type localVarReturnType = new TypeReference<{{{returnType}}}>(){}.getType();{{/isJackson}}{{#isJsonb}}Type localVarReturnType = new JSON.GenericType<{{{returnType}}}>(){}.getType();{{/isJsonb}} + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);{{/returnType}}{{^returnType}}localVarApiClient.executeAsync(localVarCall, _callback);{{/returnType}} + return localVarCall; + } + {{#vendorExtensions.x-group-parameters}} + + public class API{{operationId}}Request { + {{#requiredParams}} + {{>nullable_var_annotations}}{{! prevent indent}} + private final {{#lambda.jSpecifyDatatype}}{{{dataType}}}{{/lambda.jSpecifyDatatype}} {{paramName}}; + {{/requiredParams}} + {{#optionalParams}} + {{>nullable_var_annotations}}{{! prevent indent}} + private {{#lambda.jSpecifyDatatype}}{{{dataType}}}{{/lambda.jSpecifyDatatype}} {{paramName}}; + {{/optionalParams}} + + private API{{operationId}}Request({{#requiredParams}}{{>nullableArgument}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { + {{#requiredParams}} + this.{{paramName}} = {{paramName}}; + {{/requiredParams}} + } + + {{#optionalParams}} + /** + * Set {{paramName}} + * @param {{paramName}} {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}) + * @return API{{operationId}}Request + */ + public API{{operationId}}Request {{paramName}}({{>nullableArgument}} {{paramName}}) { + this.{{paramName}} = {{paramName}}; + return this; + } + + {{/optionalParams}} + /** + * Build call for {{operationId}} + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + {{#responses.0}} + * @http.response.details + + + + {{#responses}} + + {{/responses}} +
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); + } + + /** + * Execute {{operationId}} request{{#returnType}} + * @return {{.}}{{/returnType}} + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + + {{#responses}} + + {{/responses}} +
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + {{^vendorExtensions.x-streaming}} + public {{{returnType}}}{{^returnType}}void{{/returnType}} execute() throws ApiException { + {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + return localVarResp.getData();{{/returnType}} + } + {{/vendorExtensions.x-streaming}} + {{#vendorExtensions.x-streaming}} + public InputStream execute() throws ApiException { + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + {{/vendorExtensions.x-streaming}} + + /** + * Execute {{operationId}} request with HTTP info returned + * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + + {{#responses}} + + {{/responses}} +
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + {{^vendorExtensions.x-streaming}} + public ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + {{/vendorExtensions.x-streaming}} + {{#vendorExtensions.x-streaming}} + public InputStream executeWithHttpInfo() throws ApiException { + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + {{/vendorExtensions.x-streaming}} + + /** + * Execute {{operationId}} request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + {{#responses.0}} + * @http.response.details + + + + {{#responses}} + + {{/responses}} +
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public okhttp3.Call executeAsync(final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { + return {{operationId}}Async({{#allParams}}{{paramName}}, {{/allParams}}_callback); + } + } + + /** + * {{summary}} + * {{notes}}{{#requiredParams}} + * @param {{paramName}} {{description}} (required){{/requiredParams}} + * @return API{{operationId}}Request + {{#responses.0}} + * @http.response.details + + + + {{#responses}} + + {{/responses}} +
Response Details
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public API{{operationId}}Request {{operationId}}({{#requiredParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { + return new API{{operationId}}Request({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}); + } + {{/vendorExtensions.x-group-parameters}} + {{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/apiException.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/apiException.mustache new file mode 100644 index 000000000000..96283bc054d3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/apiException.mustache @@ -0,0 +1,196 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.util.Map; +import java.util.List; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +{{>generatedAnnotation}} + +public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + {{#errorObjectType}} + private {{{errorObjectType}}} errorObject = null; + {{/errorObjectType}} + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + {{#caseInsensitiveResponseHeaders}} + Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + {{#caseInsensitiveResponseHeaders}} + Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } + {{#errorObjectType}} + + /** + * Get the error object. + * + * @return Error object + */ + public {{{errorObjectType}}} getErrorObject() { + return errorObject; + } + + /** + * Get the error object. + * + * @param errorObject Error object + */ + public void setErrorObject({{{errorObjectType}}} errorObject) { + this.errorObject = errorObject; + } + {{/errorObjectType}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api_doc.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api_doc.mustache new file mode 100644 index 000000000000..dea75bd2b98e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api_doc.mustache @@ -0,0 +1,110 @@ +# {{classname}}{{#description}} +{{.}}{{/description}} + +All URIs are relative to *{{basePath}}* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +{{#operations}}{{#operation}}| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} + +# **{{operationId}}**{{^vendorExtensions.x-group-parameters}} +> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}){{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}} +> {{#returnType}}{{.}} {{/returnType}}{{operationId}}({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}}.{{paramName}}({{paramName}}){{/optionalParams}}.execute();{{/vendorExtensions.x-group-parameters}} + +{{summary}}{{#notes}} + +{{.}}{{/notes}} + +### Example +```java +// Import classes: +import {{{invokerPackage}}}.ApiClient; +import {{{invokerPackage}}}.ApiException; +import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} +import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} +import {{{invokerPackage}}}.models.*; +import {{{package}}}.{{{classname}}}; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("{{{basePath}}}"); + {{#withAWSV4Signature}} + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + {{/withAWSV4Signature}} + {{#hasAuthMethods}} + {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + // Configure HTTP basic authorization: {{{name}}} + HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setUsername("YOUR USERNAME"); + {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} + // Configure HTTP bearer authorization: {{{name}}} + HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} + {{/authMethods}} + {{/hasAuthMethods}} + + {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); + {{#allParams}} + {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} + {{/allParams}} + try { + {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} + .{{{paramName}}}({{{paramName}}}){{/optionalParams}} + .execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}} + System.out.println(result);{{/returnType}} + } catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------|{{/-last}}{{/allParams}} +{{#allParams}}| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} | +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + + - **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} + +{{#responses.0}} +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +{{#responses}} +| **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}} | +{{/responses}} +{{/responses.0}} + +{{/operation}} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api_test.mustache new file mode 100644 index 000000000000..b56bdf4db09b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api_test.mustache @@ -0,0 +1,65 @@ +{{>licenseInfo}} + +package {{package}}; + +import {{invokerPackage}}.ApiException; +{{#imports}}import {{import}}; +{{/imports}} +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{#supportStreaming}} +import java.io.InputStream; +{{/supportStreaming}} + +{{#useBeanValidation}} +import {{javaxPackage}}.validation.constraints.*; +import {{javaxPackage}}.validation.Valid; + +{{/useBeanValidation}} +/** + * API tests for {{classname}} + */ +@Disabled +public class {{classname}}Test { + + private final {{classname}} api = new {{classname}}(); + + {{#operations}} + {{#operation}} + /** + {{#summary}} + * {{summary}} + * + {{/summary}} + {{#notes}} + * {{notes}} + * + {{/notes}} + * @throws ApiException if the Api call fails + */ + @Test + public void {{operationId}}Test() throws ApiException { + {{#allParams}} + {{{dataType}}} {{paramName}} = null; + {{/allParams}} + {{#vendorExtensions.x-streaming}} + InputStream response = api.{{operationId}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} + .{{paramName}}({{paramName}}){{/optionalParams}} + .execute();{{/vendorExtensions.x-group-parameters}} + {{/vendorExtensions.x-streaming}} + {{^vendorExtensions.x-streaming}} + {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} + .{{paramName}}({{paramName}}){{/optionalParams}} + .execute();{{/vendorExtensions.x-group-parameters}} + {{/vendorExtensions.x-streaming}} + // TODO: test validations + } + + {{/operation}} + {{/operations}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/AWS4Auth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/AWS4Auth.mustache new file mode 100644 index 000000000000..d3f30b77cc52 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/AWS4Auth.mustache @@ -0,0 +1,105 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.List; +import java.util.stream.Collectors; + +import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider; +import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; +import software.amazon.awssdk.auth.credentials.AwsSessionCredentials; +import software.amazon.awssdk.auth.credentials.AwsCredentials; +import software.amazon.awssdk.auth.signer.Aws4Signer; +import software.amazon.awssdk.auth.signer.params.Aws4SignerParams; +import software.amazon.awssdk.http.ContentStreamProvider; +import software.amazon.awssdk.http.SdkHttpFullRequest; +import software.amazon.awssdk.http.SdkHttpMethod; +import software.amazon.awssdk.regions.Region; + +import okio.Buffer; + +{{>generatedAnnotation}} + +public class AWS4Auth implements Authentication { + + private AwsCredentials credentials; + private String region; + private String service; + + public AWS4Auth() { + this.credentials = AnonymousCredentialsProvider.create().resolveCredentials(); + } + + public void setCredentials(String accessKey, String secretKey) { + this.credentials = AwsBasicCredentials.create(accessKey, secretKey); + } + + public void setCredentials(String accessKey, String secretKey, String sessionToken) { + this.credentials = AwsSessionCredentials.create(accessKey, secretKey, sessionToken); + } + + public void setRegion(String region) { + this.region = region; + } + + public void setService(String service) { + this.service = service; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, + Map cookieParams, String payload, String method, URI uri) + throws ApiException { + + SdkHttpFullRequest.Builder requestBuilder = + SdkHttpFullRequest.builder().uri(uri).method(SdkHttpMethod.fromValue(method)); + + ContentStreamProvider provider = new ContentStreamProvider() { + @Override + public InputStream newStream() { + InputStream is = new ByteArrayInputStream(payload.getBytes(StandardCharsets.UTF_8)); + return is; + } + }; + + requestBuilder = requestBuilder.contentStreamProvider(provider); + + SdkHttpFullRequest signableRequest = sign(requestBuilder); + + Map headers = signableRequest.headers().entrySet().stream() + .collect(Collectors.toMap(s -> s.getKey(), e -> e.getValue().get(0))); + + headerParams.putAll(headers); + } + + /** + * AWS Signature Version 4 signing. + * + * @param request {@link SdkHttpFullRequest.Builder} + * @return {@link SdkHttpFullRequest} + */ + private SdkHttpFullRequest sign(final SdkHttpFullRequest.Builder request) { + + SdkHttpFullRequest req = request.build(); + + if (this.service != null && this.region != null && this.credentials != null) { + Aws4SignerParams params = Aws4SignerParams.builder().signingName(this.service) + .signingRegion(Region.of(this.region)).awsCredentials(this.credentials).build(); + + Aws4Signer signer = Aws4Signer.create(); + + req = signer.sign(req, params); + } + + return req; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/ApiKeyAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/ApiKeyAuth.mustache new file mode 100644 index 000000000000..ee02f7cece7f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/ApiKeyAuth.mustache @@ -0,0 +1,70 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.ApiException; +import {{invokerPackage}}.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +{{>generatedAnnotation}} + +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/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/Authentication.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/Authentication.mustache new file mode 100644 index 000000000000..da1e1902cc4b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/Authentication.mustache @@ -0,0 +1,27 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +{{>generatedAnnotation}} + +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/HttpBasicAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/HttpBasicAuth.mustache new file mode 100644 index 000000000000..634ec7ab54bb --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/HttpBasicAuth.mustache @@ -0,0 +1,44 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +{{>generatedAnnotation}} + +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/HttpBearerAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/HttpBearerAuth.mustache new file mode 100644 index 000000000000..ad6d29b8108e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/HttpBearerAuth.mustache @@ -0,0 +1,52 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +{{>generatedAnnotation}} + +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/OAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/OAuth.mustache new file mode 100644 index 000000000000..d2a8e6374c2c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/OAuth.mustache @@ -0,0 +1,33 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +{{>generatedAnnotation}} + +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/OAuthOkHttpClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/OAuthOkHttpClient.mustache new file mode 100644 index 000000000000..67d7f720d44b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/OAuthOkHttpClient.mustache @@ -0,0 +1,73 @@ +{{>licenseInfo}} + +{{#hasOAuthMethods}} +package {{invokerPackage}}.auth; + +import okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} +{{/hasOAuthMethods}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/RetryingOAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/RetryingOAuth.mustache new file mode 100644 index 000000000000..fbe73e729c98 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/auth/RetryingOAuth.mustache @@ -0,0 +1,214 @@ +{{>licenseInfo}} + +{{#hasOAuthMethods}} +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.ApiException; +import {{invokerPackage}}.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} +{{/hasOAuthMethods}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/build.gradle.mustache new file mode 100644 index 000000000000..3b41b58fedd6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/build.gradle.mustache @@ -0,0 +1,138 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +{{#sourceFolder}} +apply plugin: 'java' +{{/sourceFolder}} + +group = '{{groupId}}' +version = '{{artifactVersion}}' + +repositories { + mavenCentral() +} +{{#sourceFolder}} +sourceSets { + main.java.srcDirs = ['{{sourceFolder}}'] +} + +{{/sourceFolder}} + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = {{#java17}}JavaVersion.VERSION_17{{/java17}}{{^java17}}{{#java11}}JavaVersion.VERSION_11{{/java11}}{{^java11}}JavaVersion.VERSION_1_8{{/java11}}{{/java17}} +targetCompatibility = {{#java17}}JavaVersion.VERSION_17{{/java17}}{{^java17}}{{#java11}}JavaVersion.VERSION_11{{/java11}}{{^java11}}JavaVersion.VERSION_1_8{{/java11}}{{/java17}} + +publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + {{#swagger1AnnotationLibrary}} + swagger_annotations_version = "1.6.6" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + swagger_annotations_version = "2.2.15" + {{/swagger2AnnotationLibrary}} + {{#useJakartaEe}} + jakarta_annotation_version = "2.1.1" + {{#useBeanValidation}} + bean_validation_version = "3.0.2" + {{/useBeanValidation}} + {{/useJakartaEe}} + {{^useJakartaEe}} + jakarta_annotation_version = "1.3.5" + {{#useBeanValidation}} + bean_validation_version = "2.0.2" + {{/useBeanValidation}} + {{/useJakartaEe}} + {{#isJackson}} + {{#useJackson3}} + jackson_version = "3.2.1" + {{/useJackson3}} + {{^useJackson3}} + jackson_version = "2.17.1" + {{/useJackson3}} + {{/isJackson}} + okhttp_version = "5.4.0" +} + +dependencies { + {{#swagger1AnnotationLibrary}} + implementation "io.swagger:swagger-annotations:$swagger_annotations_version" + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version" + {{/swagger2AnnotationLibrary}} + {{^useJspecify}} + implementation "com.google.code.findbugs:jsr305:3.0.2" + {{/useJspecify}} + {{#useJspecify}} + implementation "org.jspecify:jspecify:1.0.0" + {{/useJspecify}} + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + {{#isGson}} + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + {{/isGson}} + {{#isJackson}} + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + {{#openApiNullable}} + implementation 'org.openapitools:jackson-databind-nullable:0.2.10' + {{/openApiNullable}} + {{/isJackson}} + {{#isJsonb}} + implementation 'jakarta.json.bind:jakarta.json.bind-api:3.0.1' + implementation 'org.eclipse:yasson:3.0.4' + implementation 'jakarta.json:jakarta.json-api:2.1.3' + implementation 'org.eclipse.parsson:parsson:1.1.7' + {{/isJsonb}} + {{#withAWSV4Signature}} + implementation 'software.amazon.awssdk:auth:2.20.157' + {{/withAWSV4Signature}} + {{#hasOAuthMethods}} + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + {{/hasOAuthMethods}} + {{#useReflectionEqualsHashCode}} + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.18.0' + {{/useReflectionEqualsHashCode}} + {{#joda}} + implementation 'joda-time:joda-time:2.12.0' + {{/joda}} + {{#dynamicOperations}} + implementation 'io.swagger.parser.v3:swagger-parser-v3:2.0.30' + {{/dynamicOperations}} + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + {{#useBeanValidation}} + compileOnly "jakarta.validation:jakarta.validation-api:$bean_validation_version" + {{/useBeanValidation}} + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/model.mustache new file mode 100644 index 000000000000..3a1cca8d7d4f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/model.mustache @@ -0,0 +1,35 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#useReflectionEqualsHashCode}} +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +{{/useReflectionEqualsHashCode}} +import java.util.Objects; +{{#imports}} +import {{import}}; +{{/imports}} +{{#serializableModel}} +import java.io.Serializable; +{{/serializableModel}} +{{#withXml}} +import {{javaxPackage}}.xml.bind.annotation.*; +{{/withXml}} +{{#parcelableModel}} +import android.os.Parcelable; +import android.os.Parcel; +{{/parcelableModel}} +{{#useBeanValidation}} +import {{javaxPackage}}.validation.constraints.*; +import {{javaxPackage}}.validation.Valid; +{{/useBeanValidation}} +{{#performBeanValidation}} +import org.hibernate.validator.constraints.*; +{{/performBeanValidation}} + +{{#models}} +{{#model}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#oneOf}}{{#-first}}{{>oneof_model}}{{/-first}}{{/oneOf}}{{^oneOf}}{{#anyOf}}{{#-first}}{{>anyof_model}}{{/-first}}{{/anyOf}}{{^anyOf}}{{>pojo}}{{/anyOf}}{{/oneOf}}{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelEnum.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelEnum.mustache new file mode 100644 index 000000000000..73766d386305 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelEnum.mustache @@ -0,0 +1,114 @@ +import java.io.IOException; +{{#isUri}} +import java.net.URI; +{{/isUri}} +{{#isGson}} +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +{{/isGson}} +{{#isJackson}} +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +{{/isJackson}} +{{#isJsonb}} +import jakarta.json.bind.annotation.JsonbCreator; +import jakarta.json.bind.annotation.JsonbValue; +{{/isJsonb}} + +/** + * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} + */ +{{#isDeprecated}} +@Deprecated +{{/isDeprecated}} +{{#isGson}} +@JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class) +{{/isGson}} +{{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}{{#vendorExtensions.x-implements}}{{#-first}} implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { + {{#allowableValues}}{{#enumVars}} + {{#enumDescription}} + /** + * {{.}} + */ + {{/enumDescription}} + {{#withXml}} + @XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{/withXml}} + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + + private {{{dataType}}} value; + + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { + this.value = value; + } + + {{#isJackson}} + @JsonValue + {{/isJackson}} + {{#isJsonb}} + @JsonbValue + {{/isJsonb}} + public {{{dataType}}} getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + {{#isJackson}} + @JsonCreator + {{/isJackson}} + {{#isJsonb}} + @JsonbCreator + {{/isJsonb}} + public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { + for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (b.value.equals{{#isString}}{{#useEnumCaseInsensitive}}IgnoreCase{{/useEnumCaseInsensitive}}{{/isString}}(value)) { + return b; + } + } + {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}} + } + + {{#isGson}} + public static class Adapter extends TypeAdapter<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> { + @Override + public void write(final JsonWriter jsonWriter, final {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} enumeration) throws IOException { + jsonWriter.value(enumeration.getValue(){{#isUri}}.toASCIIString(){{/isUri}}); + } + + @Override + public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { + {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}}{{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isUri}}URI.create({{/isUri}}jsonElement.{{#isNumber}}getAsString(){{/isNumber}}{{#isInteger}}getAsInt(){{/isInteger}}{{#isUri}}getAsString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}getAs{{{dataType}}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + } + {{/isGson}} +{{#supportUrlQuery}} + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + if (prefix == null) { + prefix = ""; + } + + return String.format(java.util.Locale.ROOT, "%s=%s", prefix, this.toString()); + } +{{/supportUrlQuery}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelInnerEnum.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelInnerEnum.mustache new file mode 100644 index 000000000000..a9a4e8396afd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelInnerEnum.mustache @@ -0,0 +1,82 @@ + /** + * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} + */ + {{#isGson}} + @JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.Adapter.class) + {{/isGson}} +{{#withXml}} + @XmlType(name="{{datatypeWithEnum}}") + @XmlEnum({{dataType}}.class) +{{/withXml}} + {{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-implements}}{{#-first}} implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { + {{#allowableValues}} + {{#enumVars}} + {{#enumDescription}} + /** + * {{.}} + */ + {{/enumDescription}} + {{#withXml}} + @XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{/withXml}} + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}} + {{/enumVars}} + {{/allowableValues}} + + private {{{dataType}}} value; + + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{{dataType}}} value) { + this.value = value; + } + + {{#isJackson}} + @JsonValue + {{/isJackson}} + {{#isJsonb}} + @JsonbValue + {{/isJsonb}} + public {{{dataType}}} getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + {{#isJackson}} + @JsonCreator + {{/isJackson}} + {{#isJsonb}} + @JsonbCreator + {{/isJsonb}} + public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { + for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (b.value.equals{{#isString}}{{#useEnumCaseInsensitive}}IgnoreCase{{/useEnumCaseInsensitive}}{{/isString}}(value)) { + return b; + } + } + {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}} + } + + {{#isGson}} + public static class Adapter extends TypeAdapter<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}> { + @Override + public void write(final JsonWriter jsonWriter, final {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} enumeration) throws IOException { + jsonWriter.value(enumeration.getValue(){{#isUri}}.toASCIIString(){{/isUri}}); + } + + @Override + public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { + {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}} {{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isUri}}URI.create({{/isUri}}jsonElement.{{#isNumber}}getAsString(){{/isNumber}}{{#isInteger}}getAsInt(){{/isInteger}}{{#isUri}}getAsString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}getAs{{{dataType}}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + } + {{/isGson}} + } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/model_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/model_test.mustache new file mode 100644 index 000000000000..040d319bf114 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/model_test.mustache @@ -0,0 +1,42 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for {{classname}} + */ +public class {{classname}}Test { + {{#models}} + {{#model}} + {{^vendorExtensions.x-is-one-of-interface}} + {{^isEnum}} + private final {{classname}} model = new {{classname}}(); + + {{/isEnum}} + /** + * Model tests for {{classname}} + */ + @Test + public void test{{classname}}() { + // TODO: test {{classname}} + } + + {{#allVars}} + /** + * Test the property '{{name}}' + */ + @Test + public void {{name}}Test() { + // TODO: test {{name}} + } + + {{/allVars}} + {{/vendorExtensions.x-is-one-of-interface}} + {{/model}} + {{/models}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/oneof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/oneof_model.mustache new file mode 100644 index 000000000000..0bd87d611144 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/oneof_model.mustache @@ -0,0 +1,738 @@ +{{#isGson}} +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +{{/isGson}} +{{#isJackson}} +import {{jacksonPackage}}.core.JsonGenerator; +import {{jacksonPackage}}.core.JsonParser; +import {{jacksonPackage}}.core.JsonToken; +import {{jacksonPackage}}.core.type.TypeReference; +import {{jacksonPackage}}.databind.DeserializationContext; +{{^useJackson3}} +import {{jacksonPackage}}.databind.JsonMappingException; +{{/useJackson3}} +import {{jacksonPackage}}.databind.JsonNode; +import {{jacksonPackage}}.databind.MapperFeature; +{{^useJackson3}} +import {{jacksonPackage}}.databind.SerializerProvider; +{{/useJackson3}} +import {{jacksonPackage}}.databind.annotation.JsonDeserialize; +import {{jacksonPackage}}.databind.annotation.JsonSerialize; +import {{jacksonPackage}}.databind.deser.std.StdDeserializer; +import {{jacksonPackage}}.databind.ser.std.StdSerializer; +import {{jacksonPackage}}.databind.JavaType; +{{#useJackson3}} +import {{jacksonPackage}}.core.JacksonException; +import {{jacksonPackage}}.databind.DatabindException; +import {{jacksonPackage}}.databind.SerializationContext; +{{/useJackson3}} +{{/isJackson}} + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import {{invokerPackage}}.JSON; + +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} +{{#isJackson}} +@JsonDeserialize(using = {{classname}}.{{classname}}Deserializer.class) +@JsonSerialize(using = {{classname}}.{{classname}}Serializer.class) +{{/isJackson}} +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}} implements {{{.}}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-implements}} { + private static final Logger log = Logger.getLogger({{classname}}.class.getName()); + + {{#isGson}} + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to {{classname}} + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + {{#useOneOfDiscriminatorLookup}} + {{#discriminator}} + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("{{{propertyBaseName}}}") == null) { + throw new IOException("Failed to deserialize as the discriminator field '{{{propertyBaseName}}}' is missing."); + } + String discriminatorValue = jsonObject.get("{{{propertyBaseName}}}").getAsString(); + {{#mappedModels}} + if ("{{{mappingName}}}".equals(discriminatorValue)) { + {{{modelName}}}.validateJsonElement(jsonElement); + return; + } + {{/mappedModels}} + {{/discriminator}} + {{/useOneOfDiscriminatorLookup}} + {{#composedSchemas}} + {{#oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + // deserialize {{{dataType}}} + try { + // validate the JSON object to see if any exception is thrown + {{#isModel}} + {{#hasChildren}} + {{{dataType}}}.validateJsonElement(jsonElement); + {{/hasChildren}} + {{^hasChildren}} + {{#isArray}} + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isArray}} + {{^isArray}} + {{#isMap}} + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isMap}} + {{^isMap}} + {{{dataType}}}.validateJsonElement(jsonElement); + {{/isMap}} + {{/isArray}} + {{/hasChildren}} + {{/isModel}} + {{#isPrimitiveType}} + {{#isArray}} + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isArray}} + {{^isArray}} + {{#isMap}} + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isMap}} + {{^isMap}} + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isMap}} + {{/isArray}} + {{/isPrimitiveType}} + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage())); + } + + {{/vendorExtensions.x-duplicated-data-type}} + {{/oneOf}} + {{/composedSchemas}} + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for {{classname}}: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!{{classname}}.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes '{{classname}}' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + {{#composedSchemas}} + {{#oneOf}} + {{^isArray}} + {{^isMap}} + {{^vendorExtensions.x-duplicated-data-type}} + final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}} = gson.getDelegateAdapter(this, TypeToken.get({{{dataType}}}.class)); + {{/vendorExtensions.x-duplicated-data-type}} + {{/isMap}} + {{/isArray}} + {{#isArray}} + final Type typeInstance{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}} = new TypeToken<{{{dataType}}}>(){}.getType(); + final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance)); + {{/isArray}} + {{#isMap}} + final Type typeInstance{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}} = new TypeToken<{{{dataType}}}>(){}.getType(); + final TypeAdapter<{{{dataType}}}> adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}} = (TypeAdapter<{{{dataType}}}>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance)); + {{/isMap}} + {{/oneOf}} + {{/composedSchemas}} + + return (TypeAdapter) new TypeAdapter<{{classname}}>() { + @Override + public void write(JsonWriter out, {{classname}} value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + {{#composedSchemas}} + {{#oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + // check if the actual instance is of the type `{{{dataType}}}` + if (value.getActualInstance() instanceof {{#isArray}}List{{/isArray}}{{#isMap}}Map{{/isMap}}{{^isMap}}{{^isArray}}{{{dataType}}}{{/isArray}}{{/isMap}}) { + {{#isPrimitiveType}} + {{^isMap}} + JsonPrimitive primitive = adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}}.toJsonTree(({{{dataType}}})value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + {{/isMap}} + {{#isMap}} + JsonObject object = adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}}.toJsonTree(({{{dataType}}})value.getActualInstance()).getAsJsonObject(); + elementAdapter.write(out, object); + return; + {{/isMap}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isArray}} + List list = (List) value.getActualInstance(); + if (!list.isEmpty() && list.get(0) instanceof {{{items.dataType}}}) { + JsonArray array = adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}}.toJsonTree(({{{dataType}}})value.getActualInstance()).getAsJsonArray(); + elementAdapter.write(out, array); + return; + } + {{/isArray}} + {{/isPrimitiveType}} + {{^isMap}} + {{^isArray}} + {{^isPrimitiveType}} + JsonElement element = adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}}.toJsonTree(({{{dataType}}})value.getActualInstance()); + elementAdapter.write(out, element); + return; + {{/isPrimitiveType}} + {{/isArray}} + {{/isMap}} + } + + {{/vendorExtensions.x-duplicated-data-type}} + {{/oneOf}} + {{/composedSchemas}} + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}"); + } + + @Override + public {{classname}} read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + {{#useOneOfDiscriminatorLookup}} + {{#discriminator}} + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("{{{propertyBaseName}}}") == null) { + throw new IOException("Failed to deserialize as the discriminator field '{{{propertyBaseName}}}' is missing."); + } + String discriminatorValue = jsonObject.get("{{{propertyBaseName}}}").getAsString(); + {{#mappedModels}} + if ("{{{mappingName}}}".equals(discriminatorValue)) { + deserialized = adapter{{#sanitizeDataType}}{{{modelName}}}{{/sanitizeDataType}}.fromJsonTree(jsonElement); + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(deserialized); + return ret; + } + {{/mappedModels}} + {{/discriminator}} + {{/useOneOfDiscriminatorLookup}} + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + {{#composedSchemas}} + {{#oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + // deserialize {{{dataType}}} + try { + // validate the JSON object to see if any exception is thrown + {{#isModel}} + {{#hasChildren}} + {{{dataType}}}.validateJsonElement(jsonElement); + {{/hasChildren}} + {{^hasChildren}} + {{#isArray}} + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isArray}} + {{^isArray}} + {{#isMap}} + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isMap}} + {{^isMap}} + {{{dataType}}}.validateJsonElement(jsonElement); + {{/isMap}} + {{/isArray}} + {{/hasChildren}} + {{/isModel}} + {{#isPrimitiveType}} + {{#isArray}} + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isArray}} + {{^isArray}} + {{#isMap}} + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isMap}} + {{^isMap}} + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + {{/isMap}} + {{/isArray}} + {{/isPrimitiveType}} + actualAdapter = adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}}; + match++; + log.log(Level.FINER, "Input data matches schema '{{{dataType}}}'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema '{{{dataType}}}'", e); + } + + {{/vendorExtensions.x-duplicated-data-type}} + {{/oneOf}} + {{/composedSchemas}} + if (match == 1) { + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for {{classname}}: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + {{/isGson}} + + {{#isJackson}} + public static class {{classname}}Serializer extends StdSerializer<{{classname}}> { + public {{classname}}Serializer(Class<{{classname}}> t) { + super(t); + } + + public {{classname}}Serializer() { + this(null); + } + + @Override + public void serialize({{classname}} value, JsonGenerator jgen, {{^useJackson3}}SerializerProvider provider{{/useJackson3}}{{#useJackson3}}SerializationContext serializationContext{{/useJackson3}}) throws {{^useJackson3}}IOException{{/useJackson3}}{{#useJackson3}}JacksonException{{/useJackson3}} { + {{^useJackson3}} + jgen.writeObject(value.getActualInstance()); + {{/useJackson3}} + {{#useJackson3}} + serializationContext.writeValue(jgen, value.getActualInstance()); + {{/useJackson3}} + } + } + + public static class {{classname}}Deserializer extends StdDeserializer<{{classname}}> { + public {{classname}}Deserializer() { + this({{classname}}.class); + } + + public {{classname}}Deserializer(Class vc) { + super(vc); + } + + @Override + public {{classname}} deserialize(JsonParser jp, DeserializationContext ctxt) throws {{^useJackson3}}IOException{{/useJackson3}}{{#useJackson3}}JacksonException{{/useJackson3}} { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + {{#useOneOfDiscriminatorLookup}} + {{#discriminator}} + {{classname}} new{{classname}} = new {{classname}}(); + {{^useJackson3}} + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("{{{propertyBaseName}}}"); + {{/useJackson3}} + {{#useJackson3}} + String discriminatorValue = tree.path("{{{propertyBaseName}}}").asText(null); + {{/useJackson3}} + if (discriminatorValue != null) { + switch (discriminatorValue) { + {{#mappedModels}} + case "{{{mappingName}}}": + {{^useJackson3}} + deserialized = tree.traverse(jp.getCodec()).readValueAs({{{modelName}}}.class); + {{/useJackson3}} + {{#useJackson3}} + deserialized = ctxt.readTreeAsValue(tree, {{{modelName}}}.class); + {{/useJackson3}} + new{{classname}}.setActualInstance(deserialized); + return new{{classname}}; + {{/mappedModels}} + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue)); + } + } + + {{/discriminator}} + {{/useOneOfDiscriminatorLookup}} + {{^useJackson3}} + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + {{/useJackson3}} + {{#useJackson3}} + boolean typeCoercion = false; + {{/useJackson3}} + int match = 0; + {{^useJackson3}} + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + {{/useJackson3}} + {{#useJackson3}} + JsonToken token = tree.asToken(); + {{/useJackson3}} + {{#oneOf}} + // deserialize {{{.}}} + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if ({{{.}}}.class.equals(Integer.class) || {{{.}}}.class.equals(Long.class) || {{{.}}}.class.equals(Float.class) || {{{.}}}.class.equals(Double.class) || {{{.}}}.class.equals(Boolean.class) || {{{.}}}.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= (({{{.}}}.class.equals(Integer.class) || {{{.}}}.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= (({{{.}}}.class.equals(Float.class) || {{{.}}}.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= ({{{.}}}.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= ({{{.}}}.class.equals(String.class) && token == JsonToken.VALUE_STRING); + {{#isNullable}} + attemptParsing |= (token == JsonToken.VALUE_NULL); + {{/isNullable}} + } + } + if (attemptParsing) { + {{^useJackson3}} + deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.class); + {{/useJackson3}} + {{#useJackson3}} + deserialized = ctxt.readTreeAsValue(tree, {{{.}}}.class); + {{/useJackson3}} + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema '{{{.}}}'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e); + } + + {{/oneOf}} + if (match == 1) { + {{classname}} ret = new {{classname}}(); + ret.setActualInstance(deserialized); + return ret; + } + {{^useJackson3}} + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for {{classname}}: %d classes match result, expected 1", match)); + {{/useJackson3}} + {{#useJackson3}} + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for {{classname}}: %d classes match result, expected 1", match)); + {{/useJackson3}} + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + {{^useJackson3}} + public {{classname}} getNullValue(DeserializationContext ctxt) throws JsonMappingException { + {{/useJackson3}} + {{#useJackson3}} + public {{classname}} getNullValue(DeserializationContext ctxt) { + {{/useJackson3}} + {{#isNullable}} + return null; + {{/isNullable}} + {{^isNullable}} + {{^useJackson3}} + throw new JsonMappingException(ctxt.getParser(), "{{classname}} cannot be null"); + {{/useJackson3}} + {{#useJackson3}} + throw DatabindException.from(ctxt.getParser(), "{{classname}} cannot be null"); + {{/useJackson3}} + {{/isNullable}} + } + } + {{/isJackson}} + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public {{classname}}() { + super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + } + + {{#oneOf}} + public {{classname}}({{{.}}} o) { + super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}}); + setActualInstance(o); + } + + {{/oneOf}} + static { + {{#oneOf}} + schemas.put("{{{.}}}", {{{.}}}.class); + {{/oneOf}} + {{#isJackson}} + JSON.registerDescendants({{classname}}.class, Collections.unmodifiableMap(schemas)); + {{#discriminator}} + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + {{#mappedModels}} + mappings.put("{{mappingName}}", {{modelName}}.class); + {{/mappedModels}} + mappings.put("{{name}}", {{classname}}.class); + JSON.registerDiscriminator({{classname}}.class, "{{propertyBaseName}}", mappings); + {{/discriminator}} + {{/isJackson}} + } + + @Override + public Map> getSchemas() { + return {{classname}}.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}} + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + {{#isNullable}} + if (instance == null) { + super.setActualInstance(instance); + return; + } + + {{/isNullable}} + {{#oneOf}} + if (JSON.isInstanceOf({{{.}}}.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + {{/oneOf}} + throw new RuntimeException("Invalid instance type. Must be {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}"); + } + + /** + * Get the actual instance, which can be the following: + * {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}} + * + * @return The actual instance ({{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + {{#oneOf}} + /** + * Get the actual instance of `{{{.}}}`. If the actual instance is not `{{{.}}}`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `{{{.}}}` + * @throws ClassCastException if the instance is not `{{{.}}}` + */ + public {{{.}}} get{{{.}}}() throws ClassCastException { + return ({{{.}}})super.getActualInstance(); + } + + {{/oneOf}} + +{{#supportUrlQuery}} + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + {{#composedSchemas.oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + if (getActualInstance() instanceof {{{dataType}}}) { + {{#isArray}} + {{#items.isPrimitiveType}} + {{#uniqueItems}} + if (getActualInstance() != null) { + int i = 0; + for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(String.valueOf(_item)))); + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if (getActualInstance() != null) { + for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(String.valueOf(getActualInstance().get(i))))); + } + } + {{/uniqueItems}} + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + {{#items.isModel}} + {{#uniqueItems}} + if (getActualInstance() != null) { + int i = 0; + for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) { + if (_item != null) { + joiner.add(_item.toUrlQueryString(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + i++; + } + {{/uniqueItems}} + {{^uniqueItems}} + if (getActualInstance() != null) { + for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) { + if ((({{{dataType}}})getActualInstance()).get(i) != null) { + joiner.add((({{{items.dataType}}})getActualInstance()).get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{^items.isModel}} + {{#uniqueItems}} + if (getActualInstance() != null) { + int i = 0; + for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) { + if (_item != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(String.valueOf(_item)))); + } + i++; + } + } + {{/uniqueItems}} + {{^uniqueItems}} + if (getActualInstance() != null) { + for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) { + if (getActualInstance().get(i) != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(String.valueOf((({{{dataType}}})getActualInstance()).get(i))))); + } + } + } + {{/uniqueItems}} + {{/items.isModel}} + {{/items.isPrimitiveType}} + {{/isArray}} + {{^isArray}} + {{#isMap}} + {{#items.isPrimitiveType}} + if (getActualInstance() != null) { + for (String _key : (({{{dataType}}})getActualInstance()).keySet()) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix), + getActualInstance().get(_key), ApiClient.urlEncode(String.valueOf((({{{dataType}}})getActualInstance()).get(_key))))); + } + } + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + if (getActualInstance() != null) { + for (String _key : (({{{dataType}}})getActualInstance()).keySet()) { + if ((({{{dataType}}})getActualInstance()).get(_key) != null) { + joiner.add((({{{items.dataType}}})getActualInstance()).get(_key).toUrlQueryString(String.format(java.util.Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix)))); + } + } + } + {{/items.isPrimitiveType}} + {{/isMap}} + {{^isMap}} + {{#isPrimitiveType}} + if (getActualInstance() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(String.valueOf(getActualInstance())))); + } + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isModel}} + if (getActualInstance() != null) { + joiner.add((({{{dataType}}})getActualInstance()).toUrlQueryString(prefix + "{{{baseName}}}" + suffix)); + } + {{/isModel}} + {{^isModel}} + if (getActualInstance() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(String.valueOf(getActualInstance())))); + } + {{/isModel}} + {{/isPrimitiveType}} + {{/isMap}} + {{/isArray}} + return joiner.toString(); + } + {{/vendorExtensions.x-duplicated-data-type}} + {{/composedSchemas.oneOf}} + return null; + } +{{/supportUrlQuery}} + +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/pojo.mustache new file mode 100644 index 000000000000..5d7a30f8fbb5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/pojo.mustache @@ -0,0 +1,670 @@ +{{#isGson}} +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +{{/isGson}} +{{#isJackson}} +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +{{/isJackson}} +{{#isJsonb}} +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +{{/isJsonb}} +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import {{invokerPackage}}.JSON; + +/** + * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} + * @deprecated{{/isDeprecated}} + */{{#isDeprecated}} +@Deprecated{{/isDeprecated}} +{{#swagger1AnnotationLibrary}} +{{#description}} +@ApiModel(description = "{{{.}}}") +{{/description}} +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} +{{#description}} +@Schema(description = "{{{.}}}") +{{/description}} +{{/swagger2AnnotationLibrary}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{#vendorExtensions.x-class-extra-annotation}} +{{{.}}} +{{/vendorExtensions.x-class-extra-annotation}} +{{#isJackson}} +@JsonPropertyOrder({ +{{#vars}} + {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} +{{/vars}} +}) +{{#jacksonPackageName}} +@tools.jackson.annotation.JsonTypeName("{{name}}") +{{/jacksonPackageName}} +{{^jacksonPackageName}} +@JsonTypeName("{{name}}") +{{/jacksonPackageName}} +{{/isJackson}} +public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ +{{#serializableModel}} + private static final long serialVersionUID = 1L; + +{{/serializableModel}} + {{#vars}} + {{#isEnum}} + {{^isContainer}} +{{>modelInnerEnum}} + + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} +{{>modelInnerEnum}} + + {{/mostInnerItems}} + {{/isContainer}} + {{/isEnum}} + {{#isGson}} + public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}"; + {{/isGson}} + {{#isJackson}} + public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; + {{/isJackson}} + {{#isJsonb}} + public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}"; + {{/isJsonb}} + {{#withXml}} + @Xml{{#isXmlAttribute}}Attribute{{/isXmlAttribute}}{{^isXmlAttribute}}Element{{/isXmlAttribute}}(name = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{#isXmlWrapped}} + @XmlElementWrapper(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{/isXmlWrapped}} + {{/withXml}} + {{#deprecated}} + @Deprecated + {{/deprecated}} + {{#isGson}} + @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) + {{/isGson}} + {{#isJackson}} + @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}) + {{#includeIfNull}} + @JsonInclude(value = JsonInclude.Include.ALWAYS) + {{/includeIfNull}} + {{#isReadOnly}} + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + {{/isReadOnly}} + {{#isWriteOnly}} + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + {{/isWriteOnly}} + {{/isJackson}} + {{#isJsonb}} + @JsonbProperty(SERIALIZED_NAME_{{nameInSnakeCase}}) + {{/isJsonb}} + {{#vendorExtensions.x-field-extra-annotation}} + {{{.}}} + {{/vendorExtensions.x-field-extra-annotation}} + {{>nullable_var_annotations}}{{! prevent indent}} + {{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{>nullableDatatypeWithEnum}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + + {{/vars}} + public {{classname}}() { + {{#parent}} + {{#parcelableModel}} + super(); + {{/parcelableModel}} + {{/parent}} + {{#discriminator}} + {{#discriminator.isEnum}} +{{#readWriteVars}}{{#isDiscriminator}}{{#defaultValue}} + this.{{name}} = {{defaultValue}}; +{{/defaultValue}}{{/isDiscriminator}}{{/readWriteVars}} + {{/discriminator.isEnum}} + {{^discriminator.isEnum}} + this.{{{discriminatorName}}} = this.getClass().getSimpleName(); + {{/discriminator.isEnum}} + {{/discriminator}} + } + {{#vendorExtensions.x-has-readonly-properties}} + {{^withXml}} + + public {{classname}}( + {{#readOnlyVars}} + {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} + {{/readOnlyVars}} + ) { + this(); + {{#readOnlyVars}} + this.{{name}} = {{name}}; + {{/readOnlyVars}} + } + {{/withXml}} + {{/vendorExtensions.x-has-readonly-properties}} + {{#vars}} + + {{^isReadOnly}} + {{#deprecated}} + @Deprecated + {{/deprecated}} + public {{classname}} {{name}}({{>nullableArgumentWithEnum}} {{name}}) { + this.{{name}} = {{name}}; + return this; + } + {{#isArray}} + + public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}; + } + this.{{name}}.add({{name}}Item); + return this; + } + {{/isArray}} + {{#isMap}} + + public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}; + } + this.{{name}}.put(key, {{name}}Item); + return this; + } + {{/isMap}} + + {{/isReadOnly}} + /** + {{#description}} + * {{.}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{.}} + {{/minimum}} + {{#maximum}} + * maximum: {{.}} + {{/maximum}} + * @return {{name}} + {{#deprecated}} + * @deprecated + {{/deprecated}} + */ +{{#deprecated}} + @Deprecated +{{/deprecated}} + {{>nullable_var_annotations}}{{! prevent indent}} +{{#useBeanValidation}} +{{>beanValidation}} + +{{/useBeanValidation}} +{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") +{{/swagger2AnnotationLibrary}} +{{#vendorExtensions.x-extra-annotation}} + {{{vendorExtensions.x-extra-annotation}}} +{{/vendorExtensions.x-extra-annotation}} +{{#jackson}}{{> jackson_annotations}}{{/jackson}} + public {{>nullableDatatypeWithEnum}} {{getter}}() { + return {{name}}; + } + + {{^isReadOnly}} +{{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}} +{{/vendorExtensions.x-setter-extra-annotation}}{{#deprecated}} @Deprecated +{{/deprecated}}{{#jackson}}{{> jackson_annotations}}{{/jackson}} public void {{setter}}({{>nullableArgumentWithEnum}} {{name}}) { + this.{{name}} = {{name}}; + } + {{/isReadOnly}} + + {{/vars}} +{{>additional_properties}} + + + @Override + public boolean equals(Object o) { + {{#useReflectionEqualsHashCode}} + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + }{{#hasVars}} + {{classname}} {{classVarName}} = ({{classname}}) o; + return {{#vars}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} && + {{/-last}}{{/vars}}{{#isAdditionalPropertiesTrue}}&& + Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/isAdditionalPropertiesTrue}}{{#parent}} && + super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} + return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}} + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public int hashCode() { + {{#useReflectionEqualsHashCode}} + return HashCodeBuilder.reflectionHashCode(this); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + return Objects.hash({{#vars}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#isAdditionalPropertiesTrue}}{{#hasVars}}, {{/hasVars}}{{^hasVars}}{{#parent}}, {{/parent}}{{/hasVars}}additionalProperties{{/isAdditionalPropertiesTrue}}); + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}} + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + {{/parent}} + {{#vars}} + sb.append(" {{name}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n"); + {{/vars}} +{{#isAdditionalPropertiesTrue}} + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); +{{/isAdditionalPropertiesTrue}} + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +{{#parcelableModel}} + + public void writeToParcel(Parcel out, int flags) { +{{#model}} +{{#isArray}} + out.writeList(this); +{{/isArray}} +{{^isArray}} +{{#parent}} + super.writeToParcel(out, flags); +{{/parent}} +{{#vars}} + out.writeValue({{name}}); +{{/vars}} +{{/isArray}} +{{/model}} + } + + {{classname}}(Parcel in) { +{{#isArray}} + in.readTypedList(this, {{arrayModelType}}.CREATOR); +{{/isArray}} +{{^isArray}} +{{#parent}} + super(in); +{{/parent}} +{{#vars}} +{{#isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); +{{/isPrimitiveType}} +{{^isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader()); +{{/isPrimitiveType}} +{{/vars}} +{{/isArray}} + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() { + public {{classname}} createFromParcel(Parcel in) { +{{#model}} +{{#isArray}} + {{classname}} result = new {{classname}}(); + result.addAll(in.readArrayList({{arrayModelType}}.class.getClassLoader())); + return result; +{{/isArray}} +{{^isArray}} + return new {{classname}}(in); +{{/isArray}} +{{/model}} + } + public {{classname}}[] newArray(int size) { + return new {{classname}}[size]; + } + }; +{{/parcelableModel}} + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + {{#hasVars}} + openapiFields = new HashSet(Arrays.asList({{#allVars}}"{{baseName}}"{{^-last}}, {{/-last}}{{/allVars}})); + {{/hasVars}} + {{^hasVars}} + openapiFields = new HashSet(0); + {{/hasVars}} + + // a set of required properties/fields (JSON key names) + {{#hasRequired}} + openapiRequiredFields = new HashSet(Arrays.asList({{#requiredVars}}"{{baseName}}"{{^-last}}, {{/-last}}{{/requiredVars}})); + {{/hasRequired}} + {{^hasRequired}} + openapiRequiredFields = new HashSet(0); + {{/hasRequired}} + } + +{{#isGson}} + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to {{classname}} + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!{{classname}}.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in {{{classname}}} is not found in the empty JSON string", {{classname}}.openapiRequiredFields.toString())); + } + } + {{^hasChildren}} + {{^isAdditionalPropertiesTrue}} + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!{{classname}}.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `{{classname}}` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + {{/isAdditionalPropertiesTrue}} + {{#requiredVars}} + {{#-first}} + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : {{classname}}.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + {{/-first}} + {{/requiredVars}} + {{/hasChildren}} + {{^discriminator}} + {{#hasVars}} + JsonObject jsonObj = jsonElement.getAsJsonObject(); + {{/hasVars}} + {{#vars}} + {{#isArray}} + {{#items.isModel}} + {{#required}} + if (jsonObj.get("{{{baseName}}}") != null{{#isNullable}} && !jsonObj.get("{{{baseName}}}").isJsonNull(){{/isNullable}}) { + if (!jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + JsonArray jsonArray{{name}} = jsonObj.getAsJsonArray("{{{baseName}}}"); + // validate the required field `{{{baseName}}}` (array) + for (int i = 0; i < jsonArray{{name}}.size(); i++) { + {{{items.dataType}}}.validateJsonElement(jsonArray{{name}}.get(i)); + } + } + {{/required}} + {{^required}} + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + JsonArray jsonArray{{name}} = jsonObj.getAsJsonArray("{{{baseName}}}"); + if (jsonArray{{name}} != null) { + // ensure the json data is an array + if (!jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + + // validate the optional field `{{{baseName}}}` (array) + for (int i = 0; i < jsonArray{{name}}.size(); i++) { + {{{items.dataType}}}.validateJsonElement(jsonArray{{name}}.get(i)); + }; + } + } + {{/required}} + {{/items.isModel}} + {{^items.isModel}} + {{^required}} + // ensure the optional json data is an array if present + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull() && !jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + {{/required}} + {{#required}} + // ensure the required json array is present + if (jsonObj.get("{{{baseName}}}") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("{{{baseName}}}").isJsonArray(){{#isNullable}} && !jsonObj.get("{{baseName}}").isJsonNull(){{/isNullable}}) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + {{/required}} + {{/items.isModel}} + {{/isArray}} + {{^isContainer}} + {{#isString}} + if ({{#notRequiredOrIsNullable}}(jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) && {{/notRequiredOrIsNullable}}!jsonObj.get("{{{baseName}}}").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `{{{baseName}}}` to be a primitive type in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + {{/isString}} + {{#isModel}} + {{^isEnum}} + {{#required}} + {{#isNullable}} + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + {{/isNullable}} + // validate the required field `{{{baseName}}}` + {{{dataType}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + {{#isNullable}} + } + {{/isNullable}} + {{/required}} + {{^required}} + // validate the optional field `{{{baseName}}}` + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + {{{dataType}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + } + {{/required}} + {{/isEnum}} + {{/isModel}} + {{#isEnum}} + {{#required}} + {{#isNullable}} + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + {{/isNullable}} + // validate the required field `{{{baseName}}}` + {{{datatypeWithEnum}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + {{#isNullable}} + } + {{/isNullable}} + {{/required}} + {{^required}} + // validate the optional field `{{{baseName}}}` + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + {{{datatypeWithEnum}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + } + {{/required}} + {{/isEnum}} + {{#isEnumRef}} + {{#required}} + {{#isNullable}} + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + {{/isNullable}} + // validate the required field `{{{baseName}}}` + {{{dataType}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + {{#isNullable}} + } + {{/isNullable}} + {{/required}} + {{^required}} + // validate the optional field `{{{baseName}}}` + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + {{{dataType}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + } + {{/required}} + {{/isEnumRef}} + {{/isContainer}} + {{/vars}} + {{/discriminator}} + {{#hasChildren}} + {{#discriminator}} + + String discriminatorValue = jsonElement.getAsJsonObject().get("{{{propertyBaseName}}}").getAsString(); + switch (discriminatorValue) { + {{#mappedModels}} + case "{{mappingName}}": + {{modelName}}.validateJsonElement(jsonElement); + break; + {{/mappedModels}} + default: + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The value of the `{{{propertyBaseName}}}` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + {{/discriminator}} + {{/hasChildren}} + } + +{{^hasChildren}} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!{{classname}}.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes '{{classname}}' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter<{{classname}}> thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get({{classname}}.class)); + + return (TypeAdapter) new TypeAdapter<{{classname}}>() { + @Override + public void write(JsonWriter out, {{classname}} value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + {{#isAdditionalPropertiesTrue}} + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + {{/isAdditionalPropertiesTrue}} + elementAdapter.write(out, obj); + } + + @Override + public {{classname}} read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + {{#isAdditionalPropertiesTrue}} + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + {{classname}} instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + {{/isAdditionalPropertiesTrue}} + {{^isAdditionalPropertiesTrue}} + return thisAdapter.fromJsonTree(jsonElement); + {{/isAdditionalPropertiesTrue}} + } + + }.nullSafe(); + } + } +{{/hasChildren}} +{{/isGson}} + +{{#isGson}} + /** + * Create an instance of {{classname}} given an JSON string + * + * @param jsonString JSON string + * @return An instance of {{classname}} + * @throws IOException if the JSON string is invalid with respect to {{classname}} + */ + public static {{{classname}}} fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, {{{classname}}}.class); + } + + /** + * Convert an instance of {{classname}} to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +{{/isGson}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/pom.mustache new file mode 100644 index 000000000000..66bd1b18e9ea --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/pom.mustache @@ -0,0 +1,466 @@ + + 4.0.0 + {{groupId}} + {{artifactId}} + jar + {{artifactId}} + {{artifactVersion}} + {{artifactUrl}} + {{artifactDescription}} + + {{scmConnection}} + {{scmDeveloperConnection}} + {{scmUrl}} + +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} + + + + {{licenseName}} + {{licenseUrl}} + repo + + + + + + {{developerName}} + {{developerEmail}} + {{developerOrganization}} + {{developerOrganizationUrl}} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + {{#useJackson3}} + 17 + 17 + {{/useJackson3}} + {{^useJackson3}} + 1.8 + 1.8 + {{/useJackson3}} + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + add_sources + generate-sources + + add-source + + + + {{{sourceFolder}}} + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + {{#swagger1AnnotationLibrary}} + + io.swagger + swagger-annotations + ${swagger-annotations-version} + + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + {{/swagger2AnnotationLibrary}} + {{^useJspecify}} + + + com.google.code.findbugs + jsr305 + 3.0.2 + + {{/useJspecify}} + {{#useJspecify}} + + org.jspecify + jspecify + 1.0.0 + + {{/useJspecify}} + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + {{#isGson}} + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + {{/isGson}} + {{#isJackson}} + + {{jacksonPackage}}.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-annotations-version} + + + {{jacksonPackage}}.core + jackson-databind + ${jackson-version} + + {{^useJackson3}} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + {{/useJackson3}} + {{#openApiNullable}} + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + {{/openApiNullable}} + {{/isJackson}} + {{#isJsonb}} + + jakarta.json.bind + jakarta.json.bind-api + ${jsonb-api-version} + + + org.eclipse + yasson + ${yasson-version} + + + jakarta.json + jakarta.json-api + 2.1.3 + + + org.eclipse.parsson + parsson + 1.1.7 + + {{/isJsonb}} + {{#hasOAuthMethods}} + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + {{/hasOAuthMethods}} + {{#useReflectionEqualsHashCode}} + + org.apache.commons + commons-lang3 + ${commons-lang3-version} + + {{/useReflectionEqualsHashCode}} + {{#joda}} + + joda-time + joda-time + ${jodatime-version} + + {{/joda}} + {{#useBeanValidation}} + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + {{/useBeanValidation}} + {{#performBeanValidation}} + + + org.hibernate.validator + hibernate-validator + 8.0.3.Final + + + jakarta.el + jakarta.el-api + ${jakarta.el-version} + + {{/performBeanValidation}} + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + {{#withAWSV4Signature}} + + software.amazon.awssdk + auth + 2.20.157 + + {{/withAWSV4Signature}} + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + {{#java17}}17{{/java17}}{{^java17}}{{#java11}}11{{/java11}}{{^java11}}1.8{{/java11}}{{/java17}} + ${java.version} + ${java.version} + 1.9.0 + {{#swagger1AnnotationLibrary}} + 1.6.6 + {{/swagger1AnnotationLibrary}} + {{#swagger2AnnotationLibrary}} + 2.2.15 + {{/swagger2AnnotationLibrary}} + 5.4.0 + {{#isGson}} + 2.10.1 + {{/isGson}} + {{#isJackson}} + {{#useJackson3}} + 3.2.1 + {{/useJackson3}} + {{^useJackson3}} + 2.17.1 + {{/useJackson3}} + 2.21 + {{/isJackson}} + {{#isJsonb}} + 3.0.1 + 3.0.4 + {{/isJsonb}} + {{#useReflectionEqualsHashCode}} + 3.18.0 + {{/useReflectionEqualsHashCode}} + {{#isJackson}} + {{#openApiNullable}} + 0.2.10 + {{/openApiNullable}} + {{/isJackson}} + {{#joda}} + 2.12.0 + {{/joda}} + {{#useJakartaEe}} + 2.1.1 + {{#useBeanValidation}} + 3.0.2 + {{/useBeanValidation}} + {{/useJakartaEe}} + {{^useJakartaEe}} + 1.3.5 + {{#useBeanValidation}} + 2.0.2 + {{/useBeanValidation}} + {{/useJakartaEe}} + {{#performBeanValidation}} + 3.0.3 + {{/performBeanValidation}} + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index 0e4d9033c831..5e85717a992a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -89,6 +89,7 @@ enum Library { MICROPROFILE("microprofile", Serializer.JSONB, Set.of(Serializer.JACKSON)), NATIVE("native", Serializer.JACKSON), OKHTTP("okhttp-gson", Serializer.GSON), + OKHTTP_GENERIC("okhttp", Serializer.GSON, Set.of(Serializer.JACKSON, Serializer.JSONB)), REST_ASSURED("rest-assured", Serializer.GSON, Set.of(Serializer.JACKSON)), RESTEASY("resteasy", Serializer.JACKSON), REST_CLIENT("restclient", Serializer.JACKSON), @@ -230,6 +231,53 @@ public void testParametersAreCorrectlyOrderedWhenUsingRetrofit() { Assertions.assertEquals(Arrays.asList(pathParam1, pathParam2, queryParamRequired, queryParamOptional), codegenOperation.allParams); } + @Test + public void testOkHttp() { + final JavaClientCodegen codegen = new JavaClientCodegen(); + codegen.setLibrary(JavaClientCodegen.OKHTTP); + codegen.processOpts(); + + assertEquals(JavaClientCodegen.OKHTTP, codegen.getLibrary()); + assertTrue((Boolean) codegen.additionalProperties().get("isGson")); + } + + @Test + public void testOkHttpWithJackson() { + final JavaClientCodegen codegen = new JavaClientCodegen(); + codegen.setLibrary(JavaClientCodegen.OKHTTP); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, JavaClientCodegen.SERIALIZATION_LIBRARY_JACKSON); + codegen.processOpts(); + + assertEquals(JavaClientCodegen.OKHTTP, codegen.getLibrary()); + assertTrue((Boolean) codegen.additionalProperties().get("isJackson")); + assertEquals(JavaClientCodegen.SERIALIZATION_LIBRARY_JACKSON, codegen.additionalProperties().get(CodegenConstants.SERIALIZATION_LIBRARY)); + } + + @Test + public void testOkHttpWithJackson3() { + final JavaClientCodegen codegen = new JavaClientCodegen(); + codegen.setLibrary(JavaClientCodegen.OKHTTP); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, JavaClientCodegen.SERIALIZATION_LIBRARY_JACKSON); + codegen.additionalProperties().put(JavaClientCodegen.USE_JACKSON_3, true); + codegen.processOpts(); + + assertEquals(JavaClientCodegen.OKHTTP, codegen.getLibrary()); + assertTrue((Boolean) codegen.additionalProperties().get("isJackson")); + assertTrue((Boolean) codegen.additionalProperties().get(JavaClientCodegen.USE_JACKSON_3)); + } + + @Test + public void testOkHttpWithJsonb() { + final JavaClientCodegen codegen = new JavaClientCodegen(); + codegen.setLibrary(JavaClientCodegen.OKHTTP); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, JavaClientCodegen.SERIALIZATION_LIBRARY_JSONB); + codegen.processOpts(); + + assertEquals(codegen.getLibrary(), JavaClientCodegen.OKHTTP); + assertTrue((Boolean) codegen.additionalProperties().get("isJsonb")); + assertEquals(codegen.additionalProperties().get(CodegenConstants.SERIALIZATION_LIBRARY), JavaClientCodegen.SERIALIZATION_LIBRARY_JSONB); + } + @Test public void testInitialConfigValues() throws Exception { final JavaClientCodegen codegen = new JavaClientCodegen(); @@ -4625,7 +4673,8 @@ public Object[][] jspecifyLibraries() { {"webclient", true, false}, {"resttemplate", false, true}, {"resttemplate", true, true}, - {"native", false, true} + {"native", false, true}, + {"okhttp", false, true} }; } @@ -4685,6 +4734,31 @@ public void testJspecify(String library, boolean useSpringBoot4, boolean hasJspe } + @Test + public void testJspecifyOkHttpSingleRequestParameter() throws IOException { + final Map files = generateFromContract("src/test/resources/3_0/java/jspecify.yaml", "okhttp", + Map.of(USE_JSPECIFY, true, + "containerDefaultToNull", true, + CodegenConstants.USE_SINGLE_REQUEST_PARAMETER, "true" + ), + codegenConfigurator -> + codegenConfigurator + .setValidateSpec(false) + .addTypeMapping("OffsetDateTime", "java.time.Instant") + .addTypeMapping("BigDecimal", "java.math.BigDecimal")); + + JavaFileAssert.assertThat(files.get("DefaultApi.java")) + .fileContains( + "import org.jspecify.annotations.Nullable;", + "public class APIfooDtParamGetRequest {", + "private java.time.@Nullable Instant dtParam;", + "private java.time.@Nullable Instant dtQuery;", + "private java.time.@Nullable Instant dtCookie;", + "public APIfooDtParamGetRequest dtParam(java.time.@Nullable Instant dtParam) {", + "private APIfooDtParamGetRequest() {" + ); + } + @DataProvider(name = "replaceOneOf") public Object[][] replaceOneOf() { return new Object[][]{ @@ -4798,6 +4872,107 @@ public void processOptsConvertsConfiguredSupportUrlQuery() { .containsEntry(SUPPORT_URL_QUERY, false); } + @Test + public void testOkHttpDependencyVersions() throws IOException { + final Path output = newTempFolder(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(JAVA_GENERATOR) + .setLibrary(JavaClientCodegen.OKHTTP) + .setInputSpec("src/test/resources/3_0/ping.yaml") + .setOutputDir(output.toString().replace("\\", "/")); + + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + assertThat(output.resolve("pom.xml")).content() + .contains("5.4.0") + .contains("2.10.1"); + + assertThat(output.resolve("build.gradle")).content() + .contains("okhttp_version = \"5.4.0\"") + .contains("implementation 'com.google.code.gson:gson:2.10.1'"); + } + + @Test + public void testOkHttpComposedSchemaAdditionalProperties() throws IOException { + final Path output = newTempFolder(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(JAVA_GENERATOR) + .setLibrary(JavaClientCodegen.OKHTTP) + .setInputSpec("src/test/resources/3_0/composed-schemas.yaml") + .setOutputDir(output.toString().replace("\\", "/")); + + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + // Dog is a composed schema (allOf). Since we enabled supportsAdditionalPropertiesWithComposedSchema, + // it should have the additionalProperties field. + assertThat(output.resolve("src/main/java/org/openapitools/client/model/Dog.java")).content() + .contains("private Map additionalProperties;"); + } + + @Test + public void testOkHttpWithJackson2DependencyVersions() throws IOException { + final Path output = newTempFolder(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(JAVA_GENERATOR) + .setLibrary(JavaClientCodegen.OKHTTP) + .addAdditionalProperty(CodegenConstants.SERIALIZATION_LIBRARY, JavaClientCodegen.SERIALIZATION_LIBRARY_JACKSON) + .setInputSpec("src/test/resources/3_0/ping.yaml") + .setOutputDir(output.toString().replace("\\", "/")); + + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + assertThat(output.resolve("pom.xml")).content() + .contains("5.4.0") + .contains("2.17.1"); + + assertThat(output.resolve("build.gradle")).content() + .contains("okhttp_version = \"5.4.0\"") + .contains("jackson_version = \"2.17.1\""); + } + + @Test + public void testOkHttpWithJackson3DependencyVersions() throws IOException { + final Path output = newTempFolder(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(JAVA_GENERATOR) + .setLibrary(JavaClientCodegen.OKHTTP) + .addAdditionalProperty(CodegenConstants.SERIALIZATION_LIBRARY, JavaClientCodegen.SERIALIZATION_LIBRARY_JACKSON) + .addAdditionalProperty(JavaClientCodegen.USE_JACKSON_3, true) + .setInputSpec("src/test/resources/3_0/ping.yaml") + .setOutputDir(output.toString().replace("\\", "/")); + + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + assertThat(output.resolve("pom.xml")).content() + .contains("5.4.0") + .contains("3.2.1"); + + assertThat(output.resolve("build.gradle")).content() + .contains("okhttp_version = \"5.4.0\"") + .contains("jackson_version = \"3.2.1\""); + } + + @Test + public void testOkHttpWithJsonbDependencyVersions() throws IOException { + final Path output = newTempFolder(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(JAVA_GENERATOR) + .setLibrary(JavaClientCodegen.OKHTTP) + .addAdditionalProperty(CodegenConstants.SERIALIZATION_LIBRARY, JavaClientCodegen.SERIALIZATION_LIBRARY_JSONB) + .setInputSpec("src/test/resources/3_0/ping.yaml") + .setOutputDir(output.toString().replace("\\", "/")); + + new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + assertThat(output.resolve("pom.xml")).content() + .contains("5.4.0") + .contains("3.0.1"); + + assertThat(output.resolve("build.gradle")).content() + .contains("okhttp_version = \"5.4.0\"") + .contains("implementation 'jakarta.json.bind:jakarta.json.bind-api:3.0.1'"); + } + private static JavaClientCodegen newRetrofit2Codegen(Map properties) { JavaClientCodegen codegen = new JavaClientCodegen(); codegen.setLibrary(JavaClientCodegen.RETROFIT_2); From de650fb552f8abc1128d2116543b9848a2040a53 Mon Sep 17 00:00:00 2001 From: rar91279 Date: Mon, 20 Jul 2026 02:31:47 +0200 Subject: [PATCH 2/5] Prepare for pull request: add configs for the new generic okhttp generator Execute ./mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/*.yaml || exit ./bin/utils/export_docs_generators.sh || exit --- ...ava-okhttp-3.1-duplicated-operationid.yaml | 12 + bin/configs/java-okhttp-3.1.yaml | 20 + bin/configs/java-okhttp-awsv4signature.yaml | 11 + .../java-okhttp-dynamicOperations.yaml | 9 + bin/configs/java-okhttp-echo-api.yaml | 8 + bin/configs/java-okhttp-group-parameter.yaml | 10 + ...va-okhttp-gson-user-defined-templates.yaml | 17 + bin/configs/java-okhttp-jackson.yaml | 26 + bin/configs/java-okhttp-jackson3.yaml | 27 + bin/configs/java-okhttp-jsonb.yaml | 27 + bin/configs/java-okhttp-jspecify.yaml | 13 + .../java-okhttp-nullable-required.yaml | 10 + bin/configs/java-okhttp-oneOf-array.yaml | 8 + bin/configs/java-okhttp-oneOf.yaml | 7 + bin/configs/java-okhttp-parcelableModel.yaml | 9 + bin/configs/java-okhttp-streaming.yaml | 11 + bin/configs/java-okhttp-swagger1.yaml | 13 + bin/configs/java-okhttp-swagger2.yaml | 11 + bin/configs/java-okhttp.yaml | 25 + docs/generators/java-microprofile.md | 20 +- docs/generators/java.md | 6 +- .../codegen/languages/JavaClientCodegen.java | 4 +- .../resources/3_0/java/okhttp-jspecify.yaml | 88 + .../openapitools/client/model/Category.java | 103 +- .../client/model/ModelApiResponse.java | 103 +- .../org/openapitools/client/model/Order.java | 103 +- .../org/openapitools/client/model/Pet.java | 103 +- .../org/openapitools/client/model/Tag.java | 103 +- .../org/openapitools/client/model/User.java | 103 +- .../org/openapitools/client/model/Bird.java | 103 +- .../openapitools/client/model/Category.java | 103 +- .../openapitools/client/model/DataQuery.java | 103 +- .../client/model/DefaultValue.java | 103 +- .../client/model/NumberPropertiesOnly.java | 103 +- .../org/openapitools/client/model/Pet.java | 103 +- .../org/openapitools/client/model/Query.java | 50 +- .../org/openapitools/client/model/Tag.java | 103 +- .../TestFormObjectMultipartRequestMarker.java | 103 +- ...deTrueObjectAllOfQueryObjectParameter.java | 103 +- ...deTrueArrayStringQueryObjectParameter.java | 103 +- .../java/okhttp/.github/workflows/maven.yml | 30 + .../client/echo_api/java/okhttp/.gitignore | 21 + .../java/okhttp/.openapi-generator-ignore | 23 + .../java/okhttp/.openapi-generator/FILES | 81 + .../java/okhttp/.openapi-generator/VERSION | 1 + .../client/echo_api/java/okhttp/.travis.yml | 22 + samples/client/echo_api/java/okhttp/README.md | 191 + .../echo_api/java/okhttp/api/openapi.yaml | 1037 +++++ .../client/echo_api/java/okhttp/build.gradle | 63 + samples/client/echo_api/java/okhttp/build.sbt | 1 + .../echo_api/java/okhttp/docs/AuthApi.md | 137 + .../client/echo_api/java/okhttp/docs/Bird.md | 14 + .../echo_api/java/okhttp/docs/BodyApi.md | 634 +++ .../echo_api/java/okhttp/docs/Category.md | 14 + .../echo_api/java/okhttp/docs/DataQuery.md | 15 + .../echo_api/java/okhttp/docs/DefaultValue.md | 31 + .../echo_api/java/okhttp/docs/FormApi.md | 211 + .../echo_api/java/okhttp/docs/HeaderApi.md | 79 + .../java/okhttp/docs/NumberPropertiesOnly.md | 15 + .../echo_api/java/okhttp/docs/PathApi.md | 77 + .../client/echo_api/java/okhttp/docs/Pet.md | 28 + .../client/echo_api/java/okhttp/docs/Query.md | 24 + .../echo_api/java/okhttp/docs/QueryApi.md | 713 ++++ .../java/okhttp/docs/StringEnumRef.md | 15 + .../client/echo_api/java/okhttp/docs/Tag.md | 14 + .../TestFormObjectMultipartRequestMarker.md | 13 + ...lodeTrueObjectAllOfQueryObjectParameter.md | 16 + ...lodeTrueArrayStringQueryObjectParameter.md | 13 + .../client/echo_api/java/okhttp/git_push.sh | 57 + .../echo_api/java/okhttp/gradle.properties | 6 + .../okhttp/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + samples/client/echo_api/java/okhttp/gradlew | 249 ++ .../client/echo_api/java/okhttp/gradlew.bat | 92 + samples/client/echo_api/java/okhttp/pom.xml | 279 ++ .../echo_api/java/okhttp/settings.gradle | 1 + .../java/okhttp/src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1657 ++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 449 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../org/openapitools/client/api/AuthApi.java | 313 ++ .../org/openapitools/client/api/BodyApi.java | 1327 +++++++ .../org/openapitools/client/api/FormApi.java | 521 +++ .../openapitools/client/api/HeaderApi.java | 240 ++ .../org/openapitools/client/api/PathApi.java | 235 ++ .../org/openapitools/client/api/QueryApi.java | 1527 ++++++++ .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../client/model/AbstractOpenApiSchema.java | 142 + .../org/openapitools/client/model/Bird.java | 314 ++ .../openapitools/client/model/Category.java | 311 ++ .../openapitools/client/model/DataQuery.java | 348 ++ .../client/model/DefaultValue.java | 627 +++ .../client/model/NumberPropertiesOnly.java | 338 ++ .../org/openapitools/client/model/Pet.java | 532 +++ .../org/openapitools/client/model/Query.java | 306 ++ .../client/model/StringEnumRef.java | 80 + .../org/openapitools/client/model/Tag.java | 311 ++ .../TestFormObjectMultipartRequestMarker.java | 284 ++ ...deTrueObjectAllOfQueryObjectParameter.java | 371 ++ ...deTrueArrayStringQueryObjectParameter.java | 296 ++ .../openapitools/client/api/AuthApiTest.java | 59 + .../openapitools/client/api/BodyApiTest.java | 176 + .../openapitools/client/api/FormApiTest.java | 83 + .../client/api/HeaderApiTest.java | 52 + .../openapitools/client/api/PathApiTest.java | 51 + .../openapitools/client/api/QueryApiTest.java | 200 + .../openapitools/client/model/BirdTest.java | 55 + .../client/model/CategoryTest.java | 55 + .../client/model/DataQueryTest.java | 84 + .../client/model/DefaultValueTest.java | 108 + .../model/NumberPropertiesOnlyTest.java | 64 + .../openapitools/client/model/PetTest.java | 92 + .../openapitools/client/model/QueryTest.java | 58 + .../client/model/StringEnumRefTest.java | 32 + .../openapitools/client/model/TagTest.java | 55 + ...tFormObjectMultipartRequestMarkerTest.java | 47 + ...ueObjectAllOfQueryObjectParameterTest.java | 71 + ...ueArrayStringQueryObjectParameterTest.java | 50 + .../org/openapitools/client/model/OneOf1.java | 103 +- .../openapitools/client/model/SomeObj.java | 103 +- .../.github/workflows/maven.yml | 30 + .../others/java/okhttp-oneOf-array/.gitignore | 21 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 43 + .../.openapi-generator/VERSION | 1 + .../java/okhttp-oneOf-array/.travis.yml | 22 + .../others/java/okhttp-oneOf-array/README.md | 138 + .../java/okhttp-oneOf-array/api/openapi.yaml | 34 + .../java/okhttp-oneOf-array/build.gradle | 65 + .../others/java/okhttp-oneOf-array/build.sbt | 1 + .../okhttp-oneOf-array/docs/DefaultApi.md | 65 + .../docs/MyExampleGet200Response.md | 13 + .../java/okhttp-oneOf-array/docs/OneOf1.md | 13 + .../java/okhttp-oneOf-array/git_push.sh | 57 + .../java/okhttp-oneOf-array/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../others/java/okhttp-oneOf-array/gradlew | 249 ++ .../java/okhttp-oneOf-array/gradlew.bat | 92 + .../others/java/okhttp-oneOf-array/pom.xml | 287 ++ .../java/okhttp-oneOf-array/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1631 ++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 441 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../openapitools/client/api/DefaultApi.java | 197 + .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../client/model/AbstractOpenApiSchema.java | 142 + .../client/model/MyExampleGet200Response.java | 273 ++ .../org/openapitools/client/model/OneOf1.java | 287 ++ .../client/api/DefaultApiTest.java | 46 + .../model/MyExampleGet200ResponseTest.java | 49 + .../openapitools/client/model/OneOf1Test.java | 47 + .../okhttp-oneOf/.github/workflows/maven.yml | 30 + .../others/java/okhttp-oneOf/.gitignore | 21 + .../okhttp-oneOf/.openapi-generator-ignore | 23 + .../okhttp-oneOf/.openapi-generator/FILES | 40 + .../okhttp-oneOf/.openapi-generator/VERSION | 1 + .../others/java/okhttp-oneOf/.travis.yml | 22 + .../client/others/java/okhttp-oneOf/README.md | 137 + .../others/java/okhttp-oneOf/api/openapi.yaml | 30 + .../others/java/okhttp-oneOf/build.gradle | 63 + .../client/others/java/okhttp-oneOf/build.sbt | 1 + .../java/okhttp-oneOf/docs/DefaultApi.md | 68 + .../okhttp-oneOf/docs/MyExamplePostRequest.md | 12 + .../others/java/okhttp-oneOf/git_push.sh | 57 + .../java/okhttp-oneOf/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../client/others/java/okhttp-oneOf/gradlew | 249 ++ .../others/java/okhttp-oneOf/gradlew.bat | 92 + .../client/others/java/okhttp-oneOf/pom.xml | 279 ++ .../others/java/okhttp-oneOf/settings.gradle | 1 + .../okhttp-oneOf/src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1631 ++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 440 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../openapitools/client/api/DefaultApi.java | 193 + .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../client/model/AbstractOpenApiSchema.java | 142 + .../client/model/MyExamplePostRequest.java | 212 + .../client/api/DefaultApiTest.java | 44 + .../model/MyExamplePostRequestTest.java | 33 + .../.github/workflows/maven.yml | 30 + .../others/java/okhttp-streaming/.gitignore | 21 + .../.openapi-generator-ignore | 23 + .../okhttp-streaming/.openapi-generator/FILES | 43 + .../.openapi-generator/VERSION | 1 + .../others/java/okhttp-streaming/.travis.yml | 22 + .../others/java/okhttp-streaming/README.md | 145 + .../java/okhttp-streaming/api/openapi.yaml | 98 + .../others/java/okhttp-streaming/build.gradle | 63 + .../others/java/okhttp-streaming/build.sbt | 1 + .../java/okhttp-streaming/docs/PingApi.md | 137 + .../java/okhttp-streaming/docs/SimpleOneOf.md | 16 + .../java/okhttp-streaming/docs/SomeObj.md | 29 + .../others/java/okhttp-streaming/git_push.sh | 57 + .../java/okhttp-streaming/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../others/java/okhttp-streaming/gradlew | 249 ++ .../others/java/okhttp-streaming/gradlew.bat | 92 + .../others/java/okhttp-streaming/pom.xml | 279 ++ .../java/okhttp-streaming/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1654 ++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 441 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../org/openapitools/client/api/PingApi.java | 396 ++ .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../client/model/AbstractOpenApiSchema.java | 142 + .../client/model/SimpleOneOf.java | 270 ++ .../openapitools/client/model/SomeObj.java | 455 +++ .../openapitools/client/api/PingApiTest.java | 60 + .../client/model/SimpleOneOfTest.java | 33 + .../client/model/SomeObjTest.java | 79 + .../.github/workflows/maven.yml | 30 + .../.gitignore | 21 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 42 + .../.openapi-generator/VERSION | 1 + .../.travis.yml | 22 + .../README.md | 154 + .../api/openapi.yaml | 92 + .../build.gradle | 64 + .../build.sbt | 1 + .../docs/FakeApi.md | 65 + .../docs/PetApi.md | 80 + .../git_push.sh | 57 + .../gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../okhttp-3.1-duplicated-operationid/gradlew | 249 ++ .../gradlew.bat | 92 + .../okhttp-3.1-duplicated-operationid/pom.xml | 284 ++ .../settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1727 ++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 439 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../org/openapitools/client/api/FakeApi.java | 194 + .../org/openapitools/client/api/PetApi.java | 213 + .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../org/openapitools/client/auth/OAuth.java | 43 + .../openapitools/client/auth/OAuthFlow.java | 25 + .../client/auth/OAuthOkHttpClient.java | 82 + .../client/auth/RetryingOAuth.java | 223 ++ .../client/model/AbstractOpenApiSchema.java | 142 + .../openapitools/client/api/FakeApiTest.java | 42 + .../openapitools/client/api/PetApiTest.java | 47 + .../okhttp-3.1/.github/workflows/maven.yml | 30 + .../petstore/java/okhttp-3.1/.gitignore | 21 + .../java/okhttp-3.1/.openapi-generator-ignore | 23 + .../java/okhttp-3.1/.openapi-generator/FILES | 127 + .../okhttp-3.1/.openapi-generator/VERSION | 1 + .../petstore/java/okhttp-3.1/.travis.yml | 22 + .../client/petstore/java/okhttp-3.1/README.md | 211 + .../petstore/java/okhttp-3.1/api/openapi.yaml | 1269 ++++++ .../petstore/java/okhttp-3.1/build.gradle | 64 + .../client/petstore/java/okhttp-3.1/build.sbt | 1 + .../java/okhttp-3.1/docs/AllOfSimpleModel.md | 13 + .../petstore/java/okhttp-3.1/docs/Animal.md | 14 + .../java/okhttp-3.1/docs/AnyTypeTest.md | 15 + .../java/okhttp-3.1/docs/ArrayOfSameRef.md | 15 + .../petstore/java/okhttp-3.1/docs/Cat.md | 13 + .../petstore/java/okhttp-3.1/docs/Category.md | 15 + .../okhttp-3.1/docs/CircularReference1.md | 13 + .../okhttp-3.1/docs/CircularReference2.md | 13 + .../okhttp-3.1/docs/CircularReference3.md | 13 + .../java/okhttp-3.1/docs/CodesEnum.md | 15 + .../java/okhttp-3.1/docs/DefaultApi.md | 69 + .../petstore/java/okhttp-3.1/docs/Dog.md | 13 + .../petstore/java/okhttp-3.1/docs/FakeApi.md | 711 ++++ .../FakeWebhooksSourcesDeletedPostRequest.md | 16 + ...eWebhooksSourcesDeletedPostRequestEvent.md | 13 + .../java/okhttp-3.1/docs/ModelApiResponse.md | 16 + .../java/okhttp-3.1/docs/OneOfStringOrInt.md | 13 + .../petstore/java/okhttp-3.1/docs/Order.md | 29 + .../petstore/java/okhttp-3.1/docs/Pet.md | 29 + .../petstore/java/okhttp-3.1/docs/PetApi.md | 570 +++ .../docs/PetWithTypesObjectNullAndRef.md | 13 + ...hLevelParameterOneofRefToOneofParameter.md | 12 + ...fToRefParameterAnyofRefToAnyofParameter.md | 12 + .../docs/SelfReferenceAdditionalProperties.md | 13 + .../okhttp-3.1/docs/SelfReferenceAnyOf.md | 12 + .../okhttp-3.1/docs/SelfReferenceOneOf.md | 12 + .../docs/SimpleModelWithArrayProperty.md | 13 + .../petstore/java/okhttp-3.1/docs/StoreApi.md | 266 ++ .../java/okhttp-3.1/docs/StringOrInt.md | 13 + .../petstore/java/okhttp-3.1/docs/Tag.md | 15 + .../petstore/java/okhttp-3.1/docs/User.md | 21 + .../petstore/java/okhttp-3.1/docs/UserApi.md | 553 +++ .../petstore/java/okhttp-3.1/git_push.sh | 57 + .../java/okhttp-3.1/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../client/petstore/java/okhttp-3.1/gradlew | 249 ++ .../petstore/java/okhttp-3.1/gradlew.bat | 92 + .../client/petstore/java/okhttp-3.1/pom.xml | 284 ++ .../petstore/java/okhttp-3.1/settings.gradle | 1 + .../okhttp-3.1/src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1727 ++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 493 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../openapitools/client/api/DefaultApi.java | 197 + .../org/openapitools/client/api/FakeApi.java | 1549 ++++++++ .../org/openapitools/client/api/PetApi.java | 1201 ++++++ .../org/openapitools/client/api/StoreApi.java | 593 +++ .../org/openapitools/client/api/UserApi.java | 1105 ++++++ .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../org/openapitools/client/auth/OAuth.java | 43 + .../openapitools/client/auth/OAuthFlow.java | 25 + .../client/auth/OAuthOkHttpClient.java | 82 + .../client/auth/RetryingOAuth.java | 223 ++ .../client/model/AbstractOpenApiSchema.java | 142 + .../client/model/AllOfSimpleModel.java | 305 ++ .../org/openapitools/client/model/Animal.java | 249 ++ .../client/model/AnyTypeTest.java | 374 ++ .../client/model/ArrayOfSameRef.java | 405 ++ .../org/openapitools/client/model/Cat.java | 291 ++ .../openapitools/client/model/Category.java | 311 ++ .../client/model/CircularReference1.java | 286 ++ .../client/model/CircularReference2.java | 286 ++ .../client/model/CircularReference3.java | 286 ++ .../openapitools/client/model/CodesEnum.java | 80 + .../org/openapitools/client/model/Dog.java | 291 ++ ...FakeWebhooksSourcesDeletedPostRequest.java | 349 ++ ...ebhooksSourcesDeletedPostRequestEvent.java | 291 ++ .../client/model/ModelApiResponse.java | 341 ++ .../client/model/OneOfStringOrInt.java | 269 ++ .../org/openapitools/client/model/Order.java | 478 +++ .../org/openapitools/client/model/Pet.java | 537 +++ .../model/PetWithTypesObjectNullAndRef.java | 286 ++ ...evelParameterOneofRefToOneofParameter.java | 269 ++ ...oRefParameterAnyofRefToAnyofParameter.java | 271 ++ .../SelfReferenceAdditionalProperties.java | 284 ++ .../client/model/SelfReferenceAnyOf.java | 260 ++ .../client/model/SelfReferenceOneOf.java | 269 ++ .../model/SimpleModelWithArrayProperty.java | 305 ++ .../client/model/StringOrInt.java | 260 ++ .../org/openapitools/client/model/Tag.java | 311 ++ .../org/openapitools/client/model/User.java | 488 +++ .../client/api/DefaultApiTest.java | 44 + .../openapitools/client/api/FakeApiTest.java | 159 + .../openapitools/client/api/PetApiTest.java | 153 + .../openapitools/client/api/StoreApiTest.java | 89 + .../openapitools/client/api/UserApiTest.java | 148 + .../client/model/AllOfSimpleModelTest.java | 50 + .../openapitools/client/model/AnimalTest.java | 55 + .../client/model/AnyTypeTestTest.java | 67 + .../client/model/ArrayOfSameRefTest.java | 67 + .../openapitools/client/model/CatTest.java | 64 + .../client/model/CategoryTest.java | 55 + .../client/model/CircularReference1Test.java | 48 + .../client/model/CircularReference2Test.java | 48 + .../client/model/CircularReference3Test.java | 48 + .../client/model/CodesEnumTest.java | 32 + .../openapitools/client/model/DogTest.java | 64 + ...oksSourcesDeletedPostRequestEventTest.java | 47 + ...WebhooksSourcesDeletedPostRequestTest.java | 65 + .../client/model/ModelApiResponseTest.java | 63 + .../client/model/OneOfStringOrIntTest.java | 33 + .../openapitools/client/model/OrderTest.java | 88 + .../openapitools/client/model/PetTest.java | 92 + .../PetWithTypesObjectNullAndRefTest.java | 48 + ...ParameterOneofRefToOneofParameterTest.java | 33 + ...ParameterAnyofRefToAnyofParameterTest.java | 34 + ...SelfReferenceAdditionalPropertiesTest.java | 47 + .../client/model/SelfReferenceAnyOfTest.java | 33 + .../client/model/SelfReferenceOneOfTest.java | 33 + .../SimpleModelWithArrayPropertyTest.java | 50 + .../client/model/StringOrIntTest.java | 33 + .../openapitools/client/model/TagTest.java | 55 + .../openapitools/client/model/UserTest.java | 103 + .../.github/workflows/maven.yml | 30 + .../java/okhttp-awsv4signature/.gitignore | 21 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 60 + .../.openapi-generator/VERSION | 1 + .../java/okhttp-awsv4signature/.travis.yml | 22 + .../java/okhttp-awsv4signature/README.md | 186 + .../okhttp-awsv4signature/api/openapi.yaml | 870 +++++ .../java/okhttp-awsv4signature/build.gradle | 65 + .../java/okhttp-awsv4signature/build.sbt | 1 + .../okhttp-awsv4signature/docs/Category.md | 15 + .../docs/ModelApiResponse.md | 16 + .../java/okhttp-awsv4signature/docs/Order.md | 29 + .../java/okhttp-awsv4signature/docs/Pet.md | 29 + .../java/okhttp-awsv4signature/docs/PetApi.md | 586 +++ .../okhttp-awsv4signature/docs/StoreApi.md | 274 ++ .../java/okhttp-awsv4signature/docs/Tag.md | 15 + .../java/okhttp-awsv4signature/docs/User.md | 21 + .../okhttp-awsv4signature/docs/UserApi.md | 569 +++ .../java/okhttp-awsv4signature/git_push.sh | 57 + .../okhttp-awsv4signature/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../java/okhttp-awsv4signature/gradlew | 249 ++ .../java/okhttp-awsv4signature/gradlew.bat | 92 + .../java/okhttp-awsv4signature/pom.xml | 289 ++ .../okhttp-awsv4signature/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1747 +++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 445 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../org/openapitools/client/api/PetApi.java | 1201 ++++++ .../org/openapitools/client/api/StoreApi.java | 593 +++ .../org/openapitools/client/api/UserApi.java | 1105 ++++++ .../openapitools/client/auth/AWS4Auth.java | 115 + .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../org/openapitools/client/auth/OAuth.java | 43 + .../openapitools/client/auth/OAuthFlow.java | 25 + .../client/auth/OAuthOkHttpClient.java | 82 + .../client/auth/RetryingOAuth.java | 223 ++ .../client/model/AbstractOpenApiSchema.java | 142 + .../openapitools/client/model/Category.java | 311 ++ .../client/model/ModelApiResponse.java | 341 ++ .../org/openapitools/client/model/Order.java | 478 +++ .../org/openapitools/client/model/Pet.java | 537 +++ .../org/openapitools/client/model/Tag.java | 311 ++ .../org/openapitools/client/model/User.java | 488 +++ .../openapitools/client/api/PetApiTest.java | 153 + .../openapitools/client/api/StoreApiTest.java | 89 + .../openapitools/client/api/UserApiTest.java | 148 + .../client/model/CategoryTest.java | 55 + .../client/model/ModelApiResponseTest.java | 63 + .../openapitools/client/model/OrderTest.java | 88 + .../openapitools/client/model/PetTest.java | 92 + .../openapitools/client/model/TagTest.java | 55 + .../openapitools/client/model/UserTest.java | 103 + .../.github/workflows/maven.yml | 30 + .../java/okhttp-dynamicOperations/.gitignore | 21 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 186 + .../.openapi-generator/VERSION | 1 + .../java/okhttp-dynamicOperations/.travis.yml | 22 + .../java/okhttp-dynamicOperations/README.md | 248 ++ .../okhttp-dynamicOperations/build.gradle | 65 + .../java/okhttp-dynamicOperations/build.sbt | 1 + .../docs/AdditionalPropertiesAnyType.md | 13 + .../docs/AdditionalPropertiesArray.md | 13 + .../docs/AdditionalPropertiesBoolean.md | 13 + .../docs/AdditionalPropertiesClass.md | 23 + .../docs/AdditionalPropertiesInteger.md | 13 + .../docs/AdditionalPropertiesNumber.md | 13 + .../docs/AdditionalPropertiesObject.md | 13 + .../docs/AdditionalPropertiesString.md | 13 + .../okhttp-dynamicOperations/docs/Animal.md | 14 + .../docs/AnotherFakeApi.md | 73 + .../docs/ArrayOfArrayOfNumberOnly.md | 13 + .../docs/ArrayOfNumberOnly.md | 13 + .../docs/ArrayTest.md | 15 + .../okhttp-dynamicOperations/docs/BigCat.md | 24 + .../docs/Capitalization.md | 18 + .../java/okhttp-dynamicOperations/docs/Cat.md | 13 + .../okhttp-dynamicOperations/docs/Category.md | 14 + .../docs/ClassModel.md | 14 + .../okhttp-dynamicOperations/docs/Client.md | 13 + .../java/okhttp-dynamicOperations/docs/Dog.md | 13 + .../docs/EnumArrays.md | 32 + .../docs/EnumClass.md | 15 + .../okhttp-dynamicOperations/docs/EnumTest.md | 55 + .../okhttp-dynamicOperations/docs/FakeApi.md | 949 +++++ .../docs/FakeClassnameTags123Api.md | 78 + .../docs/FileSchemaTestClass.md | 14 + .../docs/FormatTest.md | 26 + .../docs/HasOnlyReadOnly.md | 14 + .../okhttp-dynamicOperations/docs/MapTest.md | 25 + ...dPropertiesAndAdditionalPropertiesClass.md | 15 + .../docs/Model200Response.md | 15 + .../docs/ModelApiResponse.md | 15 + .../docs/ModelFile.md | 14 + .../docs/ModelList.md | 13 + .../docs/ModelReturn.md | 14 + .../okhttp-dynamicOperations/docs/Name.md | 17 + .../docs/NumberOnly.md | 13 + .../okhttp-dynamicOperations/docs/Order.md | 28 + .../docs/OuterComposite.md | 15 + .../docs/OuterEnum.md | 15 + .../java/okhttp-dynamicOperations/docs/Pet.md | 28 + .../okhttp-dynamicOperations/docs/PetApi.md | 629 +++ .../docs/ReadOnlyFirst.md | 14 + .../docs/SpecialModelName.md | 13 + .../okhttp-dynamicOperations/docs/StoreApi.md | 264 ++ .../java/okhttp-dynamicOperations/docs/Tag.md | 14 + .../docs/TypeHolderDefault.md | 17 + .../docs/TypeHolderExample.md | 18 + .../okhttp-dynamicOperations/docs/User.md | 20 + .../okhttp-dynamicOperations/docs/UserApi.md | 501 +++ .../okhttp-dynamicOperations/docs/XmlItem.md | 41 + .../java/okhttp-dynamicOperations/git_push.sh | 57 + .../gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../java/okhttp-dynamicOperations/gradlew | 249 ++ .../java/okhttp-dynamicOperations/gradlew.bat | 92 + .../java/okhttp-dynamicOperations/pom.xml | 284 ++ .../okhttp-dynamicOperations/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1801 +++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiOperation.java | 39 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 520 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../client/api/AnotherFakeApi.java | 227 ++ .../org/openapitools/client/api/FakeApi.java | 2248 +++++++++++ .../client/api/FakeClassnameTags123Api.java | 216 + .../org/openapitools/client/api/PetApi.java | 1398 +++++++ .../org/openapitools/client/api/StoreApi.java | 627 +++ .../org/openapitools/client/api/UserApi.java | 1162 ++++++ .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../org/openapitools/client/auth/OAuth.java | 43 + .../openapitools/client/auth/OAuthFlow.java | 25 + .../client/auth/OAuthOkHttpClient.java | 82 + .../client/auth/RetryingOAuth.java | 223 ++ .../client/model/AbstractOpenApiSchema.java | 142 + .../model/AdditionalPropertiesAnyType.java | 284 ++ .../model/AdditionalPropertiesArray.java | 285 ++ .../model/AdditionalPropertiesBoolean.java | 284 ++ .../model/AdditionalPropertiesClass.java | 619 +++ .../model/AdditionalPropertiesInteger.java | 284 ++ .../model/AdditionalPropertiesNumber.java | 285 ++ .../model/AdditionalPropertiesObject.java | 285 ++ .../model/AdditionalPropertiesString.java | 284 ++ .../org/openapitools/client/model/Animal.java | 252 ++ .../model/ArrayOfArrayOfNumberOnly.java | 297 ++ .../client/model/ArrayOfNumberOnly.java | 297 ++ .../openapitools/client/model/ArrayTest.java | 375 ++ .../org/openapitools/client/model/BigCat.java | 347 ++ .../client/model/Capitalization.java | 434 +++ .../org/openapitools/client/model/Cat.java | 222 ++ .../openapitools/client/model/Category.java | 318 ++ .../openapitools/client/model/ClassModel.java | 284 ++ .../org/openapitools/client/model/Client.java | 284 ++ .../org/openapitools/client/model/Dog.java | 291 ++ .../openapitools/client/model/EnumArrays.java | 434 +++ .../openapitools/client/model/EnumClass.java | 80 + .../openapitools/client/model/EnumTest.java | 633 +++ .../client/model/FileSchemaTestClass.java | 338 ++ .../openapitools/client/model/FormatTest.java | 663 ++++ .../client/model/HasOnlyReadOnly.java | 307 ++ .../openapitools/client/model/MapTest.java | 448 +++ ...ropertiesAndAdditionalPropertiesClass.java | 351 ++ .../client/model/Model200Response.java | 311 ++ .../client/model/ModelApiResponse.java | 341 ++ .../openapitools/client/model/ModelFile.java | 284 ++ .../openapitools/client/model/ModelList.java | 284 ++ .../client/model/ModelReturn.java | 281 ++ .../org/openapitools/client/model/Name.java | 365 ++ .../openapitools/client/model/NumberOnly.java | 282 ++ .../org/openapitools/client/model/Order.java | 478 +++ .../client/model/OuterComposite.java | 339 ++ .../openapitools/client/model/OuterEnum.java | 80 + .../org/openapitools/client/model/Pet.java | 534 +++ .../client/model/ReadOnlyFirst.java | 313 ++ .../client/model/SpecialModelName.java | 281 ++ .../org/openapitools/client/model/Tag.java | 311 ++ .../client/model/TypeHolderDefault.java | 417 ++ .../client/model/TypeHolderExample.java | 444 +++ .../org/openapitools/client/model/User.java | 488 +++ .../openapitools/client/model/XmlItem.java | 1164 ++++++ .../src/main/resources/openapi/openapi.yaml | 2255 +++++++++++ .../client/api/AnotherFakeApiTest.java | 50 + .../openapitools/client/api/FakeApiTest.java | 253 ++ .../api/FakeClassnameTags123ApiTest.java | 48 + .../openapitools/client/api/PetApiTest.java | 158 + .../openapitools/client/api/StoreApiTest.java | 87 + .../openapitools/client/api/UserApiTest.java | 138 + .../AdditionalPropertiesAnyTypeTest.java | 47 + .../model/AdditionalPropertiesArrayTest.java | 48 + .../AdditionalPropertiesBooleanTest.java | 47 + .../model/AdditionalPropertiesClassTest.java | 131 + .../AdditionalPropertiesIntegerTest.java | 47 + .../model/AdditionalPropertiesNumberTest.java | 48 + .../model/AdditionalPropertiesObjectTest.java | 48 + .../model/AdditionalPropertiesStringTest.java | 47 + .../openapitools/client/model/AnimalTest.java | 55 + .../model/ArrayOfArrayOfNumberOnlyTest.java | 51 + .../client/model/ArrayOfNumberOnlyTest.java | 51 + .../client/model/ArrayTestTest.java | 67 + .../openapitools/client/model/BigCatTest.java | 72 + .../client/model/CapitalizationTest.java | 87 + .../openapitools/client/model/CatTest.java | 64 + .../client/model/CategoryTest.java | 55 + .../client/model/ClassModelTest.java | 47 + .../openapitools/client/model/ClientTest.java | 47 + .../openapitools/client/model/DogTest.java | 64 + .../client/model/EnumArraysTest.java | 58 + .../client/model/EnumClassTest.java | 32 + .../client/model/EnumTestTest.java | 80 + .../client/model/FileSchemaTestClassTest.java | 59 + .../client/model/FormatTestTest.java | 156 + .../client/model/HasOnlyReadOnlyTest.java | 55 + .../client/model/MapTestTest.java | 73 + ...rtiesAndAdditionalPropertiesClassTest.java | 68 + .../client/model/Model200ResponseTest.java | 55 + .../client/model/ModelApiResponseTest.java | 63 + .../client/model/ModelFileTest.java | 47 + .../client/model/ModelListTest.java | 47 + .../client/model/ModelReturnTest.java | 47 + .../openapitools/client/model/NameTest.java | 71 + .../client/model/NumberOnlyTest.java | 48 + .../openapitools/client/model/OrderTest.java | 88 + .../client/model/OuterCompositeTest.java | 64 + .../client/model/OuterEnumTest.java | 32 + .../openapitools/client/model/PetTest.java | 94 + .../client/model/ReadOnlyFirstTest.java | 55 + .../client/model/SpecialModelNameTest.java | 47 + .../openapitools/client/model/TagTest.java | 55 + .../client/model/TypeHolderDefaultTest.java | 83 + .../client/model/TypeHolderExampleTest.java | 91 + .../openapitools/client/model/UserTest.java | 103 + .../client/model/XmlItemTest.java | 275 ++ .../.github/workflows/maven.yml | 30 + .../java/okhttp-group-parameter/.gitignore | 21 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 54 + .../.openapi-generator/VERSION | 1 + .../java/okhttp-group-parameter/.travis.yml | 22 + .../java/okhttp-group-parameter/README.md | 173 + .../okhttp-group-parameter/api/openapi.yaml | 519 +++ .../java/okhttp-group-parameter/build.gradle | 64 + .../java/okhttp-group-parameter/build.sbt | 1 + .../okhttp-group-parameter/docs/Category.md | 15 + .../docs/ModelApiResponse.md | 16 + .../java/okhttp-group-parameter/docs/Order.md | 29 + .../java/okhttp-group-parameter/docs/Pet.md | 29 + .../okhttp-group-parameter/docs/PetApi.md | 580 +++ .../java/okhttp-group-parameter/docs/Tag.md | 15 + .../java/okhttp-group-parameter/docs/User.md | 21 + .../java/okhttp-group-parameter/git_push.sh | 57 + .../okhttp-group-parameter/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../java/okhttp-group-parameter/gradlew | 249 ++ .../java/okhttp-group-parameter/gradlew.bat | 92 + .../java/okhttp-group-parameter/pom.xml | 284 ++ .../okhttp-group-parameter/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1727 ++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 445 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../org/openapitools/client/api/PetApi.java | 1444 +++++++ .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../org/openapitools/client/auth/OAuth.java | 43 + .../openapitools/client/auth/OAuthFlow.java | 25 + .../client/auth/OAuthOkHttpClient.java | 82 + .../client/auth/RetryingOAuth.java | 223 ++ .../client/model/AbstractOpenApiSchema.java | 142 + .../openapitools/client/model/Category.java | 311 ++ .../client/model/ModelApiResponse.java | 341 ++ .../org/openapitools/client/model/Order.java | 478 +++ .../org/openapitools/client/model/Pet.java | 537 +++ .../org/openapitools/client/model/Tag.java | 311 ++ .../org/openapitools/client/model/User.java | 488 +++ .../openapitools/client/api/PetApiTest.java | 163 + .../client/model/CategoryTest.java | 55 + .../client/model/ModelApiResponseTest.java | 63 + .../openapitools/client/model/OrderTest.java | 88 + .../openapitools/client/model/PetTest.java | 92 + .../openapitools/client/model/TagTest.java | 55 + .../openapitools/client/model/UserTest.java | 103 + .../model/AdditionalPropertiesClass.java | 103 +- .../org/openapitools/client/model/Animal.java | 50 +- .../model/ArrayOfArrayOfNumberOnly.java | 103 +- .../client/model/ArrayOfNumberOnly.java | 103 +- .../openapitools/client/model/ArrayTest.java | 103 +- .../org/openapitools/client/model/BigCat.java | 103 +- .../client/model/Capitalization.java | 103 +- .../org/openapitools/client/model/Cat.java | 50 +- .../openapitools/client/model/Category.java | 103 +- .../openapitools/client/model/ClassModel.java | 103 +- .../org/openapitools/client/model/Client.java | 103 +- .../org/openapitools/client/model/Dog.java | 103 +- .../openapitools/client/model/EnumArrays.java | 103 +- .../openapitools/client/model/EnumTest.java | 103 +- .../client/model/FileSchemaTestClass.java | 103 +- .../openapitools/client/model/FormatTest.java | 103 +- .../client/model/HasOnlyReadOnly.java | 103 +- .../openapitools/client/model/MapTest.java | 103 +- ...ropertiesAndAdditionalPropertiesClass.java | 103 +- .../client/model/Model200Response.java | 103 +- .../client/model/ModelApiResponse.java | 103 +- .../openapitools/client/model/ModelFile.java | 103 +- .../openapitools/client/model/ModelList.java | 103 +- .../client/model/ModelReturn.java | 103 +- .../org/openapitools/client/model/Name.java | 103 +- .../openapitools/client/model/NumberOnly.java | 103 +- .../org/openapitools/client/model/Order.java | 103 +- .../client/model/OuterComposite.java | 103 +- .../org/openapitools/client/model/Pet.java | 103 +- .../client/model/ReadOnlyFirst.java | 103 +- .../client/model/SpecialModelName.java | 103 +- .../org/openapitools/client/model/Tag.java | 103 +- .../client/model/TypeHolderDefault.java | 103 +- .../client/model/TypeHolderExample.java | 103 +- .../org/openapitools/client/model/User.java | 103 +- .../openapitools/client/model/XmlItem.java | 103 +- .../model/AdditionalPropertiesClass.java | 103 +- .../org/openapitools/client/model/Animal.java | 50 +- .../model/ArrayOfArrayOfNumberOnly.java | 103 +- .../client/model/ArrayOfNumberOnly.java | 103 +- .../openapitools/client/model/ArrayTest.java | 103 +- .../org/openapitools/client/model/BigCat.java | 103 +- .../client/model/Capitalization.java | 103 +- .../org/openapitools/client/model/Cat.java | 50 +- .../openapitools/client/model/Category.java | 103 +- .../openapitools/client/model/ClassModel.java | 103 +- .../org/openapitools/client/model/Client.java | 103 +- .../org/openapitools/client/model/Dog.java | 103 +- .../openapitools/client/model/EnumArrays.java | 103 +- .../openapitools/client/model/EnumTest.java | 103 +- .../client/model/FileSchemaTestClass.java | 103 +- .../openapitools/client/model/FormatTest.java | 103 +- .../client/model/HasOnlyReadOnly.java | 103 +- .../openapitools/client/model/MapTest.java | 103 +- ...ropertiesAndAdditionalPropertiesClass.java | 103 +- .../client/model/Model200Response.java | 103 +- .../client/model/ModelApiResponse.java | 103 +- .../openapitools/client/model/ModelFile.java | 103 +- .../openapitools/client/model/ModelList.java | 103 +- .../client/model/ModelReturn.java | 103 +- .../org/openapitools/client/model/Name.java | 103 +- .../openapitools/client/model/NumberOnly.java | 103 +- .../org/openapitools/client/model/Order.java | 103 +- .../client/model/OuterComposite.java | 103 +- .../org/openapitools/client/model/Pet.java | 103 +- .../client/model/ReadOnlyFirst.java | 103 +- .../client/model/SpecialModelName.java | 103 +- .../org/openapitools/client/model/Tag.java | 103 +- .../client/model/TypeHolderDefault.java | 103 +- .../client/model/TypeHolderExample.java | 103 +- .../org/openapitools/client/model/User.java | 103 +- .../openapitools/client/model/XmlItem.java | 103 +- .../openapitools/client/model/AppleReq.java | 103 +- .../openapitools/client/model/BananaReq.java | 103 +- .../client/model/IsoscelesTriangle.java | 103 +- .../client/model/NullableFieldsMapError.java | 103 +- .../model/NullableFieldsMapSuccess.java | 103 +- .../.github/workflows/maven.yml | 30 + .../petstore/java/okhttp-jackson/.gitignore | 21 + .../okhttp-jackson/.openapi-generator-ignore | 23 + .../okhttp-jackson/.openapi-generator/FILES | 404 ++ .../okhttp-jackson/.openapi-generator/VERSION | 1 + .../petstore/java/okhttp-jackson/.travis.yml | 22 + .../petstore/java/okhttp-jackson/README.md | 337 ++ .../java/okhttp-jackson/api/openapi.yaml | 3332 ++++++++++++++++ .../petstore/java/okhttp-jackson/build.gradle | 69 + .../petstore/java/okhttp-jackson/build.sbt | 1 + .../docs/AdditionalPropertiesClass.md | 20 + .../docs/AllOfModelArrayAnyOf.md | 16 + .../AllOfModelArrayAnyOfAllOfAttributes.md | 13 + .../AllOfModelArrayAnyOfAllOfAttributesC.md | 32 + ...llOfModelArrayAnyOfAllOfLinkListColumn1.md | 13 + ...odelArrayAnyOfAllOfLinkListColumn1Value.md | 25 + .../okhttp-jackson/docs/AllOfRefToDouble.md | 14 + .../okhttp-jackson/docs/AllOfRefToFloat.md | 14 + .../okhttp-jackson/docs/AllOfRefToLong.md | 14 + .../java/okhttp-jackson/docs/Animal.md | 14 + .../okhttp-jackson/docs/AnotherFakeApi.md | 191 + .../java/okhttp-jackson/docs/Apple.md | 14 + .../java/okhttp-jackson/docs/AppleReq.md | 14 + .../java/okhttp-jackson/docs/ArrayAnyOf.md | 12 + .../java/okhttp-jackson/docs/ArrayDefault.md | 14 + .../docs/ArrayOfArrayOfNumberOnly.md | 13 + .../okhttp-jackson/docs/ArrayOfInlineAllOf.md | 15 + ...OfInlineAllOfArrayAllofDogPropertyInner.md | 14 + .../okhttp-jackson/docs/ArrayOfNumberOnly.md | 13 + .../java/okhttp-jackson/docs/ArrayOneOf.md | 12 + .../java/okhttp-jackson/docs/ArrayTest.md | 15 + .../java/okhttp-jackson/docs/Banana.md | 13 + .../java/okhttp-jackson/docs/BananaReq.md | 14 + .../java/okhttp-jackson/docs/BasquePig.md | 13 + .../okhttp-jackson/docs/Capitalization.md | 18 + .../petstore/java/okhttp-jackson/docs/Cat.md | 13 + .../java/okhttp-jackson/docs/Category.md | 14 + .../java/okhttp-jackson/docs/ClassModel.md | 14 + .../java/okhttp-jackson/docs/Client.md | 13 + .../docs/ComplexQuadrilateral.md | 14 + .../java/okhttp-jackson/docs/DanishPig.md | 13 + .../java/okhttp-jackson/docs/DefaultApi.md | 245 ++ .../okhttp-jackson/docs/DeprecatedObject.md | 13 + .../petstore/java/okhttp-jackson/docs/Dog.md | 13 + .../java/okhttp-jackson/docs/Drawing.md | 16 + .../java/okhttp-jackson/docs/EnumArrays.md | 32 + .../java/okhttp-jackson/docs/EnumClass.md | 15 + .../docs/EnumStringDiscriminator.md | 23 + .../java/okhttp-jackson/docs/EnumTest.md | 68 + .../docs/EquilateralTriangle.md | 14 + .../FakeAnyOfWIthSameErasureGet200Response.md | 12 + .../java/okhttp-jackson/docs/FakeApi.md | 1571 ++++++++ .../docs/FakeClassnameTags123Api.md | 78 + .../FakeOneOfWIthSameErasureGet200Response.md | 12 + .../docs/FakeRefParameterPetIdParameter.md | 12 + .../docs/FileSchemaTestClass.md | 14 + .../petstore/java/okhttp-jackson/docs/Foo.md | 13 + .../docs/FooGetDefaultResponse.md | 13 + .../java/okhttp-jackson/docs/FormatTest.md | 29 + .../docs/FreeFormObjectTestClass.md | 14 + .../docs/FreeFormObjectTestClassProperties.md | 12 + .../java/okhttp-jackson/docs/Fruit.md | 16 + .../java/okhttp-jackson/docs/FruitReq.md | 16 + .../java/okhttp-jackson/docs/GmFruit.md | 16 + .../okhttp-jackson/docs/GrandparentAnimal.md | 13 + .../okhttp-jackson/docs/HasOnlyReadOnly.md | 14 + .../okhttp-jackson/docs/HealthCheckResult.md | 14 + .../okhttp-jackson/docs/IsoscelesTriangle.md | 14 + .../java/okhttp-jackson/docs/Mammal.md | 26 + .../java/okhttp-jackson/docs/MammalAnyof.md | 26 + .../java/okhttp-jackson/docs/MapTest.md | 25 + ...dPropertiesAndAdditionalPropertiesClass.md | 15 + .../okhttp-jackson/docs/Model200Response.md | 15 + .../okhttp-jackson/docs/ModelApiResponse.md | 15 + .../java/okhttp-jackson/docs/ModelFile.md | 14 + .../java/okhttp-jackson/docs/ModelList.md | 13 + .../java/okhttp-jackson/docs/ModelReturn.md | 14 + .../docs/ModelWithOneOfAnyOfProperties.md | 14 + .../petstore/java/okhttp-jackson/docs/Name.md | 17 + .../docs/NestedArrayWithDefaultValues.md | 13 + .../java/okhttp-jackson/docs/NewPet.md | 31 + .../docs/NewPetCategoryInlineAllof.md | 15 + ...wPetCategoryInlineAllofAllOfCategoryTag.md | 14 + .../java/okhttp-jackson/docs/NullableClass.md | 24 + .../java/okhttp-jackson/docs/NullableEnum.md | 11 + .../docs/NullableFieldsMapError.md | 15 + .../docs/NullableFieldsMapResponse.md | 15 + .../docs/NullableFieldsMapSuccess.md | 15 + .../docs/NullableFieldsValue.md | 15 + .../java/okhttp-jackson/docs/NullableShape.md | 16 + .../java/okhttp-jackson/docs/NumberOnly.md | 13 + .../docs/ObjectWithDeprecatedFields.md | 16 + .../java/okhttp-jackson/docs/Order.md | 28 + .../okhttp-jackson/docs/OuterComposite.md | 15 + .../java/okhttp-jackson/docs/OuterEnum.md | 19 + .../docs/OuterEnumDefaultValue.md | 15 + .../okhttp-jackson/docs/OuterEnumInteger.md | 15 + .../docs/OuterEnumIntegerDefaultValue.md | 15 + .../java/okhttp-jackson/docs/ParentPet.md | 12 + .../petstore/java/okhttp-jackson/docs/Pet.md | 28 + .../java/okhttp-jackson/docs/PetApi.md | 640 +++ .../okhttp-jackson/docs/PetComposition.md | 28 + .../java/okhttp-jackson/docs/PetRef.md | 28 + .../java/okhttp-jackson/docs/PetUsingAllOf.md | 28 + .../docs/PetWithRequiredTags.md | 28 + .../petstore/java/okhttp-jackson/docs/Pig.md | 13 + .../docs/PropertyNameCollision.md | 15 + .../java/okhttp-jackson/docs/Quadrilateral.md | 14 + .../docs/QuadrilateralInterface.md | 13 + .../java/okhttp-jackson/docs/ReadOnlyFirst.md | 14 + .../docs/RequiredNullableBody.md | 34 + .../java/okhttp-jackson/docs/Scalar.md | 13 + .../java/okhttp-jackson/docs/ScalarAnyOf.md | 13 + .../okhttp-jackson/docs/ScaleneTriangle.md | 14 + .../java/okhttp-jackson/docs/Shape.md | 15 + .../okhttp-jackson/docs/ShapeInterface.md | 13 + .../java/okhttp-jackson/docs/ShapeOrNull.md | 16 + .../docs/SimpleQuadrilateral.md | 14 + .../okhttp-jackson/docs/SpecialModelName.md | 14 + .../java/okhttp-jackson/docs/StoreApi.md | 266 ++ .../petstore/java/okhttp-jackson/docs/Tag.md | 14 + ...lineFreeformAdditionalPropertiesRequest.md | 13 + .../java/okhttp-jackson/docs/Triangle.md | 14 + .../okhttp-jackson/docs/TriangleInterface.md | 13 + .../petstore/java/okhttp-jackson/docs/User.md | 24 + .../java/okhttp-jackson/docs/UserApi.md | 511 +++ .../java/okhttp-jackson/docs/Value.md | 12 + .../java/okhttp-jackson/docs/ValuesApi.md | 68 + .../java/okhttp-jackson/docs/Variable.md | 15 + .../java/okhttp-jackson/docs/Whale.md | 15 + .../java/okhttp-jackson/docs/Zebra.md | 24 + .../petstore/java/okhttp-jackson/git_push.sh | 57 + .../java/okhttp-jackson/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../petstore/java/okhttp-jackson/gradlew | 249 ++ .../petstore/java/okhttp-jackson/gradlew.bat | 92 + .../petstore/java/okhttp-jackson/pom.xml | 307 ++ .../java/okhttp-jackson/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1801 +++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 344 ++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/RFC3339DateFormat.java | 57 + .../client/RFC3339InstantDeserializer.java | 100 + .../client/RFC3339JavaTimeModule.java | 39 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../client/api/AnotherFakeApi.java | 458 +++ .../openapitools/client/api/DefaultApi.java | 563 +++ .../org/openapitools/client/api/FakeApi.java | 3457 +++++++++++++++++ .../client/api/FakeClassnameTags123Api.java | 205 + .../org/openapitools/client/api/PetApi.java | 1329 +++++++ .../org/openapitools/client/api/StoreApi.java | 593 +++ .../org/openapitools/client/api/UserApi.java | 1105 ++++++ .../openapitools/client/api/ValuesApi.java | 199 + .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../org/openapitools/client/auth/OAuth.java | 43 + .../openapitools/client/auth/OAuthFlow.java | 25 + .../client/auth/OAuthOkHttpClient.java | 82 + .../client/auth/RetryingOAuth.java | 223 ++ .../client/model/AbstractOpenApiSchema.java | 144 + .../model/AdditionalPropertiesClass.java | 435 +++ .../client/model/AllOfModelArrayAnyOf.java | 264 ++ .../AllOfModelArrayAnyOfAllOfAttributes.java | 170 + .../AllOfModelArrayAnyOfAllOfAttributesC.java | 257 ++ ...OfModelArrayAnyOfAllOfLinkListColumn1.java | 181 + ...elArrayAnyOfAllOfLinkListColumn1Value.java | 217 ++ .../client/model/AllOfRefToDouble.java | 169 + .../client/model/AllOfRefToFloat.java | 169 + .../client/model/AllOfRefToLong.java | 169 + .../org/openapitools/client/model/Animal.java | 214 + .../org/openapitools/client/model/Apple.java | 200 + .../openapitools/client/model/AppleReq.java | 200 + .../openapitools/client/model/ArrayAnyOf.java | 207 + .../client/model/ArrayDefault.java | 219 ++ .../model/ArrayOfArrayOfNumberOnly.java | 181 + .../client/model/ArrayOfInlineAllOf.java | 243 ++ ...InlineAllOfArrayAllofDogPropertyInner.java | 200 + .../client/model/ArrayOfNumberOnly.java | 181 + .../openapitools/client/model/ArrayOneOf.java | 245 ++ .../openapitools/client/model/ArrayTest.java | 259 ++ .../org/openapitools/client/model/Banana.java | 170 + .../openapitools/client/model/BananaReq.java | 201 + .../openapitools/client/model/BasquePig.java | 169 + .../client/model/Capitalization.java | 324 ++ .../org/openapitools/client/model/Cat.java | 182 + .../openapitools/client/model/Category.java | 200 + .../openapitools/client/model/ClassModel.java | 169 + .../org/openapitools/client/model/Client.java | 169 + .../client/model/ComplexQuadrilateral.java | 200 + .../openapitools/client/model/DanishPig.java | 169 + .../client/model/DeprecatedObject.java | 171 + .../org/openapitools/client/model/Dog.java | 181 + .../openapitools/client/model/Drawing.java | 292 ++ .../openapitools/client/model/EnumArrays.java | 283 ++ .../openapitools/client/model/EnumClass.java | 62 + .../client/model/EnumStringDiscriminator.java | 215 + .../openapitools/client/model/EnumTest.java | 625 +++ .../client/model/EquilateralTriangle.java | 200 + ...akeAnyOfWIthSameErasureGet200Response.java | 208 + ...akeOneOfWIthSameErasureGet200Response.java | 246 ++ .../model/FakeRefParameterPetIdParameter.java | 245 ++ .../client/model/FileSchemaTestClass.java | 212 + .../org/openapitools/client/model/Foo.java | 169 + .../client/model/FooGetDefaultResponse.java | 170 + .../openapitools/client/model/FormatTest.java | 680 ++++ .../client/model/FreeFormObjectTestClass.java | 201 + .../FreeFormObjectTestClassProperties.java | 246 ++ .../org/openapitools/client/model/Fruit.java | 252 ++ .../openapitools/client/model/FruitReq.java | 259 ++ .../openapitools/client/model/GmFruit.java | 214 + .../client/model/GrandparentAnimal.java | 182 + .../client/model/HasOnlyReadOnly.java | 191 + .../client/model/HealthCheckResult.java | 184 + .../client/model/IsoscelesTriangle.java | 200 + .../org/openapitools/client/model/Mammal.java | 332 ++ .../client/model/MammalAnyof.java | 264 ++ .../openapitools/client/model/MapTest.java | 332 ++ ...ropertiesAndAdditionalPropertiesClass.java | 244 ++ .../client/model/Model200Response.java | 200 + .../client/model/ModelApiResponse.java | 231 ++ .../openapitools/client/model/ModelFile.java | 169 + .../openapitools/client/model/ModelList.java | 169 + .../client/model/ModelReturn.java | 169 + .../model/ModelWithOneOfAnyOfProperties.java | 202 + .../org/openapitools/client/model/Name.java | 253 ++ .../model/NestedArrayWithDefaultValues.java | 180 + .../org/openapitools/client/model/NewPet.java | 475 +++ .../model/NewPetCategoryInlineAllof.java | 232 ++ ...etCategoryInlineAllofAllOfCategoryTag.java | 200 + .../client/model/NullableClass.java | 581 +++ .../client/model/NullableEnum.java | 58 + .../client/model/NullableFieldsMapError.java | 200 + .../model/NullableFieldsMapResponse.java | 216 + .../model/NullableFieldsMapSuccess.java | 211 + .../client/model/NullableFieldsValue.java | 200 + .../client/model/NullableShape.java | 285 ++ .../openapitools/client/model/NumberOnly.java | 170 + .../model/ObjectWithDeprecatedFields.java | 290 ++ .../org/openapitools/client/model/Order.java | 363 ++ .../client/model/OuterComposite.java | 232 ++ .../openapitools/client/model/OuterEnum.java | 66 + .../client/model/OuterEnumDefaultValue.java | 62 + .../client/model/OuterEnumInteger.java | 63 + .../model/OuterEnumIntegerDefaultValue.java | 62 + .../openapitools/client/model/ParentPet.java | 150 + .../org/openapitools/client/model/Pet.java | 383 ++ .../client/model/PetComposition.java | 383 ++ .../org/openapitools/client/model/PetRef.java | 383 ++ .../client/model/PetUsingAllOf.java | 383 ++ .../client/model/PetWithRequiredTags.java | 383 ++ .../org/openapitools/client/model/Pig.java | 278 ++ .../client/model/PropertyNameCollision.java | 231 ++ .../client/model/Quadrilateral.java | 278 ++ .../client/model/QuadrilateralInterface.java | 169 + .../client/model/ReadOnlyFirst.java | 198 + .../client/model/RequiredNullableBody.java | 663 ++++ .../org/openapitools/client/model/Scalar.java | 342 ++ .../client/model/ScalarAnyOf.java | 274 ++ .../client/model/ScaleneTriangle.java | 200 + .../org/openapitools/client/model/Shape.java | 278 ++ .../client/model/ShapeInterface.java | 169 + .../client/model/ShapeOrNull.java | 285 ++ .../client/model/SimpleQuadrilateral.java | 200 + .../client/model/SpecialModelName.java | 200 + .../org/openapitools/client/model/Tag.java | 200 + ...neFreeformAdditionalPropertiesRequest.java | 169 + .../openapitools/client/model/Triangle.java | 332 ++ .../client/model/TriangleInterface.java | 169 + .../org/openapitools/client/model/User.java | 525 +++ .../org/openapitools/client/model/Value.java | 246 ++ .../openapitools/client/model/Variable.java | 201 + .../org/openapitools/client/model/Whale.java | 231 ++ .../org/openapitools/client/model/Zebra.java | 238 ++ .../client/api/AnotherFakeApiTest.java | 73 + .../client/api/DefaultApiTest.java | 78 + .../openapitools/client/api/FakeApiTest.java | 395 ++ .../api/FakeClassnameTags123ApiTest.java | 48 + .../openapitools/client/api/PetApiTest.java | 170 + .../openapitools/client/api/StoreApiTest.java | 89 + .../openapitools/client/api/UserApiTest.java | 148 + .../client/api/ValuesApiTest.java | 47 + .../model/AdditionalPropertiesClassTest.java | 108 + ...OfModelArrayAnyOfAllOfAttributesCTest.java | 126 + ...lOfModelArrayAnyOfAllOfAttributesTest.java | 47 + ...delArrayAnyOfAllOfLinkListColumn1Test.java | 50 + ...rayAnyOfAllOfLinkListColumn1ValueTest.java | 148 + .../model/AllOfModelArrayAnyOfTest.java | 72 + .../client/model/AllOfRefToDoubleTest.java | 46 + .../client/model/AllOfRefToFloatTest.java | 46 + .../client/model/AllOfRefToLongTest.java | 46 + .../openapitools/client/model/AnimalTest.java | 57 + .../client/model/AppleReqTest.java | 54 + .../openapitools/client/model/AppleTest.java | 54 + .../client/model/ArrayAnyOfTest.java | 34 + .../client/model/ArrayDefaultTest.java | 57 + .../model/ArrayOfArrayOfNumberOnlyTest.java | 50 + ...neAllOfArrayAllofDogPropertyInnerTest.java | 54 + .../client/model/ArrayOfInlineAllOfTest.java | 66 + .../client/model/ArrayOfNumberOnlyTest.java | 50 + .../client/model/ArrayOneOfTest.java | 34 + .../client/model/ArrayTestTest.java | 66 + .../client/model/BananaReqTest.java | 55 + .../openapitools/client/model/BananaTest.java | 47 + .../client/model/BasquePigTest.java | 46 + .../client/model/CapitalizationTest.java | 86 + .../openapitools/client/model/CatTest.java | 67 + .../client/model/CategoryTest.java | 54 + .../client/model/ClassModelTest.java | 46 + .../openapitools/client/model/ClientTest.java | 46 + .../model/ComplexQuadrilateralTest.java | 54 + .../client/model/DanishPigTest.java | 46 + .../client/model/DeprecatedObjectTest.java | 46 + .../openapitools/client/model/DogTest.java | 66 + .../client/model/DrawingTest.java | 81 + .../client/model/EnumArraysTest.java | 57 + .../client/model/EnumClassTest.java | 31 + .../model/EnumStringDiscriminatorTest.java | 49 + .../client/model/EnumTestTest.java | 118 + .../client/model/EquilateralTriangleTest.java | 54 + ...nyOfWIthSameErasureGet200ResponseTest.java | 35 + ...neOfWIthSameErasureGet200ResponseTest.java | 35 + .../FakeRefParameterPetIdParameterTest.java | 34 + .../client/model/FileSchemaTestClassTest.java | 58 + .../model/FooGetDefaultResponseTest.java | 47 + .../openapitools/client/model/FooTest.java | 46 + .../client/model/FormatTestTest.java | 179 + ...FreeFormObjectTestClassPropertiesTest.java | 35 + .../model/FreeFormObjectTestClassTest.java | 55 + .../client/model/FruitReqTest.java | 73 + .../openapitools/client/model/FruitTest.java | 65 + .../client/model/GmFruitTest.java | 65 + .../client/model/GrandparentAnimalTest.java | 49 + .../client/model/HasOnlyReadOnlyTest.java | 54 + .../client/model/HealthCheckResultTest.java | 50 + .../client/model/IsoscelesTriangleTest.java | 54 + .../client/model/MammalAnyofTest.java | 76 + .../openapitools/client/model/MammalTest.java | 76 + .../client/model/MapTestTest.java | 72 + ...rtiesAndAdditionalPropertiesClassTest.java | 67 + .../client/model/Model200ResponseTest.java | 54 + .../client/model/ModelApiResponseTest.java | 62 + .../client/model/ModelFileTest.java | 46 + .../client/model/ModelListTest.java | 46 + .../client/model/ModelReturnTest.java | 46 + .../ModelWithOneOfAnyOfPropertiesTest.java | 56 + .../openapitools/client/model/NameTest.java | 70 + .../NestedArrayWithDefaultValuesTest.java | 49 + ...tegoryInlineAllofAllOfCategoryTagTest.java | 54 + .../model/NewPetCategoryInlineAllofTest.java | 63 + .../openapitools/client/model/NewPetTest.java | 116 + .../client/model/NullableClassTest.java | 146 + .../client/model/NullableEnumTest.java | 31 + .../model/NullableFieldsMapErrorTest.java | 54 + .../model/NullableFieldsMapResponseTest.java | 67 + .../model/NullableFieldsMapSuccessTest.java | 57 + .../client/model/NullableFieldsValueTest.java | 54 + .../client/model/NullableShapeTest.java | 67 + .../client/model/NumberOnlyTest.java | 47 + .../model/ObjectWithDeprecatedFieldsTest.java | 75 + .../openapitools/client/model/OrderTest.java | 87 + .../client/model/OuterCompositeTest.java | 63 + .../model/OuterEnumDefaultValueTest.java | 31 + .../OuterEnumIntegerDefaultValueTest.java | 31 + .../client/model/OuterEnumIntegerTest.java | 31 + .../client/model/OuterEnumTest.java | 31 + .../client/model/ParentPetTest.java | 50 + .../client/model/PetCompositionTest.java | 91 + .../openapitools/client/model/PetRefTest.java | 91 + .../openapitools/client/model/PetTest.java | 91 + .../client/model/PetUsingAllOfTest.java | 91 + .../client/model/PetWithRequiredTagsTest.java | 91 + .../openapitools/client/model/PigTest.java | 51 + .../model/PropertyNameCollisionTest.java | 62 + .../model/QuadrilateralInterfaceTest.java | 46 + .../client/model/QuadrilateralTest.java | 59 + .../client/model/ReadOnlyFirstTest.java | 54 + .../model/RequiredNullableBodyTest.java | 159 + .../client/model/ScalarAnyOfTest.java | 35 + .../openapitools/client/model/ScalarTest.java | 35 + .../client/model/ScaleneTriangleTest.java | 54 + .../client/model/ShapeInterfaceTest.java | 46 + .../client/model/ShapeOrNullTest.java | 67 + .../openapitools/client/model/ShapeTest.java | 67 + .../client/model/SimpleQuadrilateralTest.java | 54 + .../client/model/SpecialModelNameTest.java | 54 + .../openapitools/client/model/TagTest.java | 54 + ...eeformAdditionalPropertiesRequestTest.java | 46 + .../client/model/TriangleInterfaceTest.java | 46 + .../client/model/TriangleTest.java | 60 + .../openapitools/client/model/UserTest.java | 138 + .../openapitools/client/model/ValueTest.java | 35 + .../client/model/VariableTest.java | 55 + .../openapitools/client/model/WhaleTest.java | 62 + .../openapitools/client/model/ZebraTest.java | 54 + .../.github/workflows/maven.yml | 30 + .../petstore/java/okhttp-jackson3/.gitignore | 21 + .../okhttp-jackson3/.openapi-generator-ignore | 23 + .../okhttp-jackson3/.openapi-generator/FILES | 404 ++ .../.openapi-generator/VERSION | 1 + .../petstore/java/okhttp-jackson3/.travis.yml | 22 + .../petstore/java/okhttp-jackson3/README.md | 337 ++ .../java/okhttp-jackson3/api/openapi.yaml | 3332 ++++++++++++++++ .../java/okhttp-jackson3/build.gradle | 69 + .../petstore/java/okhttp-jackson3/build.sbt | 1 + .../docs/AdditionalPropertiesClass.md | 20 + .../docs/AllOfModelArrayAnyOf.md | 16 + .../AllOfModelArrayAnyOfAllOfAttributes.md | 13 + .../AllOfModelArrayAnyOfAllOfAttributesC.md | 32 + ...llOfModelArrayAnyOfAllOfLinkListColumn1.md | 13 + ...odelArrayAnyOfAllOfLinkListColumn1Value.md | 25 + .../okhttp-jackson3/docs/AllOfRefToDouble.md | 14 + .../okhttp-jackson3/docs/AllOfRefToFloat.md | 14 + .../okhttp-jackson3/docs/AllOfRefToLong.md | 14 + .../java/okhttp-jackson3/docs/Animal.md | 14 + .../okhttp-jackson3/docs/AnotherFakeApi.md | 191 + .../java/okhttp-jackson3/docs/Apple.md | 14 + .../java/okhttp-jackson3/docs/AppleReq.md | 14 + .../java/okhttp-jackson3/docs/ArrayAnyOf.md | 12 + .../java/okhttp-jackson3/docs/ArrayDefault.md | 14 + .../docs/ArrayOfArrayOfNumberOnly.md | 13 + .../docs/ArrayOfInlineAllOf.md | 15 + ...OfInlineAllOfArrayAllofDogPropertyInner.md | 14 + .../okhttp-jackson3/docs/ArrayOfNumberOnly.md | 13 + .../java/okhttp-jackson3/docs/ArrayOneOf.md | 12 + .../java/okhttp-jackson3/docs/ArrayTest.md | 15 + .../java/okhttp-jackson3/docs/Banana.md | 13 + .../java/okhttp-jackson3/docs/BananaReq.md | 14 + .../java/okhttp-jackson3/docs/BasquePig.md | 13 + .../okhttp-jackson3/docs/Capitalization.md | 18 + .../petstore/java/okhttp-jackson3/docs/Cat.md | 13 + .../java/okhttp-jackson3/docs/Category.md | 14 + .../java/okhttp-jackson3/docs/ClassModel.md | 14 + .../java/okhttp-jackson3/docs/Client.md | 13 + .../docs/ComplexQuadrilateral.md | 14 + .../java/okhttp-jackson3/docs/DanishPig.md | 13 + .../java/okhttp-jackson3/docs/DefaultApi.md | 245 ++ .../okhttp-jackson3/docs/DeprecatedObject.md | 13 + .../petstore/java/okhttp-jackson3/docs/Dog.md | 13 + .../java/okhttp-jackson3/docs/Drawing.md | 16 + .../java/okhttp-jackson3/docs/EnumArrays.md | 32 + .../java/okhttp-jackson3/docs/EnumClass.md | 15 + .../docs/EnumStringDiscriminator.md | 23 + .../java/okhttp-jackson3/docs/EnumTest.md | 68 + .../docs/EquilateralTriangle.md | 14 + .../FakeAnyOfWIthSameErasureGet200Response.md | 12 + .../java/okhttp-jackson3/docs/FakeApi.md | 1571 ++++++++ .../docs/FakeClassnameTags123Api.md | 78 + .../FakeOneOfWIthSameErasureGet200Response.md | 12 + .../docs/FakeRefParameterPetIdParameter.md | 12 + .../docs/FileSchemaTestClass.md | 14 + .../petstore/java/okhttp-jackson3/docs/Foo.md | 13 + .../docs/FooGetDefaultResponse.md | 13 + .../java/okhttp-jackson3/docs/FormatTest.md | 29 + .../docs/FreeFormObjectTestClass.md | 14 + .../docs/FreeFormObjectTestClassProperties.md | 12 + .../java/okhttp-jackson3/docs/Fruit.md | 16 + .../java/okhttp-jackson3/docs/FruitReq.md | 16 + .../java/okhttp-jackson3/docs/GmFruit.md | 16 + .../okhttp-jackson3/docs/GrandparentAnimal.md | 13 + .../okhttp-jackson3/docs/HasOnlyReadOnly.md | 14 + .../okhttp-jackson3/docs/HealthCheckResult.md | 14 + .../okhttp-jackson3/docs/IsoscelesTriangle.md | 14 + .../java/okhttp-jackson3/docs/Mammal.md | 26 + .../java/okhttp-jackson3/docs/MammalAnyof.md | 26 + .../java/okhttp-jackson3/docs/MapTest.md | 25 + ...dPropertiesAndAdditionalPropertiesClass.md | 15 + .../okhttp-jackson3/docs/Model200Response.md | 15 + .../okhttp-jackson3/docs/ModelApiResponse.md | 15 + .../java/okhttp-jackson3/docs/ModelFile.md | 14 + .../java/okhttp-jackson3/docs/ModelList.md | 13 + .../java/okhttp-jackson3/docs/ModelReturn.md | 14 + .../docs/ModelWithOneOfAnyOfProperties.md | 14 + .../java/okhttp-jackson3/docs/Name.md | 17 + .../docs/NestedArrayWithDefaultValues.md | 13 + .../java/okhttp-jackson3/docs/NewPet.md | 31 + .../docs/NewPetCategoryInlineAllof.md | 15 + ...wPetCategoryInlineAllofAllOfCategoryTag.md | 14 + .../okhttp-jackson3/docs/NullableClass.md | 24 + .../java/okhttp-jackson3/docs/NullableEnum.md | 11 + .../docs/NullableFieldsMapError.md | 15 + .../docs/NullableFieldsMapResponse.md | 15 + .../docs/NullableFieldsMapSuccess.md | 15 + .../docs/NullableFieldsValue.md | 15 + .../okhttp-jackson3/docs/NullableShape.md | 16 + .../java/okhttp-jackson3/docs/NumberOnly.md | 13 + .../docs/ObjectWithDeprecatedFields.md | 16 + .../java/okhttp-jackson3/docs/Order.md | 28 + .../okhttp-jackson3/docs/OuterComposite.md | 15 + .../java/okhttp-jackson3/docs/OuterEnum.md | 19 + .../docs/OuterEnumDefaultValue.md | 15 + .../okhttp-jackson3/docs/OuterEnumInteger.md | 15 + .../docs/OuterEnumIntegerDefaultValue.md | 15 + .../java/okhttp-jackson3/docs/ParentPet.md | 12 + .../petstore/java/okhttp-jackson3/docs/Pet.md | 28 + .../java/okhttp-jackson3/docs/PetApi.md | 640 +++ .../okhttp-jackson3/docs/PetComposition.md | 28 + .../java/okhttp-jackson3/docs/PetRef.md | 28 + .../okhttp-jackson3/docs/PetUsingAllOf.md | 28 + .../docs/PetWithRequiredTags.md | 28 + .../petstore/java/okhttp-jackson3/docs/Pig.md | 13 + .../docs/PropertyNameCollision.md | 15 + .../okhttp-jackson3/docs/Quadrilateral.md | 14 + .../docs/QuadrilateralInterface.md | 13 + .../okhttp-jackson3/docs/ReadOnlyFirst.md | 14 + .../docs/RequiredNullableBody.md | 34 + .../java/okhttp-jackson3/docs/Scalar.md | 13 + .../java/okhttp-jackson3/docs/ScalarAnyOf.md | 13 + .../okhttp-jackson3/docs/ScaleneTriangle.md | 14 + .../java/okhttp-jackson3/docs/Shape.md | 15 + .../okhttp-jackson3/docs/ShapeInterface.md | 13 + .../java/okhttp-jackson3/docs/ShapeOrNull.md | 16 + .../docs/SimpleQuadrilateral.md | 14 + .../okhttp-jackson3/docs/SpecialModelName.md | 14 + .../java/okhttp-jackson3/docs/StoreApi.md | 266 ++ .../petstore/java/okhttp-jackson3/docs/Tag.md | 14 + ...lineFreeformAdditionalPropertiesRequest.md | 13 + .../java/okhttp-jackson3/docs/Triangle.md | 14 + .../okhttp-jackson3/docs/TriangleInterface.md | 13 + .../java/okhttp-jackson3/docs/User.md | 24 + .../java/okhttp-jackson3/docs/UserApi.md | 511 +++ .../java/okhttp-jackson3/docs/Value.md | 12 + .../java/okhttp-jackson3/docs/ValuesApi.md | 68 + .../java/okhttp-jackson3/docs/Variable.md | 15 + .../java/okhttp-jackson3/docs/Whale.md | 15 + .../java/okhttp-jackson3/docs/Zebra.md | 24 + .../petstore/java/okhttp-jackson3/git_push.sh | 57 + .../java/okhttp-jackson3/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../petstore/java/okhttp-jackson3/gradlew | 249 ++ .../petstore/java/okhttp-jackson3/gradlew.bat | 92 + .../petstore/java/okhttp-jackson3/pom.xml | 302 ++ .../java/okhttp-jackson3/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1801 +++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 344 ++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/RFC3339DateFormat.java | 57 + .../client/RFC3339InstantDeserializer.java | 100 + .../client/RFC3339JavaTimeModule.java | 33 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../client/api/AnotherFakeApi.java | 458 +++ .../openapitools/client/api/DefaultApi.java | 563 +++ .../org/openapitools/client/api/FakeApi.java | 3457 +++++++++++++++++ .../client/api/FakeClassnameTags123Api.java | 205 + .../org/openapitools/client/api/PetApi.java | 1329 +++++++ .../org/openapitools/client/api/StoreApi.java | 593 +++ .../org/openapitools/client/api/UserApi.java | 1105 ++++++ .../openapitools/client/api/ValuesApi.java | 199 + .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../org/openapitools/client/auth/OAuth.java | 43 + .../openapitools/client/auth/OAuthFlow.java | 25 + .../client/auth/OAuthOkHttpClient.java | 82 + .../client/auth/RetryingOAuth.java | 223 ++ .../client/model/AbstractOpenApiSchema.java | 144 + .../model/AdditionalPropertiesClass.java | 434 +++ .../client/model/AllOfModelArrayAnyOf.java | 263 ++ .../AllOfModelArrayAnyOfAllOfAttributes.java | 170 + .../AllOfModelArrayAnyOfAllOfAttributesC.java | 258 ++ ...OfModelArrayAnyOfAllOfLinkListColumn1.java | 181 + ...elArrayAnyOfAllOfLinkListColumn1Value.java | 218 ++ .../client/model/AllOfRefToDouble.java | 168 + .../client/model/AllOfRefToFloat.java | 168 + .../client/model/AllOfRefToLong.java | 168 + .../org/openapitools/client/model/Animal.java | 213 + .../org/openapitools/client/model/Apple.java | 200 + .../openapitools/client/model/AppleReq.java | 200 + .../openapitools/client/model/ArrayAnyOf.java | 208 + .../client/model/ArrayDefault.java | 218 ++ .../model/ArrayOfArrayOfNumberOnly.java | 180 + .../client/model/ArrayOfInlineAllOf.java | 242 ++ ...InlineAllOfArrayAllofDogPropertyInner.java | 200 + .../client/model/ArrayOfNumberOnly.java | 180 + .../openapitools/client/model/ArrayOneOf.java | 246 ++ .../openapitools/client/model/ArrayTest.java | 258 ++ .../org/openapitools/client/model/Banana.java | 170 + .../openapitools/client/model/BananaReq.java | 201 + .../openapitools/client/model/BasquePig.java | 168 + .../client/model/Capitalization.java | 323 ++ .../org/openapitools/client/model/Cat.java | 181 + .../openapitools/client/model/Category.java | 199 + .../openapitools/client/model/ClassModel.java | 168 + .../org/openapitools/client/model/Client.java | 168 + .../client/model/ComplexQuadrilateral.java | 199 + .../openapitools/client/model/DanishPig.java | 168 + .../client/model/DeprecatedObject.java | 170 + .../org/openapitools/client/model/Dog.java | 180 + .../openapitools/client/model/Drawing.java | 291 ++ .../openapitools/client/model/EnumArrays.java | 282 ++ .../openapitools/client/model/EnumClass.java | 62 + .../client/model/EnumStringDiscriminator.java | 214 + .../openapitools/client/model/EnumTest.java | 625 +++ .../client/model/EquilateralTriangle.java | 199 + ...akeAnyOfWIthSameErasureGet200Response.java | 209 + ...akeOneOfWIthSameErasureGet200Response.java | 247 ++ .../model/FakeRefParameterPetIdParameter.java | 246 ++ .../client/model/FileSchemaTestClass.java | 211 + .../org/openapitools/client/model/Foo.java | 168 + .../client/model/FooGetDefaultResponse.java | 170 + .../openapitools/client/model/FormatTest.java | 680 ++++ .../client/model/FreeFormObjectTestClass.java | 200 + .../FreeFormObjectTestClassProperties.java | 247 ++ .../org/openapitools/client/model/Fruit.java | 253 ++ .../openapitools/client/model/FruitReq.java | 260 ++ .../openapitools/client/model/GmFruit.java | 215 + .../client/model/GrandparentAnimal.java | 181 + .../client/model/HasOnlyReadOnly.java | 191 + .../client/model/HealthCheckResult.java | 183 + .../client/model/IsoscelesTriangle.java | 199 + .../org/openapitools/client/model/Mammal.java | 332 ++ .../client/model/MammalAnyof.java | 265 ++ .../openapitools/client/model/MapTest.java | 331 ++ ...ropertiesAndAdditionalPropertiesClass.java | 243 ++ .../client/model/Model200Response.java | 200 + .../client/model/ModelApiResponse.java | 231 ++ .../openapitools/client/model/ModelFile.java | 169 + .../openapitools/client/model/ModelList.java | 169 + .../client/model/ModelReturn.java | 169 + .../model/ModelWithOneOfAnyOfProperties.java | 201 + .../org/openapitools/client/model/Name.java | 252 ++ .../model/NestedArrayWithDefaultValues.java | 179 + .../org/openapitools/client/model/NewPet.java | 474 +++ .../model/NewPetCategoryInlineAllof.java | 232 ++ ...etCategoryInlineAllofAllOfCategoryTag.java | 200 + .../client/model/NullableClass.java | 580 +++ .../client/model/NullableEnum.java | 58 + .../client/model/NullableFieldsMapError.java | 199 + .../model/NullableFieldsMapResponse.java | 216 + .../model/NullableFieldsMapSuccess.java | 210 + .../client/model/NullableFieldsValue.java | 199 + .../client/model/NullableShape.java | 284 ++ .../openapitools/client/model/NumberOnly.java | 169 + .../model/ObjectWithDeprecatedFields.java | 289 ++ .../org/openapitools/client/model/Order.java | 362 ++ .../client/model/OuterComposite.java | 231 ++ .../openapitools/client/model/OuterEnum.java | 66 + .../client/model/OuterEnumDefaultValue.java | 62 + .../client/model/OuterEnumInteger.java | 63 + .../model/OuterEnumIntegerDefaultValue.java | 62 + .../openapitools/client/model/ParentPet.java | 149 + .../org/openapitools/client/model/Pet.java | 382 ++ .../client/model/PetComposition.java | 382 ++ .../org/openapitools/client/model/PetRef.java | 382 ++ .../client/model/PetUsingAllOf.java | 382 ++ .../client/model/PetWithRequiredTags.java | 382 ++ .../org/openapitools/client/model/Pig.java | 277 ++ .../client/model/PropertyNameCollision.java | 230 ++ .../client/model/Quadrilateral.java | 277 ++ .../client/model/QuadrilateralInterface.java | 168 + .../client/model/ReadOnlyFirst.java | 197 + .../client/model/RequiredNullableBody.java | 662 ++++ .../org/openapitools/client/model/Scalar.java | 343 ++ .../client/model/ScalarAnyOf.java | 275 ++ .../client/model/ScaleneTriangle.java | 199 + .../org/openapitools/client/model/Shape.java | 277 ++ .../client/model/ShapeInterface.java | 168 + .../client/model/ShapeOrNull.java | 284 ++ .../client/model/SimpleQuadrilateral.java | 199 + .../client/model/SpecialModelName.java | 200 + .../org/openapitools/client/model/Tag.java | 199 + ...neFreeformAdditionalPropertiesRequest.java | 169 + .../openapitools/client/model/Triangle.java | 331 ++ .../client/model/TriangleInterface.java | 168 + .../org/openapitools/client/model/User.java | 524 +++ .../org/openapitools/client/model/Value.java | 247 ++ .../openapitools/client/model/Variable.java | 200 + .../org/openapitools/client/model/Whale.java | 231 ++ .../org/openapitools/client/model/Zebra.java | 238 ++ .../client/api/AnotherFakeApiTest.java | 73 + .../client/api/DefaultApiTest.java | 78 + .../openapitools/client/api/FakeApiTest.java | 395 ++ .../api/FakeClassnameTags123ApiTest.java | 48 + .../openapitools/client/api/PetApiTest.java | 170 + .../openapitools/client/api/StoreApiTest.java | 89 + .../openapitools/client/api/UserApiTest.java | 148 + .../client/api/ValuesApiTest.java | 47 + .../model/AdditionalPropertiesClassTest.java | 107 + ...OfModelArrayAnyOfAllOfAttributesCTest.java | 126 + ...lOfModelArrayAnyOfAllOfAttributesTest.java | 47 + ...delArrayAnyOfAllOfLinkListColumn1Test.java | 50 + ...rayAnyOfAllOfLinkListColumn1ValueTest.java | 148 + .../model/AllOfModelArrayAnyOfTest.java | 71 + .../client/model/AllOfRefToDoubleTest.java | 45 + .../client/model/AllOfRefToFloatTest.java | 45 + .../client/model/AllOfRefToLongTest.java | 45 + .../openapitools/client/model/AnimalTest.java | 56 + .../client/model/AppleReqTest.java | 54 + .../openapitools/client/model/AppleTest.java | 54 + .../client/model/ArrayAnyOfTest.java | 34 + .../client/model/ArrayDefaultTest.java | 56 + .../model/ArrayOfArrayOfNumberOnlyTest.java | 49 + ...neAllOfArrayAllofDogPropertyInnerTest.java | 54 + .../client/model/ArrayOfInlineAllOfTest.java | 65 + .../client/model/ArrayOfNumberOnlyTest.java | 49 + .../client/model/ArrayOneOfTest.java | 34 + .../client/model/ArrayTestTest.java | 65 + .../client/model/BananaReqTest.java | 55 + .../openapitools/client/model/BananaTest.java | 47 + .../client/model/BasquePigTest.java | 45 + .../client/model/CapitalizationTest.java | 85 + .../openapitools/client/model/CatTest.java | 66 + .../client/model/CategoryTest.java | 53 + .../client/model/ClassModelTest.java | 45 + .../openapitools/client/model/ClientTest.java | 45 + .../model/ComplexQuadrilateralTest.java | 53 + .../client/model/DanishPigTest.java | 45 + .../client/model/DeprecatedObjectTest.java | 45 + .../openapitools/client/model/DogTest.java | 65 + .../client/model/DrawingTest.java | 80 + .../client/model/EnumArraysTest.java | 56 + .../client/model/EnumClassTest.java | 31 + .../model/EnumStringDiscriminatorTest.java | 48 + .../client/model/EnumTestTest.java | 118 + .../client/model/EquilateralTriangleTest.java | 53 + ...nyOfWIthSameErasureGet200ResponseTest.java | 35 + ...neOfWIthSameErasureGet200ResponseTest.java | 35 + .../FakeRefParameterPetIdParameterTest.java | 34 + .../client/model/FileSchemaTestClassTest.java | 57 + .../model/FooGetDefaultResponseTest.java | 47 + .../openapitools/client/model/FooTest.java | 45 + .../client/model/FormatTestTest.java | 179 + ...FreeFormObjectTestClassPropertiesTest.java | 35 + .../model/FreeFormObjectTestClassTest.java | 54 + .../client/model/FruitReqTest.java | 73 + .../openapitools/client/model/FruitTest.java | 65 + .../client/model/GmFruitTest.java | 65 + .../client/model/GrandparentAnimalTest.java | 48 + .../client/model/HasOnlyReadOnlyTest.java | 54 + .../client/model/HealthCheckResultTest.java | 49 + .../client/model/IsoscelesTriangleTest.java | 53 + .../client/model/MammalAnyofTest.java | 76 + .../openapitools/client/model/MammalTest.java | 76 + .../client/model/MapTestTest.java | 71 + ...rtiesAndAdditionalPropertiesClassTest.java | 66 + .../client/model/Model200ResponseTest.java | 54 + .../client/model/ModelApiResponseTest.java | 62 + .../client/model/ModelFileTest.java | 46 + .../client/model/ModelListTest.java | 46 + .../client/model/ModelReturnTest.java | 46 + .../ModelWithOneOfAnyOfPropertiesTest.java | 55 + .../openapitools/client/model/NameTest.java | 69 + .../NestedArrayWithDefaultValuesTest.java | 48 + ...tegoryInlineAllofAllOfCategoryTagTest.java | 54 + .../model/NewPetCategoryInlineAllofTest.java | 63 + .../openapitools/client/model/NewPetTest.java | 115 + .../client/model/NullableClassTest.java | 145 + .../client/model/NullableEnumTest.java | 31 + .../model/NullableFieldsMapErrorTest.java | 53 + .../model/NullableFieldsMapResponseTest.java | 66 + .../model/NullableFieldsMapSuccessTest.java | 56 + .../client/model/NullableFieldsValueTest.java | 53 + .../client/model/NullableShapeTest.java | 66 + .../client/model/NumberOnlyTest.java | 46 + .../model/ObjectWithDeprecatedFieldsTest.java | 74 + .../openapitools/client/model/OrderTest.java | 86 + .../client/model/OuterCompositeTest.java | 62 + .../model/OuterEnumDefaultValueTest.java | 31 + .../OuterEnumIntegerDefaultValueTest.java | 31 + .../client/model/OuterEnumIntegerTest.java | 31 + .../client/model/OuterEnumTest.java | 31 + .../client/model/ParentPetTest.java | 49 + .../client/model/PetCompositionTest.java | 90 + .../openapitools/client/model/PetRefTest.java | 90 + .../openapitools/client/model/PetTest.java | 90 + .../client/model/PetUsingAllOfTest.java | 90 + .../client/model/PetWithRequiredTagsTest.java | 90 + .../openapitools/client/model/PigTest.java | 50 + .../model/PropertyNameCollisionTest.java | 61 + .../model/QuadrilateralInterfaceTest.java | 45 + .../client/model/QuadrilateralTest.java | 58 + .../client/model/ReadOnlyFirstTest.java | 53 + .../model/RequiredNullableBodyTest.java | 158 + .../client/model/ScalarAnyOfTest.java | 35 + .../openapitools/client/model/ScalarTest.java | 35 + .../client/model/ScaleneTriangleTest.java | 53 + .../client/model/ShapeInterfaceTest.java | 45 + .../client/model/ShapeOrNullTest.java | 66 + .../openapitools/client/model/ShapeTest.java | 66 + .../client/model/SimpleQuadrilateralTest.java | 53 + .../client/model/SpecialModelNameTest.java | 54 + .../openapitools/client/model/TagTest.java | 53 + ...eeformAdditionalPropertiesRequestTest.java | 46 + .../client/model/TriangleInterfaceTest.java | 45 + .../client/model/TriangleTest.java | 59 + .../openapitools/client/model/UserTest.java | 137 + .../openapitools/client/model/ValueTest.java | 35 + .../client/model/VariableTest.java | 54 + .../openapitools/client/model/WhaleTest.java | 62 + .../openapitools/client/model/ZebraTest.java | 54 + .../okhttp-jsonb/.github/workflows/maven.yml | 30 + .../petstore/java/okhttp-jsonb/.gitignore | 21 + .../okhttp-jsonb/.openapi-generator-ignore | 23 + .../okhttp-jsonb/.openapi-generator/FILES | 401 ++ .../okhttp-jsonb/.openapi-generator/VERSION | 1 + .../petstore/java/okhttp-jsonb/.travis.yml | 22 + .../petstore/java/okhttp-jsonb/README.md | 337 ++ .../java/okhttp-jsonb/api/openapi.yaml | 3332 ++++++++++++++++ .../petstore/java/okhttp-jsonb/build.gradle | 67 + .../petstore/java/okhttp-jsonb/build.sbt | 1 + .../docs/AdditionalPropertiesClass.md | 20 + .../okhttp-jsonb/docs/AllOfModelArrayAnyOf.md | 16 + .../AllOfModelArrayAnyOfAllOfAttributes.md | 13 + .../AllOfModelArrayAnyOfAllOfAttributesC.md | 32 + ...llOfModelArrayAnyOfAllOfLinkListColumn1.md | 13 + ...odelArrayAnyOfAllOfLinkListColumn1Value.md | 25 + .../okhttp-jsonb/docs/AllOfRefToDouble.md | 14 + .../java/okhttp-jsonb/docs/AllOfRefToFloat.md | 14 + .../java/okhttp-jsonb/docs/AllOfRefToLong.md | 14 + .../petstore/java/okhttp-jsonb/docs/Animal.md | 14 + .../java/okhttp-jsonb/docs/AnotherFakeApi.md | 191 + .../petstore/java/okhttp-jsonb/docs/Apple.md | 14 + .../java/okhttp-jsonb/docs/AppleReq.md | 14 + .../java/okhttp-jsonb/docs/ArrayAnyOf.md | 12 + .../java/okhttp-jsonb/docs/ArrayDefault.md | 14 + .../docs/ArrayOfArrayOfNumberOnly.md | 13 + .../okhttp-jsonb/docs/ArrayOfInlineAllOf.md | 15 + ...OfInlineAllOfArrayAllofDogPropertyInner.md | 14 + .../okhttp-jsonb/docs/ArrayOfNumberOnly.md | 13 + .../java/okhttp-jsonb/docs/ArrayOneOf.md | 12 + .../java/okhttp-jsonb/docs/ArrayTest.md | 15 + .../petstore/java/okhttp-jsonb/docs/Banana.md | 13 + .../java/okhttp-jsonb/docs/BananaReq.md | 14 + .../java/okhttp-jsonb/docs/BasquePig.md | 13 + .../java/okhttp-jsonb/docs/Capitalization.md | 18 + .../petstore/java/okhttp-jsonb/docs/Cat.md | 13 + .../java/okhttp-jsonb/docs/Category.md | 14 + .../java/okhttp-jsonb/docs/ClassModel.md | 14 + .../petstore/java/okhttp-jsonb/docs/Client.md | 13 + .../okhttp-jsonb/docs/ComplexQuadrilateral.md | 14 + .../java/okhttp-jsonb/docs/DanishPig.md | 13 + .../java/okhttp-jsonb/docs/DefaultApi.md | 245 ++ .../okhttp-jsonb/docs/DeprecatedObject.md | 13 + .../petstore/java/okhttp-jsonb/docs/Dog.md | 13 + .../java/okhttp-jsonb/docs/Drawing.md | 16 + .../java/okhttp-jsonb/docs/EnumArrays.md | 32 + .../java/okhttp-jsonb/docs/EnumClass.md | 15 + .../docs/EnumStringDiscriminator.md | 23 + .../java/okhttp-jsonb/docs/EnumTest.md | 68 + .../okhttp-jsonb/docs/EquilateralTriangle.md | 14 + .../FakeAnyOfWIthSameErasureGet200Response.md | 12 + .../java/okhttp-jsonb/docs/FakeApi.md | 1571 ++++++++ .../docs/FakeClassnameTags123Api.md | 78 + .../FakeOneOfWIthSameErasureGet200Response.md | 12 + .../docs/FakeRefParameterPetIdParameter.md | 12 + .../okhttp-jsonb/docs/FileSchemaTestClass.md | 14 + .../petstore/java/okhttp-jsonb/docs/Foo.md | 13 + .../docs/FooGetDefaultResponse.md | 13 + .../java/okhttp-jsonb/docs/FormatTest.md | 29 + .../docs/FreeFormObjectTestClass.md | 14 + .../docs/FreeFormObjectTestClassProperties.md | 12 + .../petstore/java/okhttp-jsonb/docs/Fruit.md | 16 + .../java/okhttp-jsonb/docs/FruitReq.md | 16 + .../java/okhttp-jsonb/docs/GmFruit.md | 16 + .../okhttp-jsonb/docs/GrandparentAnimal.md | 13 + .../java/okhttp-jsonb/docs/HasOnlyReadOnly.md | 14 + .../okhttp-jsonb/docs/HealthCheckResult.md | 14 + .../okhttp-jsonb/docs/IsoscelesTriangle.md | 14 + .../petstore/java/okhttp-jsonb/docs/Mammal.md | 26 + .../java/okhttp-jsonb/docs/MammalAnyof.md | 26 + .../java/okhttp-jsonb/docs/MapTest.md | 25 + ...dPropertiesAndAdditionalPropertiesClass.md | 15 + .../okhttp-jsonb/docs/Model200Response.md | 15 + .../okhttp-jsonb/docs/ModelApiResponse.md | 15 + .../java/okhttp-jsonb/docs/ModelFile.md | 14 + .../java/okhttp-jsonb/docs/ModelList.md | 13 + .../java/okhttp-jsonb/docs/ModelReturn.md | 14 + .../docs/ModelWithOneOfAnyOfProperties.md | 14 + .../petstore/java/okhttp-jsonb/docs/Name.md | 17 + .../docs/NestedArrayWithDefaultValues.md | 13 + .../petstore/java/okhttp-jsonb/docs/NewPet.md | 31 + .../docs/NewPetCategoryInlineAllof.md | 15 + ...wPetCategoryInlineAllofAllOfCategoryTag.md | 14 + .../java/okhttp-jsonb/docs/NullableClass.md | 24 + .../java/okhttp-jsonb/docs/NullableEnum.md | 11 + .../docs/NullableFieldsMapError.md | 15 + .../docs/NullableFieldsMapResponse.md | 15 + .../docs/NullableFieldsMapSuccess.md | 15 + .../okhttp-jsonb/docs/NullableFieldsValue.md | 15 + .../java/okhttp-jsonb/docs/NullableShape.md | 16 + .../java/okhttp-jsonb/docs/NumberOnly.md | 13 + .../docs/ObjectWithDeprecatedFields.md | 16 + .../petstore/java/okhttp-jsonb/docs/Order.md | 28 + .../java/okhttp-jsonb/docs/OuterComposite.md | 15 + .../java/okhttp-jsonb/docs/OuterEnum.md | 19 + .../docs/OuterEnumDefaultValue.md | 15 + .../okhttp-jsonb/docs/OuterEnumInteger.md | 15 + .../docs/OuterEnumIntegerDefaultValue.md | 15 + .../java/okhttp-jsonb/docs/ParentPet.md | 12 + .../petstore/java/okhttp-jsonb/docs/Pet.md | 28 + .../petstore/java/okhttp-jsonb/docs/PetApi.md | 640 +++ .../java/okhttp-jsonb/docs/PetComposition.md | 28 + .../petstore/java/okhttp-jsonb/docs/PetRef.md | 28 + .../java/okhttp-jsonb/docs/PetUsingAllOf.md | 28 + .../okhttp-jsonb/docs/PetWithRequiredTags.md | 28 + .../petstore/java/okhttp-jsonb/docs/Pig.md | 13 + .../docs/PropertyNameCollision.md | 15 + .../java/okhttp-jsonb/docs/Quadrilateral.md | 14 + .../docs/QuadrilateralInterface.md | 13 + .../java/okhttp-jsonb/docs/ReadOnlyFirst.md | 14 + .../okhttp-jsonb/docs/RequiredNullableBody.md | 34 + .../petstore/java/okhttp-jsonb/docs/Scalar.md | 13 + .../java/okhttp-jsonb/docs/ScalarAnyOf.md | 13 + .../java/okhttp-jsonb/docs/ScaleneTriangle.md | 14 + .../petstore/java/okhttp-jsonb/docs/Shape.md | 15 + .../java/okhttp-jsonb/docs/ShapeInterface.md | 13 + .../java/okhttp-jsonb/docs/ShapeOrNull.md | 16 + .../okhttp-jsonb/docs/SimpleQuadrilateral.md | 14 + .../okhttp-jsonb/docs/SpecialModelName.md | 14 + .../java/okhttp-jsonb/docs/StoreApi.md | 266 ++ .../petstore/java/okhttp-jsonb/docs/Tag.md | 14 + ...lineFreeformAdditionalPropertiesRequest.md | 13 + .../java/okhttp-jsonb/docs/Triangle.md | 14 + .../okhttp-jsonb/docs/TriangleInterface.md | 13 + .../petstore/java/okhttp-jsonb/docs/User.md | 24 + .../java/okhttp-jsonb/docs/UserApi.md | 511 +++ .../petstore/java/okhttp-jsonb/docs/Value.md | 12 + .../java/okhttp-jsonb/docs/ValuesApi.md | 68 + .../java/okhttp-jsonb/docs/Variable.md | 15 + .../petstore/java/okhttp-jsonb/docs/Whale.md | 15 + .../petstore/java/okhttp-jsonb/docs/Zebra.md | 24 + .../petstore/java/okhttp-jsonb/git_push.sh | 57 + .../java/okhttp-jsonb/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../client/petstore/java/okhttp-jsonb/gradlew | 249 ++ .../petstore/java/okhttp-jsonb/gradlew.bat | 92 + .../client/petstore/java/okhttp-jsonb/pom.xml | 301 ++ .../java/okhttp-jsonb/settings.gradle | 1 + .../okhttp-jsonb/src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1801 +++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 181 + .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../client/api/AnotherFakeApi.java | 457 +++ .../openapitools/client/api/DefaultApi.java | 562 +++ .../org/openapitools/client/api/FakeApi.java | 3456 ++++++++++++++++ .../client/api/FakeClassnameTags123Api.java | 204 + .../org/openapitools/client/api/PetApi.java | 1328 +++++++ .../org/openapitools/client/api/StoreApi.java | 592 +++ .../org/openapitools/client/api/UserApi.java | 1104 ++++++ .../openapitools/client/api/ValuesApi.java | 198 + .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../org/openapitools/client/auth/OAuth.java | 43 + .../openapitools/client/auth/OAuthFlow.java | 25 + .../client/auth/OAuthOkHttpClient.java | 82 + .../client/auth/RetryingOAuth.java | 223 ++ .../client/model/AbstractOpenApiSchema.java | 142 + .../model/AdditionalPropertiesClass.java | 380 ++ .../client/model/AllOfModelArrayAnyOf.java | 232 ++ .../AllOfModelArrayAnyOfAllOfAttributes.java | 153 + .../AllOfModelArrayAnyOfAllOfAttributesC.java | 136 + ...OfModelArrayAnyOfAllOfLinkListColumn1.java | 164 + ...elArrayAnyOfAllOfLinkListColumn1Value.java | 131 + .../client/model/AllOfRefToDouble.java | 152 + .../client/model/AllOfRefToFloat.java | 152 + .../client/model/AllOfRefToLong.java | 152 + .../org/openapitools/client/model/Animal.java | 179 + .../org/openapitools/client/model/Apple.java | 178 + .../openapitools/client/model/AppleReq.java | 178 + .../openapitools/client/model/ArrayAnyOf.java | 129 + .../client/model/ArrayDefault.java | 197 + .../model/ArrayOfArrayOfNumberOnly.java | 164 + .../client/model/ArrayOfInlineAllOf.java | 216 + ...InlineAllOfArrayAllofDogPropertyInner.java | 178 + .../client/model/ArrayOfNumberOnly.java | 164 + .../openapitools/client/model/ArrayOneOf.java | 129 + .../openapitools/client/model/ArrayTest.java | 232 ++ .../org/openapitools/client/model/Banana.java | 153 + .../openapitools/client/model/BananaReq.java | 179 + .../openapitools/client/model/BasquePig.java | 152 + .../client/model/Capitalization.java | 282 ++ .../org/openapitools/client/model/Cat.java | 156 + .../openapitools/client/model/Category.java | 178 + .../openapitools/client/model/ClassModel.java | 152 + .../org/openapitools/client/model/Client.java | 152 + .../client/model/ComplexQuadrilateral.java | 178 + .../openapitools/client/model/DanishPig.java | 152 + .../client/model/DeprecatedObject.java | 154 + .../org/openapitools/client/model/Dog.java | 155 + .../openapitools/client/model/Drawing.java | 257 ++ .../openapitools/client/model/EnumArrays.java | 261 ++ .../openapitools/client/model/EnumClass.java | 62 + .../client/model/EnumStringDiscriminator.java | 189 + .../openapitools/client/model/EnumTest.java | 565 +++ .../client/model/EquilateralTriangle.java | 178 + ...akeAnyOfWIthSameErasureGet200Response.java | 129 + ...akeOneOfWIthSameErasureGet200Response.java | 129 + .../model/FakeRefParameterPetIdParameter.java | 128 + .../client/model/FileSchemaTestClass.java | 190 + .../org/openapitools/client/model/Foo.java | 152 + .../client/model/FooGetDefaultResponse.java | 153 + .../openapitools/client/model/FormatTest.java | 583 +++ .../client/model/FreeFormObjectTestClass.java | 179 + .../FreeFormObjectTestClassProperties.java | 129 + .../org/openapitools/client/model/Fruit.java | 131 + .../openapitools/client/model/FruitReq.java | 136 + .../openapitools/client/model/GmFruit.java | 131 + .../client/model/GrandparentAnimal.java | 153 + .../client/model/HasOnlyReadOnly.java | 171 + .../client/model/HealthCheckResult.java | 164 + .../client/model/IsoscelesTriangle.java | 178 + .../org/openapitools/client/model/Mammal.java | 153 + .../client/model/MammalAnyof.java | 153 + .../openapitools/client/model/MapTest.java | 300 ++ ...ropertiesAndAdditionalPropertiesClass.java | 217 ++ .../client/model/Model200Response.java | 178 + .../client/model/ModelApiResponse.java | 204 + .../openapitools/client/model/ModelFile.java | 152 + .../openapitools/client/model/ModelList.java | 152 + .../client/model/ModelReturn.java | 152 + .../model/ModelWithOneOfAnyOfProperties.java | 180 + .../org/openapitools/client/model/Name.java | 223 ++ .../model/NestedArrayWithDefaultValues.java | 163 + .../org/openapitools/client/model/NewPet.java | 419 ++ .../model/NewPetCategoryInlineAllof.java | 205 + ...etCategoryInlineAllofAllOfCategoryTag.java | 178 + .../client/model/NullableClass.java | 506 +++ .../client/model/NullableEnum.java | 58 + .../client/model/NullableFieldsMapError.java | 178 + .../model/NullableFieldsMapResponse.java | 133 + .../model/NullableFieldsMapSuccess.java | 189 + .../client/model/NullableFieldsValue.java | 178 + .../client/model/NullableShape.java | 135 + .../openapitools/client/model/NumberOnly.java | 153 + .../model/ObjectWithDeprecatedFields.java | 258 ++ .../org/openapitools/client/model/Order.java | 321 ++ .../client/model/OuterComposite.java | 205 + .../openapitools/client/model/OuterEnum.java | 66 + .../client/model/OuterEnumDefaultValue.java | 62 + .../client/model/OuterEnumInteger.java | 63 + .../model/OuterEnumIntegerDefaultValue.java | 62 + .../openapitools/client/model/ParentPet.java | 129 + .../org/openapitools/client/model/Pet.java | 341 ++ .../client/model/PetComposition.java | 341 ++ .../org/openapitools/client/model/PetRef.java | 341 ++ .../client/model/PetUsingAllOf.java | 341 ++ .../client/model/PetWithRequiredTags.java | 341 ++ .../org/openapitools/client/model/Pig.java | 130 + .../client/model/PropertyNameCollision.java | 204 + .../client/model/Quadrilateral.java | 130 + .../client/model/QuadrilateralInterface.java | 152 + .../client/model/ReadOnlyFirst.java | 177 + .../client/model/RequiredNullableBody.java | 581 +++ .../org/openapitools/client/model/Scalar.java | 174 + .../client/model/ScalarAnyOf.java | 174 + .../client/model/ScaleneTriangle.java | 178 + .../org/openapitools/client/model/Shape.java | 130 + .../client/model/ShapeInterface.java | 152 + .../client/model/ShapeOrNull.java | 135 + .../client/model/SimpleQuadrilateral.java | 178 + .../client/model/SpecialModelName.java | 178 + .../org/openapitools/client/model/Tag.java | 178 + ...neFreeformAdditionalPropertiesRequest.java | 152 + .../openapitools/client/model/Triangle.java | 153 + .../client/model/TriangleInterface.java | 152 + .../org/openapitools/client/model/User.java | 450 +++ .../org/openapitools/client/model/Value.java | 130 + .../openapitools/client/model/Variable.java | 179 + .../org/openapitools/client/model/Whale.java | 204 + .../org/openapitools/client/model/Zebra.java | 216 + .../client/api/AnotherFakeApiTest.java | 73 + .../client/api/DefaultApiTest.java | 78 + .../openapitools/client/api/FakeApiTest.java | 395 ++ .../api/FakeClassnameTags123ApiTest.java | 48 + .../openapitools/client/api/PetApiTest.java | 170 + .../openapitools/client/api/StoreApiTest.java | 89 + .../openapitools/client/api/UserApiTest.java | 148 + .../client/api/ValuesApiTest.java | 47 + .../model/AdditionalPropertiesClassTest.java | 100 + ...OfModelArrayAnyOfAllOfAttributesCTest.java | 121 + ...lOfModelArrayAnyOfAllOfAttributesTest.java | 42 + ...delArrayAnyOfAllOfLinkListColumn1Test.java | 45 + ...rayAnyOfAllOfLinkListColumn1ValueTest.java | 140 + .../model/AllOfModelArrayAnyOfTest.java | 67 + .../client/model/AllOfRefToDoubleTest.java | 41 + .../client/model/AllOfRefToFloatTest.java | 41 + .../client/model/AllOfRefToLongTest.java | 41 + .../openapitools/client/model/AnimalTest.java | 49 + .../client/model/AppleReqTest.java | 49 + .../openapitools/client/model/AppleTest.java | 49 + .../client/model/ArrayAnyOfTest.java | 34 + .../client/model/ArrayDefaultTest.java | 52 + .../model/ArrayOfArrayOfNumberOnlyTest.java | 45 + ...neAllOfArrayAllofDogPropertyInnerTest.java | 49 + .../client/model/ArrayOfInlineAllOfTest.java | 61 + .../client/model/ArrayOfNumberOnlyTest.java | 45 + .../client/model/ArrayOneOfTest.java | 34 + .../client/model/ArrayTestTest.java | 61 + .../client/model/BananaReqTest.java | 50 + .../openapitools/client/model/BananaTest.java | 42 + .../client/model/BasquePigTest.java | 41 + .../client/model/CapitalizationTest.java | 81 + .../openapitools/client/model/CatTest.java | 59 + .../client/model/CategoryTest.java | 49 + .../client/model/ClassModelTest.java | 41 + .../openapitools/client/model/ClientTest.java | 41 + .../model/ComplexQuadrilateralTest.java | 49 + .../client/model/DanishPigTest.java | 41 + .../client/model/DeprecatedObjectTest.java | 41 + .../openapitools/client/model/DogTest.java | 58 + .../client/model/DrawingTest.java | 73 + .../client/model/EnumArraysTest.java | 52 + .../client/model/EnumClassTest.java | 31 + .../model/EnumStringDiscriminatorTest.java | 41 + .../client/model/EnumTestTest.java | 110 + .../client/model/EquilateralTriangleTest.java | 49 + ...nyOfWIthSameErasureGet200ResponseTest.java | 34 + ...neOfWIthSameErasureGet200ResponseTest.java | 34 + .../FakeRefParameterPetIdParameterTest.java | 33 + .../client/model/FileSchemaTestClassTest.java | 53 + .../model/FooGetDefaultResponseTest.java | 42 + .../openapitools/client/model/FooTest.java | 41 + .../client/model/FormatTestTest.java | 174 + ...FreeFormObjectTestClassPropertiesTest.java | 34 + .../model/FreeFormObjectTestClassTest.java | 50 + .../client/model/FruitReqTest.java | 68 + .../openapitools/client/model/FruitTest.java | 60 + .../client/model/GmFruitTest.java | 60 + .../client/model/GrandparentAnimalTest.java | 41 + .../client/model/HasOnlyReadOnlyTest.java | 49 + .../client/model/HealthCheckResultTest.java | 42 + .../client/model/IsoscelesTriangleTest.java | 49 + .../client/model/MammalAnyofTest.java | 68 + .../openapitools/client/model/MammalTest.java | 68 + .../client/model/MapTestTest.java | 67 + ...rtiesAndAdditionalPropertiesClassTest.java | 62 + .../client/model/Model200ResponseTest.java | 49 + .../client/model/ModelApiResponseTest.java | 57 + .../client/model/ModelFileTest.java | 41 + .../client/model/ModelListTest.java | 41 + .../client/model/ModelReturnTest.java | 41 + .../ModelWithOneOfAnyOfPropertiesTest.java | 51 + .../openapitools/client/model/NameTest.java | 65 + .../NestedArrayWithDefaultValuesTest.java | 44 + ...tegoryInlineAllofAllOfCategoryTagTest.java | 49 + .../model/NewPetCategoryInlineAllofTest.java | 58 + .../openapitools/client/model/NewPetTest.java | 111 + .../client/model/NullableClassTest.java | 138 + .../client/model/NullableEnumTest.java | 31 + .../model/NullableFieldsMapErrorTest.java | 49 + .../model/NullableFieldsMapResponseTest.java | 62 + .../model/NullableFieldsMapSuccessTest.java | 52 + .../client/model/NullableFieldsValueTest.java | 49 + .../client/model/NullableShapeTest.java | 59 + .../client/model/NumberOnlyTest.java | 42 + .../model/ObjectWithDeprecatedFieldsTest.java | 70 + .../openapitools/client/model/OrderTest.java | 82 + .../client/model/OuterCompositeTest.java | 58 + .../model/OuterEnumDefaultValueTest.java | 31 + .../OuterEnumIntegerDefaultValueTest.java | 31 + .../client/model/OuterEnumIntegerTest.java | 31 + .../client/model/OuterEnumTest.java | 31 + .../client/model/ParentPetTest.java | 42 + .../client/model/PetCompositionTest.java | 86 + .../openapitools/client/model/PetRefTest.java | 86 + .../openapitools/client/model/PetTest.java | 86 + .../client/model/PetUsingAllOfTest.java | 86 + .../client/model/PetWithRequiredTagsTest.java | 86 + .../openapitools/client/model/PigTest.java | 43 + .../model/PropertyNameCollisionTest.java | 57 + .../model/QuadrilateralInterfaceTest.java | 41 + .../client/model/QuadrilateralTest.java | 51 + .../client/model/ReadOnlyFirstTest.java | 49 + .../model/RequiredNullableBodyTest.java | 154 + .../client/model/ScalarAnyOfTest.java | 35 + .../openapitools/client/model/ScalarTest.java | 35 + .../client/model/ScaleneTriangleTest.java | 49 + .../client/model/ShapeInterfaceTest.java | 41 + .../client/model/ShapeOrNullTest.java | 59 + .../openapitools/client/model/ShapeTest.java | 59 + .../client/model/SimpleQuadrilateralTest.java | 49 + .../client/model/SpecialModelNameTest.java | 49 + .../openapitools/client/model/TagTest.java | 49 + ...eeformAdditionalPropertiesRequestTest.java | 41 + .../client/model/TriangleInterfaceTest.java | 41 + .../client/model/TriangleTest.java | 52 + .../openapitools/client/model/UserTest.java | 130 + .../openapitools/client/model/ValueTest.java | 35 + .../client/model/VariableTest.java | 50 + .../openapitools/client/model/WhaleTest.java | 57 + .../openapitools/client/model/ZebraTest.java | 49 + .../.github/workflows/maven.yml | 30 + .../petstore/java/okhttp-jspecify/.gitignore | 21 + .../okhttp-jspecify/.openapi-generator-ignore | 23 + .../okhttp-jspecify/.openapi-generator/FILES | 43 + .../.openapi-generator/VERSION | 1 + .../petstore/java/okhttp-jspecify/.travis.yml | 22 + .../petstore/java/okhttp-jspecify/README.md | 139 + .../java/okhttp-jspecify/api/openapi.yaml | 119 + .../java/okhttp-jspecify/build.gradle | 63 + .../petstore/java/okhttp-jspecify/build.sbt | 1 + .../java/okhttp-jspecify/docs/DefaultApi.md | 193 + .../petstore/java/okhttp-jspecify/docs/Foo.md | 18 + .../petstore/java/okhttp-jspecify/git_push.sh | 57 + .../java/okhttp-jspecify/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../petstore/java/okhttp-jspecify/gradlew | 249 ++ .../petstore/java/okhttp-jspecify/gradlew.bat | 92 + .../petstore/java/okhttp-jspecify/pom.xml | 278 ++ .../java/okhttp-jspecify/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1631 ++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 440 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../openapitools/client/api/DefaultApi.java | 467 +++ .../openapitools/client/api/package-info.java | 2 + .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../client/model/AbstractOpenApiSchema.java | 142 + .../org/openapitools/client/model/Foo.java | 454 +++ .../client/model/package-info.java | 2 + .../org/openapitools/client/package-info.java | 2 + .../client/api/DefaultApiTest.java | 69 + .../openapitools/client/model/FooTest.java | 94 + .../.github/workflows/maven.yml | 30 + .../java/okhttp-nullable-required/.gitignore | 21 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 71 + .../.openapi-generator/VERSION | 1 + .../java/okhttp-nullable-required/.travis.yml | 22 + .../java/okhttp-nullable-required/README.md | 192 + .../okhttp-nullable-required/api/openapi.yaml | 940 +++++ .../okhttp-nullable-required/build.gradle | 64 + .../java/okhttp-nullable-required/build.sbt | 1 + .../okhttp-nullable-required/docs/Category.md | 15 + .../docs/ModelApiResponse.md | 16 + .../okhttp-nullable-required/docs/Order.md | 29 + .../java/okhttp-nullable-required/docs/Pet.md | 29 + .../okhttp-nullable-required/docs/PetApi.md | 566 +++ .../docs/PetWithRequiredNullableCases1.md | 29 + .../docs/PetWithRequiredNullableCases2.md | 29 + .../okhttp-nullable-required/docs/StoreApi.md | 266 ++ .../java/okhttp-nullable-required/docs/Tag.md | 15 + .../okhttp-nullable-required/docs/User.md | 21 + .../okhttp-nullable-required/docs/UserApi.md | 553 +++ .../java/okhttp-nullable-required/git_push.sh | 57 + .../gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../java/okhttp-nullable-required/gradlew | 249 ++ .../java/okhttp-nullable-required/gradlew.bat | 92 + .../java/okhttp-nullable-required/pom.xml | 284 ++ .../okhttp-nullable-required/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1730 +++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 447 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../org/openapitools/client/api/PetApi.java | 1169 ++++++ .../org/openapitools/client/api/StoreApi.java | 593 +++ .../org/openapitools/client/api/UserApi.java | 1105 ++++++ .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../org/openapitools/client/auth/OAuth.java | 43 + .../openapitools/client/auth/OAuthFlow.java | 25 + .../client/auth/OAuthOkHttpClient.java | 82 + .../client/auth/RetryingOAuth.java | 223 ++ .../client/model/AbstractOpenApiSchema.java | 142 + .../openapitools/client/model/Category.java | 311 ++ .../client/model/ModelApiResponse.java | 341 ++ .../org/openapitools/client/model/Order.java | 478 +++ .../org/openapitools/client/model/Pet.java | 537 +++ .../model/PetWithRequiredNullableCases1.java | 549 +++ .../model/PetWithRequiredNullableCases2.java | 537 +++ .../org/openapitools/client/model/Tag.java | 311 ++ .../org/openapitools/client/model/User.java | 488 +++ .../openapitools/client/api/PetApiTest.java | 153 + .../openapitools/client/api/StoreApiTest.java | 89 + .../openapitools/client/api/UserApiTest.java | 148 + .../client/model/CategoryTest.java | 55 + .../client/model/ModelApiResponseTest.java | 63 + .../openapitools/client/model/OrderTest.java | 88 + .../openapitools/client/model/PetTest.java | 92 + .../PetWithRequiredNullableCases1Test.java | 93 + .../PetWithRequiredNullableCases2Test.java | 92 + .../openapitools/client/model/TagTest.java | 55 + .../openapitools/client/model/UserTest.java | 103 + .../.github/workflows/maven.yml | 30 + .../java/okhttp-parcelableModel/.gitignore | 21 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 191 + .../.openapi-generator/VERSION | 1 + .../java/okhttp-parcelableModel/.travis.yml | 22 + .../java/okhttp-parcelableModel/README.md | 248 ++ .../okhttp-parcelableModel/api/openapi.yaml | 2255 +++++++++++ .../java/okhttp-parcelableModel/build.gradle | 64 + .../java/okhttp-parcelableModel/build.sbt | 1 + .../docs/AdditionalPropertiesAnyType.md | 17 + .../docs/AdditionalPropertiesArray.md | 17 + .../docs/AdditionalPropertiesBoolean.md | 17 + .../docs/AdditionalPropertiesClass.md | 27 + .../docs/AdditionalPropertiesInteger.md | 17 + .../docs/AdditionalPropertiesNumber.md | 17 + .../docs/AdditionalPropertiesObject.md | 17 + .../docs/AdditionalPropertiesString.md | 17 + .../okhttp-parcelableModel/docs/Animal.md | 18 + .../docs/AnotherFakeApi.md | 73 + .../docs/ArrayOfArrayOfNumberOnly.md | 17 + .../docs/ArrayOfNumberOnly.md | 17 + .../okhttp-parcelableModel/docs/ArrayTest.md | 19 + .../okhttp-parcelableModel/docs/BigCat.md | 28 + .../docs/Capitalization.md | 22 + .../java/okhttp-parcelableModel/docs/Cat.md | 17 + .../okhttp-parcelableModel/docs/Category.md | 18 + .../okhttp-parcelableModel/docs/ClassModel.md | 18 + .../okhttp-parcelableModel/docs/Client.md | 17 + .../java/okhttp-parcelableModel/docs/Dog.md | 17 + .../okhttp-parcelableModel/docs/EnumArrays.md | 36 + .../okhttp-parcelableModel/docs/EnumClass.md | 15 + .../okhttp-parcelableModel/docs/EnumTest.md | 59 + .../okhttp-parcelableModel/docs/FakeApi.md | 949 +++++ .../docs/FakeClassnameTags123Api.md | 78 + .../docs/FileSchemaTestClass.md | 18 + .../okhttp-parcelableModel/docs/FormatTest.md | 30 + .../docs/HasOnlyReadOnly.md | 18 + .../okhttp-parcelableModel/docs/MapTest.md | 29 + ...dPropertiesAndAdditionalPropertiesClass.md | 19 + .../docs/Model200Response.md | 19 + .../docs/ModelApiResponse.md | 19 + .../okhttp-parcelableModel/docs/ModelFile.md | 18 + .../okhttp-parcelableModel/docs/ModelList.md | 17 + .../docs/ModelReturn.md | 18 + .../java/okhttp-parcelableModel/docs/Name.md | 21 + .../okhttp-parcelableModel/docs/NumberOnly.md | 17 + .../java/okhttp-parcelableModel/docs/Order.md | 32 + .../docs/OuterComposite.md | 19 + .../okhttp-parcelableModel/docs/OuterEnum.md | 15 + .../java/okhttp-parcelableModel/docs/Pet.md | 32 + .../okhttp-parcelableModel/docs/PetApi.md | 629 +++ .../docs/ReadOnlyFirst.md | 18 + .../docs/SpecialModelName.md | 17 + .../okhttp-parcelableModel/docs/StoreApi.md | 264 ++ .../java/okhttp-parcelableModel/docs/Tag.md | 18 + .../docs/TypeHolderDefault.md | 21 + .../docs/TypeHolderExample.md | 22 + .../java/okhttp-parcelableModel/docs/User.md | 24 + .../okhttp-parcelableModel/docs/UserApi.md | 501 +++ .../okhttp-parcelableModel/docs/XmlItem.md | 45 + .../java/okhttp-parcelableModel/git_push.sh | 57 + .../okhttp-parcelableModel/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../java/okhttp-parcelableModel/gradlew | 249 ++ .../java/okhttp-parcelableModel/gradlew.bat | 92 + .../java/okhttp-parcelableModel/pom.xml | 284 ++ .../okhttp-parcelableModel/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1733 +++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 520 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../client/api/AnotherFakeApi.java | 220 ++ .../org/openapitools/client/api/FakeApi.java | 2191 +++++++++++ .../client/api/FakeClassnameTags123Api.java | 205 + .../org/openapitools/client/api/PetApi.java | 1333 +++++++ .../org/openapitools/client/api/StoreApi.java | 592 +++ .../org/openapitools/client/api/UserApi.java | 1101 ++++++ .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../org/openapitools/client/auth/OAuth.java | 43 + .../openapitools/client/auth/OAuthFlow.java | 25 + .../client/auth/OAuthOkHttpClient.java | 82 + .../client/auth/RetryingOAuth.java | 223 ++ .../client/model/AbstractOpenApiSchema.java | 142 + .../model/AdditionalPropertiesAnyType.java | 307 ++ .../model/AdditionalPropertiesArray.java | 308 ++ .../model/AdditionalPropertiesBoolean.java | 307 ++ .../model/AdditionalPropertiesClass.java | 662 ++++ .../model/AdditionalPropertiesInteger.java | 307 ++ .../model/AdditionalPropertiesNumber.java | 308 ++ .../model/AdditionalPropertiesObject.java | 308 ++ .../model/AdditionalPropertiesString.java | 307 ++ .../org/openapitools/client/model/Animal.java | 277 ++ .../model/ArrayOfArrayOfNumberOnly.java | 320 ++ .../client/model/ArrayOfNumberOnly.java | 320 ++ .../openapitools/client/model/ArrayTest.java | 402 ++ .../org/openapitools/client/model/BigCat.java | 373 ++ .../client/model/Capitalization.java | 467 +++ .../org/openapitools/client/model/Cat.java | 248 ++ .../openapitools/client/model/Category.java | 343 ++ .../openapitools/client/model/ClassModel.java | 307 ++ .../org/openapitools/client/model/Client.java | 307 ++ .../org/openapitools/client/model/Dog.java | 317 ++ .../openapitools/client/model/EnumArrays.java | 459 +++ .../openapitools/client/model/EnumClass.java | 82 + .../openapitools/client/model/EnumTest.java | 664 ++++ .../client/model/FileSchemaTestClass.java | 363 ++ .../openapitools/client/model/FormatTest.java | 712 ++++ .../client/model/HasOnlyReadOnly.java | 332 ++ .../openapitools/client/model/MapTest.java | 477 +++ ...ropertiesAndAdditionalPropertiesClass.java | 378 ++ .../client/model/Model200Response.java | 336 ++ .../client/model/ModelApiResponse.java | 368 ++ .../openapitools/client/model/ModelFile.java | 307 ++ .../openapitools/client/model/ModelList.java | 307 ++ .../client/model/ModelReturn.java | 304 ++ .../org/openapitools/client/model/Name.java | 394 ++ .../openapitools/client/model/NumberOnly.java | 305 ++ .../org/openapitools/client/model/Order.java | 511 +++ .../client/model/OuterComposite.java | 366 ++ .../openapitools/client/model/OuterEnum.java | 82 + .../org/openapitools/client/model/Pet.java | 567 +++ .../client/model/ReadOnlyFirst.java | 338 ++ .../client/model/SpecialModelName.java | 304 ++ .../org/openapitools/client/model/Tag.java | 336 ++ .../client/model/TypeHolderDefault.java | 448 +++ .../client/model/TypeHolderExample.java | 477 +++ .../org/openapitools/client/model/User.java | 525 +++ .../openapitools/client/model/XmlItem.java | 1243 ++++++ .../client/api/AnotherFakeApiTest.java | 50 + .../openapitools/client/api/FakeApiTest.java | 253 ++ .../api/FakeClassnameTags123ApiTest.java | 48 + .../openapitools/client/api/PetApiTest.java | 158 + .../openapitools/client/api/StoreApiTest.java | 87 + .../openapitools/client/api/UserApiTest.java | 138 + .../AdditionalPropertiesAnyTypeTest.java | 47 + .../model/AdditionalPropertiesArrayTest.java | 48 + .../AdditionalPropertiesBooleanTest.java | 47 + .../model/AdditionalPropertiesClassTest.java | 131 + .../AdditionalPropertiesIntegerTest.java | 47 + .../model/AdditionalPropertiesNumberTest.java | 48 + .../model/AdditionalPropertiesObjectTest.java | 48 + .../model/AdditionalPropertiesStringTest.java | 47 + .../openapitools/client/model/AnimalTest.java | 55 + .../model/ArrayOfArrayOfNumberOnlyTest.java | 51 + .../client/model/ArrayOfNumberOnlyTest.java | 51 + .../client/model/ArrayTestTest.java | 67 + .../openapitools/client/model/BigCatTest.java | 72 + .../client/model/CapitalizationTest.java | 87 + .../openapitools/client/model/CatTest.java | 64 + .../client/model/CategoryTest.java | 55 + .../client/model/ClassModelTest.java | 47 + .../openapitools/client/model/ClientTest.java | 47 + .../openapitools/client/model/DogTest.java | 64 + .../client/model/EnumArraysTest.java | 58 + .../client/model/EnumClassTest.java | 32 + .../client/model/EnumTestTest.java | 80 + .../client/model/FileSchemaTestClassTest.java | 59 + .../client/model/FormatTestTest.java | 156 + .../client/model/HasOnlyReadOnlyTest.java | 55 + .../client/model/MapTestTest.java | 73 + ...rtiesAndAdditionalPropertiesClassTest.java | 68 + .../client/model/Model200ResponseTest.java | 55 + .../client/model/ModelApiResponseTest.java | 63 + .../client/model/ModelFileTest.java | 47 + .../client/model/ModelListTest.java | 47 + .../client/model/ModelReturnTest.java | 47 + .../openapitools/client/model/NameTest.java | 71 + .../client/model/NumberOnlyTest.java | 48 + .../openapitools/client/model/OrderTest.java | 88 + .../client/model/OuterCompositeTest.java | 64 + .../client/model/OuterEnumTest.java | 32 + .../openapitools/client/model/PetTest.java | 94 + .../client/model/ReadOnlyFirstTest.java | 55 + .../client/model/SpecialModelNameTest.java | 47 + .../openapitools/client/model/TagTest.java | 55 + .../client/model/TypeHolderDefaultTest.java | 83 + .../client/model/TypeHolderExampleTest.java | 91 + .../openapitools/client/model/UserTest.java | 103 + .../client/model/XmlItemTest.java | 275 ++ .../.github/workflows/maven.yml | 30 + .../petstore/java/okhttp-swagger1/.gitignore | 21 + .../okhttp-swagger1/.openapi-generator-ignore | 23 + .../okhttp-swagger1/.openapi-generator/FILES | 59 + .../.openapi-generator/VERSION | 1 + .../petstore/java/okhttp-swagger1/.travis.yml | 22 + .../petstore/java/okhttp-swagger1/README.md | 184 + .../java/okhttp-swagger1/api/openapi.yaml | 870 +++++ .../java/okhttp-swagger1/build.gradle | 66 + .../petstore/java/okhttp-swagger1/build.sbt | 1 + .../java/okhttp-swagger1/docs/Category.md | 15 + .../java/okhttp-swagger1/docs/CommonApi.md | 1373 +++++++ .../okhttp-swagger1/docs/ModelApiResponse.md | 16 + .../java/okhttp-swagger1/docs/Order.md | 29 + .../petstore/java/okhttp-swagger1/docs/Pet.md | 29 + .../petstore/java/okhttp-swagger1/docs/Tag.md | 15 + .../java/okhttp-swagger1/docs/User.md | 21 + .../petstore/java/okhttp-swagger1/git_push.sh | 57 + .../java/okhttp-swagger1/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../petstore/java/okhttp-swagger1/gradlew | 249 ++ .../petstore/java/okhttp-swagger1/gradlew.bat | 92 + .../petstore/java/okhttp-swagger1/pom.xml | 290 ++ .../java/okhttp-swagger1/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1727 ++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 445 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../openapitools/client/api/CommonApi.java | 2749 +++++++++++++ .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../org/openapitools/client/auth/OAuth.java | 43 + .../openapitools/client/auth/OAuthFlow.java | 25 + .../client/auth/OAuthOkHttpClient.java | 82 + .../client/auth/RetryingOAuth.java | 223 ++ .../client/model/AbstractOpenApiSchema.java | 142 + .../openapitools/client/model/Category.java | 316 ++ .../client/model/ModelApiResponse.java | 347 ++ .../org/openapitools/client/model/Order.java | 487 +++ .../org/openapitools/client/model/Pet.java | 546 +++ .../org/openapitools/client/model/Tag.java | 316 ++ .../org/openapitools/client/model/User.java | 499 +++ .../client/api/CommonApiTest.java | 324 ++ .../client/model/CategoryTest.java | 57 + .../client/model/ModelApiResponseTest.java | 65 + .../openapitools/client/model/OrderTest.java | 90 + .../openapitools/client/model/PetTest.java | 94 + .../openapitools/client/model/TagTest.java | 57 + .../openapitools/client/model/UserTest.java | 105 + .../.github/workflows/maven.yml | 30 + .../petstore/java/okhttp-swagger2/.gitignore | 21 + .../okhttp-swagger2/.openapi-generator-ignore | 23 + .../okhttp-swagger2/.openapi-generator/FILES | 65 + .../.openapi-generator/VERSION | 1 + .../petstore/java/okhttp-swagger2/.travis.yml | 22 + .../petstore/java/okhttp-swagger2/README.md | 184 + .../java/okhttp-swagger2/api/openapi.yaml | 870 +++++ .../java/okhttp-swagger2/build.gradle | 66 + .../petstore/java/okhttp-swagger2/build.sbt | 1 + .../java/okhttp-swagger2/docs/Category.md | 15 + .../okhttp-swagger2/docs/ModelApiResponse.md | 16 + .../java/okhttp-swagger2/docs/Order.md | 29 + .../petstore/java/okhttp-swagger2/docs/Pet.md | 29 + .../java/okhttp-swagger2/docs/PetApi.md | 570 +++ .../java/okhttp-swagger2/docs/StoreApi.md | 266 ++ .../petstore/java/okhttp-swagger2/docs/Tag.md | 15 + .../java/okhttp-swagger2/docs/User.md | 21 + .../java/okhttp-swagger2/docs/UserApi.md | 553 +++ .../petstore/java/okhttp-swagger2/git_push.sh | 57 + .../java/okhttp-swagger2/gradle.properties | 6 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + .../petstore/java/okhttp-swagger2/gradlew | 249 ++ .../petstore/java/okhttp-swagger2/gradlew.bat | 92 + .../petstore/java/okhttp-swagger2/pom.xml | 290 ++ .../java/okhttp-swagger2/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1727 ++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 445 +++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../org/openapitools/client/api/PetApi.java | 1201 ++++++ .../org/openapitools/client/api/StoreApi.java | 593 +++ .../org/openapitools/client/api/UserApi.java | 1105 ++++++ .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../org/openapitools/client/auth/OAuth.java | 43 + .../openapitools/client/auth/OAuthFlow.java | 25 + .../client/auth/OAuthOkHttpClient.java | 82 + .../client/auth/RetryingOAuth.java | 223 ++ .../client/model/AbstractOpenApiSchema.java | 142 + .../openapitools/client/model/Category.java | 315 ++ .../client/model/ModelApiResponse.java | 346 ++ .../org/openapitools/client/model/Order.java | 486 +++ .../org/openapitools/client/model/Pet.java | 545 +++ .../org/openapitools/client/model/Tag.java | 315 ++ .../org/openapitools/client/model/User.java | 498 +++ .../openapitools/client/api/PetApiTest.java | 153 + .../openapitools/client/api/StoreApiTest.java | 89 + .../openapitools/client/api/UserApiTest.java | 148 + .../client/model/CategoryTest.java | 56 + .../client/model/ModelApiResponseTest.java | 64 + .../openapitools/client/model/OrderTest.java | 89 + .../openapitools/client/model/PetTest.java | 93 + .../openapitools/client/model/TagTest.java | 56 + .../openapitools/client/model/UserTest.java | 104 + .../java/okhttp/.github/workflows/maven.yml | 30 + .../client/petstore/java/okhttp/.gitignore | 21 + .../java/okhttp/.openapi-generator-ignore | 23 + .../java/okhttp/.openapi-generator/FILES | 401 ++ .../java/okhttp/.openapi-generator/VERSION | 1 + .../client/petstore/java/okhttp/.travis.yml | 22 + samples/client/petstore/java/okhttp/README.md | 337 ++ .../petstore/java/okhttp/api/openapi.yaml | 3332 ++++++++++++++++ .../client/petstore/java/okhttp/build.gradle | 65 + samples/client/petstore/java/okhttp/build.sbt | 1 + .../okhttp/docs/AdditionalPropertiesClass.md | 20 + .../java/okhttp/docs/AllOfModelArrayAnyOf.md | 16 + .../AllOfModelArrayAnyOfAllOfAttributes.md | 13 + .../AllOfModelArrayAnyOfAllOfAttributesC.md | 32 + ...llOfModelArrayAnyOfAllOfLinkListColumn1.md | 13 + ...odelArrayAnyOfAllOfLinkListColumn1Value.md | 25 + .../java/okhttp/docs/AllOfRefToDouble.md | 14 + .../java/okhttp/docs/AllOfRefToFloat.md | 14 + .../java/okhttp/docs/AllOfRefToLong.md | 14 + .../petstore/java/okhttp/docs/Animal.md | 14 + .../java/okhttp/docs/AnotherFakeApi.md | 191 + .../client/petstore/java/okhttp/docs/Apple.md | 14 + .../petstore/java/okhttp/docs/AppleReq.md | 14 + .../petstore/java/okhttp/docs/ArrayAnyOf.md | 12 + .../petstore/java/okhttp/docs/ArrayDefault.md | 14 + .../okhttp/docs/ArrayOfArrayOfNumberOnly.md | 13 + .../java/okhttp/docs/ArrayOfInlineAllOf.md | 15 + ...OfInlineAllOfArrayAllofDogPropertyInner.md | 14 + .../java/okhttp/docs/ArrayOfNumberOnly.md | 13 + .../petstore/java/okhttp/docs/ArrayOneOf.md | 12 + .../petstore/java/okhttp/docs/ArrayTest.md | 15 + .../petstore/java/okhttp/docs/Banana.md | 13 + .../petstore/java/okhttp/docs/BananaReq.md | 14 + .../petstore/java/okhttp/docs/BasquePig.md | 13 + .../java/okhttp/docs/Capitalization.md | 18 + .../client/petstore/java/okhttp/docs/Cat.md | 13 + .../petstore/java/okhttp/docs/Category.md | 14 + .../petstore/java/okhttp/docs/ClassModel.md | 14 + .../petstore/java/okhttp/docs/Client.md | 13 + .../java/okhttp/docs/ComplexQuadrilateral.md | 14 + .../petstore/java/okhttp/docs/DanishPig.md | 13 + .../petstore/java/okhttp/docs/DefaultApi.md | 245 ++ .../java/okhttp/docs/DeprecatedObject.md | 13 + .../client/petstore/java/okhttp/docs/Dog.md | 13 + .../petstore/java/okhttp/docs/Drawing.md | 16 + .../petstore/java/okhttp/docs/EnumArrays.md | 32 + .../petstore/java/okhttp/docs/EnumClass.md | 15 + .../okhttp/docs/EnumStringDiscriminator.md | 23 + .../petstore/java/okhttp/docs/EnumTest.md | 68 + .../java/okhttp/docs/EquilateralTriangle.md | 14 + .../FakeAnyOfWIthSameErasureGet200Response.md | 12 + .../petstore/java/okhttp/docs/FakeApi.md | 1571 ++++++++ .../okhttp/docs/FakeClassnameTags123Api.md | 78 + .../FakeOneOfWIthSameErasureGet200Response.md | 12 + .../docs/FakeRefParameterPetIdParameter.md | 12 + .../java/okhttp/docs/FileSchemaTestClass.md | 14 + .../client/petstore/java/okhttp/docs/Foo.md | 13 + .../java/okhttp/docs/FooGetDefaultResponse.md | 13 + .../petstore/java/okhttp/docs/FormatTest.md | 29 + .../okhttp/docs/FreeFormObjectTestClass.md | 14 + .../docs/FreeFormObjectTestClassProperties.md | 12 + .../client/petstore/java/okhttp/docs/Fruit.md | 16 + .../petstore/java/okhttp/docs/FruitReq.md | 16 + .../petstore/java/okhttp/docs/GmFruit.md | 16 + .../java/okhttp/docs/GrandparentAnimal.md | 13 + .../java/okhttp/docs/HasOnlyReadOnly.md | 14 + .../java/okhttp/docs/HealthCheckResult.md | 14 + .../java/okhttp/docs/IsoscelesTriangle.md | 14 + .../petstore/java/okhttp/docs/Mammal.md | 26 + .../petstore/java/okhttp/docs/MammalAnyof.md | 26 + .../petstore/java/okhttp/docs/MapTest.md | 25 + ...dPropertiesAndAdditionalPropertiesClass.md | 15 + .../java/okhttp/docs/Model200Response.md | 15 + .../java/okhttp/docs/ModelApiResponse.md | 15 + .../petstore/java/okhttp/docs/ModelFile.md | 14 + .../petstore/java/okhttp/docs/ModelList.md | 13 + .../petstore/java/okhttp/docs/ModelReturn.md | 14 + .../docs/ModelWithOneOfAnyOfProperties.md | 14 + .../client/petstore/java/okhttp/docs/Name.md | 17 + .../docs/NestedArrayWithDefaultValues.md | 13 + .../petstore/java/okhttp/docs/NewPet.md | 31 + .../okhttp/docs/NewPetCategoryInlineAllof.md | 15 + ...wPetCategoryInlineAllofAllOfCategoryTag.md | 14 + .../java/okhttp/docs/NullableClass.md | 24 + .../petstore/java/okhttp/docs/NullableEnum.md | 11 + .../okhttp/docs/NullableFieldsMapError.md | 15 + .../okhttp/docs/NullableFieldsMapResponse.md | 15 + .../okhttp/docs/NullableFieldsMapSuccess.md | 15 + .../java/okhttp/docs/NullableFieldsValue.md | 15 + .../java/okhttp/docs/NullableShape.md | 16 + .../petstore/java/okhttp/docs/NumberOnly.md | 13 + .../okhttp/docs/ObjectWithDeprecatedFields.md | 16 + .../client/petstore/java/okhttp/docs/Order.md | 28 + .../java/okhttp/docs/OuterComposite.md | 15 + .../petstore/java/okhttp/docs/OuterEnum.md | 19 + .../java/okhttp/docs/OuterEnumDefaultValue.md | 15 + .../java/okhttp/docs/OuterEnumInteger.md | 15 + .../docs/OuterEnumIntegerDefaultValue.md | 15 + .../petstore/java/okhttp/docs/ParentPet.md | 12 + .../client/petstore/java/okhttp/docs/Pet.md | 28 + .../petstore/java/okhttp/docs/PetApi.md | 640 +++ .../java/okhttp/docs/PetComposition.md | 28 + .../petstore/java/okhttp/docs/PetRef.md | 28 + .../java/okhttp/docs/PetUsingAllOf.md | 28 + .../java/okhttp/docs/PetWithRequiredTags.md | 28 + .../client/petstore/java/okhttp/docs/Pig.md | 13 + .../java/okhttp/docs/PropertyNameCollision.md | 15 + .../java/okhttp/docs/Quadrilateral.md | 14 + .../okhttp/docs/QuadrilateralInterface.md | 13 + .../java/okhttp/docs/ReadOnlyFirst.md | 14 + .../java/okhttp/docs/RequiredNullableBody.md | 34 + .../petstore/java/okhttp/docs/Scalar.md | 13 + .../petstore/java/okhttp/docs/ScalarAnyOf.md | 13 + .../java/okhttp/docs/ScaleneTriangle.md | 14 + .../client/petstore/java/okhttp/docs/Shape.md | 15 + .../java/okhttp/docs/ShapeInterface.md | 13 + .../petstore/java/okhttp/docs/ShapeOrNull.md | 16 + .../java/okhttp/docs/SimpleQuadrilateral.md | 14 + .../java/okhttp/docs/SpecialModelName.md | 14 + .../petstore/java/okhttp/docs/StoreApi.md | 266 ++ .../client/petstore/java/okhttp/docs/Tag.md | 14 + ...lineFreeformAdditionalPropertiesRequest.md | 13 + .../petstore/java/okhttp/docs/Triangle.md | 14 + .../java/okhttp/docs/TriangleInterface.md | 13 + .../client/petstore/java/okhttp/docs/User.md | 24 + .../petstore/java/okhttp/docs/UserApi.md | 511 +++ .../client/petstore/java/okhttp/docs/Value.md | 12 + .../petstore/java/okhttp/docs/ValuesApi.md | 68 + .../petstore/java/okhttp/docs/Variable.md | 15 + .../client/petstore/java/okhttp/docs/Whale.md | 15 + .../client/petstore/java/okhttp/docs/Zebra.md | 24 + .../client/petstore/java/okhttp/git_push.sh | 57 + .../petstore/java/okhttp/gradle.properties | 6 + .../okhttp/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + samples/client/petstore/java/okhttp/gradlew | 249 ++ .../client/petstore/java/okhttp/gradlew.bat | 92 + samples/client/petstore/java/okhttp/pom.xml | 290 ++ .../petstore/java/okhttp/settings.gradle | 1 + .../java/okhttp/src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiCallback.java | 62 + .../org/openapitools/client/ApiClient.java | 1801 +++++++++ .../org/openapitools/client/ApiException.java | 167 + .../org/openapitools/client/ApiResponse.java | 76 + .../openapitools/client/Configuration.java | 63 + .../java/org/openapitools/client/JSON.java | 692 ++++ .../java/org/openapitools/client/Pair.java | 37 + .../client/ProgressRequestBody.java | 73 + .../client/ProgressResponseBody.java | 70 + .../client/ServerConfiguration.java | 72 + .../openapitools/client/ServerVariable.java | 37 + .../org/openapitools/client/StringUtil.java | 83 + .../client/api/AnotherFakeApi.java | 458 +++ .../openapitools/client/api/DefaultApi.java | 563 +++ .../org/openapitools/client/api/FakeApi.java | 3457 +++++++++++++++++ .../client/api/FakeClassnameTags123Api.java | 205 + .../org/openapitools/client/api/PetApi.java | 1329 +++++++ .../org/openapitools/client/api/StoreApi.java | 593 +++ .../org/openapitools/client/api/UserApi.java | 1105 ++++++ .../openapitools/client/api/ValuesApi.java | 199 + .../openapitools/client/auth/ApiKeyAuth.java | 80 + .../client/auth/Authentication.java | 37 + .../client/auth/HttpBasicAuth.java | 54 + .../client/auth/HttpBearerAuth.java | 62 + .../org/openapitools/client/auth/OAuth.java | 43 + .../openapitools/client/auth/OAuthFlow.java | 25 + .../client/auth/OAuthOkHttpClient.java | 82 + .../client/auth/RetryingOAuth.java | 223 ++ .../client/model/AbstractOpenApiSchema.java | 142 + .../model/AdditionalPropertiesClass.java | 503 +++ .../client/model/AllOfModelArrayAnyOf.java | 373 ++ .../AllOfModelArrayAnyOfAllOfAttributes.java | 280 ++ .../AllOfModelArrayAnyOfAllOfAttributesC.java | 277 ++ ...OfModelArrayAnyOfAllOfLinkListColumn1.java | 304 ++ ...elArrayAnyOfAllOfLinkListColumn1Value.java | 263 ++ .../client/model/AllOfRefToDouble.java | 275 ++ .../client/model/AllOfRefToFloat.java | 275 ++ .../client/model/AllOfRefToLong.java | 275 ++ .../org/openapitools/client/model/Animal.java | 242 ++ .../org/openapitools/client/model/Apple.java | 307 ++ .../openapitools/client/model/AppleReq.java | 311 ++ .../openapitools/client/model/ArrayAnyOf.java | 264 ++ .../client/model/ArrayDefault.java | 328 ++ .../model/ArrayOfArrayOfNumberOnly.java | 291 ++ .../client/model/ArrayOfInlineAllOf.java | 363 ++ ...InlineAllOfArrayAllofDogPropertyInner.java | 307 ++ .../client/model/ArrayOfNumberOnly.java | 291 ++ .../openapitools/client/model/ArrayOneOf.java | 273 ++ .../openapitools/client/model/ArrayTest.java | 367 ++ .../org/openapitools/client/model/Banana.java | 276 ++ .../openapitools/client/model/BananaReq.java | 309 ++ .../openapitools/client/model/BasquePig.java | 285 ++ .../client/model/Capitalization.java | 423 ++ .../org/openapitools/client/model/Cat.java | 285 ++ .../openapitools/client/model/Category.java | 311 ++ .../openapitools/client/model/ClassModel.java | 278 ++ .../org/openapitools/client/model/Client.java | 278 ++ .../client/model/ComplexQuadrilateral.java | 314 ++ .../openapitools/client/model/DanishPig.java | 285 ++ .../client/model/DeprecatedObject.java | 280 ++ .../org/openapitools/client/model/Dog.java | 284 ++ .../openapitools/client/model/Drawing.java | 406 ++ .../openapitools/client/model/EnumArrays.java | 427 ++ .../openapitools/client/model/EnumClass.java | 82 + .../client/model/EnumStringDiscriminator.java | 334 ++ .../openapitools/client/model/EnumTest.java | 815 ++++ .../client/model/EquilateralTriangle.java | 314 ++ ...akeAnyOfWIthSameErasureGet200Response.java | 233 ++ ...akeOneOfWIthSameErasureGet200Response.java | 240 ++ .../model/FakeRefParameterPetIdParameter.java | 271 ++ .../client/model/FileSchemaTestClass.java | 331 ++ .../org/openapitools/client/model/Foo.java | 278 ++ .../client/model/FooGetDefaultResponse.java | 280 ++ .../openapitools/client/model/FormatTest.java | 731 ++++ .../client/model/FreeFormObjectTestClass.java | 309 ++ .../FreeFormObjectTestClassProperties.java | 273 ++ .../org/openapitools/client/model/Fruit.java | 272 ++ .../openapitools/client/model/FruitReq.java | 277 ++ .../openapitools/client/model/GmFruit.java | 263 ++ .../client/model/GrandparentAnimal.java | 213 + .../client/model/HasOnlyReadOnly.java | 300 ++ .../client/model/HealthCheckResult.java | 290 ++ .../client/model/IsoscelesTriangle.java | 314 ++ .../org/openapitools/client/model/Mammal.java | 363 ++ .../client/model/MammalAnyof.java | 312 ++ .../openapitools/client/model/MapTest.java | 439 +++ ...ropertiesAndAdditionalPropertiesClass.java | 343 ++ .../client/model/Model200Response.java | 304 ++ .../client/model/ModelApiResponse.java | 333 ++ .../openapitools/client/model/ModelFile.java | 278 ++ .../openapitools/client/model/ModelList.java | 278 ++ .../client/model/ModelReturn.java | 275 ++ .../model/ModelWithOneOfAnyOfProperties.java | 311 ++ .../org/openapitools/client/model/Name.java | 356 ++ .../model/NestedArrayWithDefaultValues.java | 290 ++ .../org/openapitools/client/model/NewPet.java | 611 +++ .../model/NewPetCategoryInlineAllof.java | 342 ++ ...etCategoryInlineAllofAllOfCategoryTag.java | 304 ++ .../client/model/NullableClass.java | 644 +++ .../client/model/NullableEnum.java | 78 + .../client/model/NullableFieldsMapError.java | 314 ++ .../model/NullableFieldsMapResponse.java | 265 ++ .../model/NullableFieldsMapSuccess.java | 322 ++ .../client/model/NullableFieldsValue.java | 314 ++ .../client/model/NullableShape.java | 306 ++ .../openapitools/client/model/NumberOnly.java | 276 ++ .../model/ObjectWithDeprecatedFields.java | 392 ++ .../org/openapitools/client/model/Order.java | 467 +++ .../client/model/OuterComposite.java | 331 ++ .../openapitools/client/model/OuterEnum.java | 86 + .../client/model/OuterEnumDefaultValue.java | 82 + .../client/model/OuterEnumInteger.java | 83 + .../model/OuterEnumIntegerDefaultValue.java | 82 + .../openapitools/client/model/ParentPet.java | 258 ++ .../org/openapitools/client/model/Pet.java | 521 +++ .../client/model/PetComposition.java | 521 +++ .../org/openapitools/client/model/PetRef.java | 521 +++ .../client/model/PetUsingAllOf.java | 521 +++ .../client/model/PetWithRequiredTags.java | 517 +++ .../org/openapitools/client/model/Pig.java | 301 ++ .../client/model/PropertyNameCollision.java | 336 ++ .../client/model/Quadrilateral.java | 301 ++ .../client/model/QuadrilateralInterface.java | 285 ++ .../client/model/ReadOnlyFirst.java | 306 ++ .../client/model/RequiredNullableBody.java | 759 ++++ .../org/openapitools/client/model/Scalar.java | 375 ++ .../client/model/ScalarAnyOf.java | 362 ++ .../client/model/ScaleneTriangle.java | 314 ++ .../org/openapitools/client/model/Shape.java | 301 ++ .../client/model/ShapeInterface.java | 285 ++ .../client/model/ShapeOrNull.java | 306 ++ .../client/model/SimpleQuadrilateral.java | 314 ++ .../client/model/SpecialModelName.java | 304 ++ .../org/openapitools/client/model/Tag.java | 304 ++ ...neFreeformAdditionalPropertiesRequest.java | 278 ++ .../openapitools/client/model/Triangle.java | 365 ++ .../client/model/TriangleInterface.java | 285 ++ .../org/openapitools/client/model/User.java | 591 +++ .../org/openapitools/client/model/Value.java | 267 ++ .../openapitools/client/model/Variable.java | 314 ++ .../org/openapitools/client/model/Whale.java | 337 ++ .../org/openapitools/client/model/Zebra.java | 372 ++ .../client/api/AnotherFakeApiTest.java | 73 + .../client/api/DefaultApiTest.java | 78 + .../openapitools/client/api/FakeApiTest.java | 395 ++ .../api/FakeClassnameTags123ApiTest.java | 48 + .../openapitools/client/api/PetApiTest.java | 170 + .../openapitools/client/api/StoreApiTest.java | 89 + .../openapitools/client/api/UserApiTest.java | 148 + .../client/api/ValuesApiTest.java | 47 + .../model/AdditionalPropertiesClassTest.java | 106 + ...OfModelArrayAnyOfAllOfAttributesCTest.java | 127 + ...lOfModelArrayAnyOfAllOfAttributesTest.java | 48 + ...delArrayAnyOfAllOfLinkListColumn1Test.java | 51 + ...rayAnyOfAllOfLinkListColumn1ValueTest.java | 146 + .../model/AllOfModelArrayAnyOfTest.java | 73 + .../client/model/AllOfRefToDoubleTest.java | 47 + .../client/model/AllOfRefToFloatTest.java | 47 + .../client/model/AllOfRefToLongTest.java | 47 + .../openapitools/client/model/AnimalTest.java | 55 + .../client/model/AppleReqTest.java | 55 + .../openapitools/client/model/AppleTest.java | 55 + .../client/model/ArrayAnyOfTest.java | 34 + .../client/model/ArrayDefaultTest.java | 58 + .../model/ArrayOfArrayOfNumberOnlyTest.java | 51 + ...neAllOfArrayAllofDogPropertyInnerTest.java | 55 + .../client/model/ArrayOfInlineAllOfTest.java | 67 + .../client/model/ArrayOfNumberOnlyTest.java | 51 + .../client/model/ArrayOneOfTest.java | 34 + .../client/model/ArrayTestTest.java | 67 + .../client/model/BananaReqTest.java | 56 + .../openapitools/client/model/BananaTest.java | 48 + .../client/model/BasquePigTest.java | 47 + .../client/model/CapitalizationTest.java | 87 + .../openapitools/client/model/CatTest.java | 65 + .../client/model/CategoryTest.java | 55 + .../client/model/ClassModelTest.java | 47 + .../openapitools/client/model/ClientTest.java | 47 + .../model/ComplexQuadrilateralTest.java | 55 + .../client/model/DanishPigTest.java | 47 + .../client/model/DeprecatedObjectTest.java | 47 + .../openapitools/client/model/DogTest.java | 64 + .../client/model/DrawingTest.java | 79 + .../client/model/EnumArraysTest.java | 58 + .../client/model/EnumClassTest.java | 32 + .../model/EnumStringDiscriminatorTest.java | 47 + .../client/model/EnumTestTest.java | 116 + .../client/model/EquilateralTriangleTest.java | 55 + ...nyOfWIthSameErasureGet200ResponseTest.java | 34 + ...neOfWIthSameErasureGet200ResponseTest.java | 34 + .../FakeRefParameterPetIdParameterTest.java | 33 + .../client/model/FileSchemaTestClassTest.java | 59 + .../model/FooGetDefaultResponseTest.java | 48 + .../openapitools/client/model/FooTest.java | 47 + .../client/model/FormatTestTest.java | 180 + ...FreeFormObjectTestClassPropertiesTest.java | 34 + .../model/FreeFormObjectTestClassTest.java | 56 + .../client/model/FruitReqTest.java | 74 + .../openapitools/client/model/FruitTest.java | 66 + .../client/model/GmFruitTest.java | 66 + .../client/model/GrandparentAnimalTest.java | 47 + .../client/model/HasOnlyReadOnlyTest.java | 55 + .../client/model/HealthCheckResultTest.java | 48 + .../client/model/IsoscelesTriangleTest.java | 55 + .../client/model/MammalAnyofTest.java | 74 + .../openapitools/client/model/MammalTest.java | 74 + .../client/model/MapTestTest.java | 73 + ...rtiesAndAdditionalPropertiesClassTest.java | 68 + .../client/model/Model200ResponseTest.java | 55 + .../client/model/ModelApiResponseTest.java | 63 + .../client/model/ModelFileTest.java | 47 + .../client/model/ModelListTest.java | 47 + .../client/model/ModelReturnTest.java | 47 + .../ModelWithOneOfAnyOfPropertiesTest.java | 57 + .../openapitools/client/model/NameTest.java | 71 + .../NestedArrayWithDefaultValuesTest.java | 50 + ...tegoryInlineAllofAllOfCategoryTagTest.java | 55 + .../model/NewPetCategoryInlineAllofTest.java | 64 + .../openapitools/client/model/NewPetTest.java | 117 + .../client/model/NullableClassTest.java | 144 + .../client/model/NullableEnumTest.java | 32 + .../model/NullableFieldsMapErrorTest.java | 55 + .../model/NullableFieldsMapResponseTest.java | 68 + .../model/NullableFieldsMapSuccessTest.java | 58 + .../client/model/NullableFieldsValueTest.java | 55 + .../client/model/NullableShapeTest.java | 65 + .../client/model/NumberOnlyTest.java | 48 + .../model/ObjectWithDeprecatedFieldsTest.java | 76 + .../openapitools/client/model/OrderTest.java | 88 + .../client/model/OuterCompositeTest.java | 64 + .../model/OuterEnumDefaultValueTest.java | 32 + .../OuterEnumIntegerDefaultValueTest.java | 32 + .../client/model/OuterEnumIntegerTest.java | 32 + .../client/model/OuterEnumTest.java | 32 + .../client/model/ParentPetTest.java | 48 + .../client/model/PetCompositionTest.java | 92 + .../openapitools/client/model/PetRefTest.java | 92 + .../openapitools/client/model/PetTest.java | 92 + .../client/model/PetUsingAllOfTest.java | 92 + .../client/model/PetWithRequiredTagsTest.java | 92 + .../openapitools/client/model/PigTest.java | 49 + .../model/PropertyNameCollisionTest.java | 63 + .../model/QuadrilateralInterfaceTest.java | 47 + .../client/model/QuadrilateralTest.java | 57 + .../client/model/ReadOnlyFirstTest.java | 55 + .../model/RequiredNullableBodyTest.java | 160 + .../client/model/ScalarAnyOfTest.java | 35 + .../openapitools/client/model/ScalarTest.java | 35 + .../client/model/ScaleneTriangleTest.java | 55 + .../client/model/ShapeInterfaceTest.java | 47 + .../client/model/ShapeOrNullTest.java | 65 + .../openapitools/client/model/ShapeTest.java | 65 + .../client/model/SimpleQuadrilateralTest.java | 55 + .../client/model/SpecialModelNameTest.java | 55 + .../openapitools/client/model/TagTest.java | 55 + ...eeformAdditionalPropertiesRequestTest.java | 47 + .../client/model/TriangleInterfaceTest.java | 47 + .../client/model/TriangleTest.java | 58 + .../openapitools/client/model/UserTest.java | 136 + .../openapitools/client/model/ValueTest.java | 35 + .../client/model/VariableTest.java | 56 + .../openapitools/client/model/WhaleTest.java | 63 + .../openapitools/client/model/ZebraTest.java | 55 + 2903 files changed, 449634 insertions(+), 1026 deletions(-) create mode 100644 bin/configs/java-okhttp-3.1-duplicated-operationid.yaml create mode 100644 bin/configs/java-okhttp-3.1.yaml create mode 100644 bin/configs/java-okhttp-awsv4signature.yaml create mode 100644 bin/configs/java-okhttp-dynamicOperations.yaml create mode 100644 bin/configs/java-okhttp-echo-api.yaml create mode 100644 bin/configs/java-okhttp-group-parameter.yaml create mode 100644 bin/configs/java-okhttp-gson-user-defined-templates.yaml create mode 100644 bin/configs/java-okhttp-jackson.yaml create mode 100644 bin/configs/java-okhttp-jackson3.yaml create mode 100644 bin/configs/java-okhttp-jsonb.yaml create mode 100644 bin/configs/java-okhttp-jspecify.yaml create mode 100644 bin/configs/java-okhttp-nullable-required.yaml create mode 100644 bin/configs/java-okhttp-oneOf-array.yaml create mode 100644 bin/configs/java-okhttp-oneOf.yaml create mode 100644 bin/configs/java-okhttp-parcelableModel.yaml create mode 100644 bin/configs/java-okhttp-streaming.yaml create mode 100644 bin/configs/java-okhttp-swagger1.yaml create mode 100644 bin/configs/java-okhttp-swagger2.yaml create mode 100644 bin/configs/java-okhttp.yaml create mode 100644 modules/openapi-generator/src/test/resources/3_0/java/okhttp-jspecify.yaml create mode 100644 samples/client/echo_api/java/okhttp/.github/workflows/maven.yml create mode 100644 samples/client/echo_api/java/okhttp/.gitignore create mode 100644 samples/client/echo_api/java/okhttp/.openapi-generator-ignore create mode 100644 samples/client/echo_api/java/okhttp/.openapi-generator/FILES create mode 100644 samples/client/echo_api/java/okhttp/.openapi-generator/VERSION create mode 100644 samples/client/echo_api/java/okhttp/.travis.yml create mode 100644 samples/client/echo_api/java/okhttp/README.md create mode 100644 samples/client/echo_api/java/okhttp/api/openapi.yaml create mode 100644 samples/client/echo_api/java/okhttp/build.gradle create mode 100644 samples/client/echo_api/java/okhttp/build.sbt create mode 100644 samples/client/echo_api/java/okhttp/docs/AuthApi.md create mode 100644 samples/client/echo_api/java/okhttp/docs/Bird.md create mode 100644 samples/client/echo_api/java/okhttp/docs/BodyApi.md create mode 100644 samples/client/echo_api/java/okhttp/docs/Category.md create mode 100644 samples/client/echo_api/java/okhttp/docs/DataQuery.md create mode 100644 samples/client/echo_api/java/okhttp/docs/DefaultValue.md create mode 100644 samples/client/echo_api/java/okhttp/docs/FormApi.md create mode 100644 samples/client/echo_api/java/okhttp/docs/HeaderApi.md create mode 100644 samples/client/echo_api/java/okhttp/docs/NumberPropertiesOnly.md create mode 100644 samples/client/echo_api/java/okhttp/docs/PathApi.md create mode 100644 samples/client/echo_api/java/okhttp/docs/Pet.md create mode 100644 samples/client/echo_api/java/okhttp/docs/Query.md create mode 100644 samples/client/echo_api/java/okhttp/docs/QueryApi.md create mode 100644 samples/client/echo_api/java/okhttp/docs/StringEnumRef.md create mode 100644 samples/client/echo_api/java/okhttp/docs/Tag.md create mode 100644 samples/client/echo_api/java/okhttp/docs/TestFormObjectMultipartRequestMarker.md create mode 100644 samples/client/echo_api/java/okhttp/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md create mode 100644 samples/client/echo_api/java/okhttp/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md create mode 100644 samples/client/echo_api/java/okhttp/git_push.sh create mode 100644 samples/client/echo_api/java/okhttp/gradle.properties create mode 100644 samples/client/echo_api/java/okhttp/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/echo_api/java/okhttp/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/echo_api/java/okhttp/gradlew create mode 100644 samples/client/echo_api/java/okhttp/gradlew.bat create mode 100644 samples/client/echo_api/java/okhttp/pom.xml create mode 100644 samples/client/echo_api/java/okhttp/settings.gradle create mode 100644 samples/client/echo_api/java/okhttp/src/main/AndroidManifest.xml create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/AuthApi.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/BodyApi.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/FormApi.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/HeaderApi.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/PathApi.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/QueryApi.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Bird.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DataQuery.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DefaultValue.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Query.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/StringEnumRef.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java create mode 100644 samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/AuthApiTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/BodyApiTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/FormApiTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/HeaderApiTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/PathApiTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/QueryApiTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/BirdTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/DataQueryTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/DefaultValueTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/QueryTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/StringEnumRefTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java create mode 100644 samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/.github/workflows/maven.yml create mode 100644 samples/client/others/java/okhttp-oneOf-array/.gitignore create mode 100644 samples/client/others/java/okhttp-oneOf-array/.openapi-generator-ignore create mode 100644 samples/client/others/java/okhttp-oneOf-array/.openapi-generator/FILES create mode 100644 samples/client/others/java/okhttp-oneOf-array/.openapi-generator/VERSION create mode 100644 samples/client/others/java/okhttp-oneOf-array/.travis.yml create mode 100644 samples/client/others/java/okhttp-oneOf-array/README.md create mode 100644 samples/client/others/java/okhttp-oneOf-array/api/openapi.yaml create mode 100644 samples/client/others/java/okhttp-oneOf-array/build.gradle create mode 100644 samples/client/others/java/okhttp-oneOf-array/build.sbt create mode 100644 samples/client/others/java/okhttp-oneOf-array/docs/DefaultApi.md create mode 100644 samples/client/others/java/okhttp-oneOf-array/docs/MyExampleGet200Response.md create mode 100644 samples/client/others/java/okhttp-oneOf-array/docs/OneOf1.md create mode 100644 samples/client/others/java/okhttp-oneOf-array/git_push.sh create mode 100644 samples/client/others/java/okhttp-oneOf-array/gradle.properties create mode 100644 samples/client/others/java/okhttp-oneOf-array/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/others/java/okhttp-oneOf-array/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/others/java/okhttp-oneOf-array/gradlew create mode 100644 samples/client/others/java/okhttp-oneOf-array/gradlew.bat create mode 100644 samples/client/others/java/okhttp-oneOf-array/pom.xml create mode 100644 samples/client/others/java/okhttp-oneOf-array/settings.gradle create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/AndroidManifest.xml create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/api/DefaultApi.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/MyExampleGet200Response.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/OneOf1.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/test/java/org/openapitools/client/api/DefaultApiTest.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/test/java/org/openapitools/client/model/MyExampleGet200ResponseTest.java create mode 100644 samples/client/others/java/okhttp-oneOf-array/src/test/java/org/openapitools/client/model/OneOf1Test.java create mode 100644 samples/client/others/java/okhttp-oneOf/.github/workflows/maven.yml create mode 100644 samples/client/others/java/okhttp-oneOf/.gitignore create mode 100644 samples/client/others/java/okhttp-oneOf/.openapi-generator-ignore create mode 100644 samples/client/others/java/okhttp-oneOf/.openapi-generator/FILES create mode 100644 samples/client/others/java/okhttp-oneOf/.openapi-generator/VERSION create mode 100644 samples/client/others/java/okhttp-oneOf/.travis.yml create mode 100644 samples/client/others/java/okhttp-oneOf/README.md create mode 100644 samples/client/others/java/okhttp-oneOf/api/openapi.yaml create mode 100644 samples/client/others/java/okhttp-oneOf/build.gradle create mode 100644 samples/client/others/java/okhttp-oneOf/build.sbt create mode 100644 samples/client/others/java/okhttp-oneOf/docs/DefaultApi.md create mode 100644 samples/client/others/java/okhttp-oneOf/docs/MyExamplePostRequest.md create mode 100644 samples/client/others/java/okhttp-oneOf/git_push.sh create mode 100644 samples/client/others/java/okhttp-oneOf/gradle.properties create mode 100644 samples/client/others/java/okhttp-oneOf/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/others/java/okhttp-oneOf/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/others/java/okhttp-oneOf/gradlew create mode 100644 samples/client/others/java/okhttp-oneOf/gradlew.bat create mode 100644 samples/client/others/java/okhttp-oneOf/pom.xml create mode 100644 samples/client/others/java/okhttp-oneOf/settings.gradle create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/AndroidManifest.xml create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/api/DefaultApi.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/test/java/org/openapitools/client/api/DefaultApiTest.java create mode 100644 samples/client/others/java/okhttp-oneOf/src/test/java/org/openapitools/client/model/MyExamplePostRequestTest.java create mode 100644 samples/client/others/java/okhttp-streaming/.github/workflows/maven.yml create mode 100644 samples/client/others/java/okhttp-streaming/.gitignore create mode 100644 samples/client/others/java/okhttp-streaming/.openapi-generator-ignore create mode 100644 samples/client/others/java/okhttp-streaming/.openapi-generator/FILES create mode 100644 samples/client/others/java/okhttp-streaming/.openapi-generator/VERSION create mode 100644 samples/client/others/java/okhttp-streaming/.travis.yml create mode 100644 samples/client/others/java/okhttp-streaming/README.md create mode 100644 samples/client/others/java/okhttp-streaming/api/openapi.yaml create mode 100644 samples/client/others/java/okhttp-streaming/build.gradle create mode 100644 samples/client/others/java/okhttp-streaming/build.sbt create mode 100644 samples/client/others/java/okhttp-streaming/docs/PingApi.md create mode 100644 samples/client/others/java/okhttp-streaming/docs/SimpleOneOf.md create mode 100644 samples/client/others/java/okhttp-streaming/docs/SomeObj.md create mode 100644 samples/client/others/java/okhttp-streaming/git_push.sh create mode 100644 samples/client/others/java/okhttp-streaming/gradle.properties create mode 100644 samples/client/others/java/okhttp-streaming/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/others/java/okhttp-streaming/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/others/java/okhttp-streaming/gradlew create mode 100644 samples/client/others/java/okhttp-streaming/gradlew.bat create mode 100644 samples/client/others/java/okhttp-streaming/pom.xml create mode 100644 samples/client/others/java/okhttp-streaming/settings.gradle create mode 100644 samples/client/others/java/okhttp-streaming/src/main/AndroidManifest.xml create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/api/PingApi.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java create mode 100644 samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SomeObj.java create mode 100644 samples/client/others/java/okhttp-streaming/src/test/java/org/openapitools/client/api/PingApiTest.java create mode 100644 samples/client/others/java/okhttp-streaming/src/test/java/org/openapitools/client/model/SimpleOneOfTest.java create mode 100644 samples/client/others/java/okhttp-streaming/src/test/java/org/openapitools/client/model/SomeObjTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.gitignore create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.travis.yml create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/README.md create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/api/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/build.gradle create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/build.sbt create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/docs/FakeApi.md create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/docs/PetApi.md create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/git_push.sh create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/gradle.properties create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/gradlew create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/pom.xml create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/settings.gradle create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/RetryingOAuth.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/FakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp-3.1/.gitignore create mode 100644 samples/client/petstore/java/okhttp-3.1/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp-3.1/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp-3.1/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp-3.1/.travis.yml create mode 100644 samples/client/petstore/java/okhttp-3.1/README.md create mode 100644 samples/client/petstore/java/okhttp-3.1/api/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp-3.1/build.gradle create mode 100644 samples/client/petstore/java/okhttp-3.1/build.sbt create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/AllOfSimpleModel.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/Animal.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/AnyTypeTest.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/ArrayOfSameRef.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/Cat.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/Category.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/CircularReference1.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/CircularReference2.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/CircularReference3.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/CodesEnum.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/DefaultApi.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/Dog.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/FakeApi.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/FakeWebhooksSourcesDeletedPostRequest.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/FakeWebhooksSourcesDeletedPostRequestEvent.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/OneOfStringOrInt.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/Order.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/Pet.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/PetApi.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/PetWithTypesObjectNullAndRef.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/RefRefToPathLevelParameterOneofRefToOneofParameter.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/RefToRefParameterAnyofRefToAnyofParameter.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/SelfReferenceAdditionalProperties.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/SelfReferenceAnyOf.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/SelfReferenceOneOf.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/SimpleModelWithArrayProperty.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/StoreApi.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/StringOrInt.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/Tag.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/User.md create mode 100644 samples/client/petstore/java/okhttp-3.1/docs/UserApi.md create mode 100644 samples/client/petstore/java/okhttp-3.1/git_push.sh create mode 100644 samples/client/petstore/java/okhttp-3.1/gradle.properties create mode 100644 samples/client/petstore/java/okhttp-3.1/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp-3.1/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp-3.1/gradlew create mode 100644 samples/client/petstore/java/okhttp-3.1/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp-3.1/pom.xml create mode 100644 samples/client/petstore/java/okhttp-3.1/settings.gradle create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/DefaultApi.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/RetryingOAuth.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AllOfSimpleModel.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Animal.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AnyTypeTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ArrayOfSameRef.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Cat.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference1.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference2.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference3.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CodesEnum.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Dog.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEvent.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/OneOfStringOrInt.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/PetWithTypesObjectNullAndRef.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAdditionalProperties.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/StringOrInt.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/DefaultApiTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/FakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/AllOfSimpleModelTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/AnimalTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/AnyTypeTestTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/ArrayOfSameRefTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CatTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CircularReference1Test.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CircularReference2Test.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CircularReference3Test.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CodesEnumTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/DogTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEventTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/OneOfStringOrIntTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/PetWithTypesObjectNullAndRefTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameterTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameterTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SelfReferenceAdditionalPropertiesTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SelfReferenceAnyOfTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SelfReferenceOneOfTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SimpleModelWithArrayPropertyTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/StringOrIntTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/.gitignore create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/.travis.yml create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/README.md create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/api/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/build.gradle create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/build.sbt create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/docs/Category.md create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/docs/Order.md create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/docs/Pet.md create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/docs/PetApi.md create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/docs/StoreApi.md create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/docs/Tag.md create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/docs/User.md create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/docs/UserApi.md create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/git_push.sh create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/gradle.properties create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/gradlew create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/pom.xml create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/settings.gradle create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/AWS4Auth.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/RetryingOAuth.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/.gitignore create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/.travis.yml create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/README.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/build.gradle create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/build.sbt create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesAnyType.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesArray.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesBoolean.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesInteger.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesNumber.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesObject.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesString.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/Animal.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/AnotherFakeApi.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/ArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/ArrayTest.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/BigCat.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/Capitalization.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/Cat.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/Category.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/ClassModel.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/Client.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/Dog.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/EnumArrays.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/EnumClass.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/EnumTest.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/FakeApi.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/FakeClassnameTags123Api.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/FormatTest.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/HasOnlyReadOnly.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/MapTest.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/Model200Response.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelFile.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelList.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelReturn.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/Name.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/NumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/Order.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/OuterComposite.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/OuterEnum.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/Pet.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/PetApi.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/ReadOnlyFirst.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/SpecialModelName.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/StoreApi.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/Tag.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/TypeHolderDefault.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/TypeHolderExample.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/User.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/UserApi.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/docs/XmlItem.md create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/git_push.sh create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/gradle.properties create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/gradlew create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/pom.xml create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/settings.gradle create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiOperation.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/AnotherFakeApi.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/RetryingOAuth.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/OuterEnum.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/main/resources/openapi/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/FakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AnimalTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ArrayTestTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/BigCatTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/CapitalizationTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/CatTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ClassModelTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ClientTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/DogTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/EnumArraysTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/EnumClassTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/EnumTestTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/FormatTestTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/MapTestTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/Model200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelFileTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelListTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelReturnTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/NameTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/NumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/OuterCompositeTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/OuterEnumTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/XmlItemTest.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp-group-parameter/.gitignore create mode 100644 samples/client/petstore/java/okhttp-group-parameter/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp-group-parameter/.travis.yml create mode 100644 samples/client/petstore/java/okhttp-group-parameter/README.md create mode 100644 samples/client/petstore/java/okhttp-group-parameter/api/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp-group-parameter/build.gradle create mode 100644 samples/client/petstore/java/okhttp-group-parameter/build.sbt create mode 100644 samples/client/petstore/java/okhttp-group-parameter/docs/Category.md create mode 100644 samples/client/petstore/java/okhttp-group-parameter/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/okhttp-group-parameter/docs/Order.md create mode 100644 samples/client/petstore/java/okhttp-group-parameter/docs/Pet.md create mode 100644 samples/client/petstore/java/okhttp-group-parameter/docs/PetApi.md create mode 100644 samples/client/petstore/java/okhttp-group-parameter/docs/Tag.md create mode 100644 samples/client/petstore/java/okhttp-group-parameter/docs/User.md create mode 100644 samples/client/petstore/java/okhttp-group-parameter/git_push.sh create mode 100644 samples/client/petstore/java/okhttp-group-parameter/gradle.properties create mode 100644 samples/client/petstore/java/okhttp-group-parameter/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp-group-parameter/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp-group-parameter/gradlew create mode 100644 samples/client/petstore/java/okhttp-group-parameter/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp-group-parameter/pom.xml create mode 100644 samples/client/petstore/java/okhttp-group-parameter/settings.gradle create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/RetryingOAuth.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp-jackson/.gitignore create mode 100644 samples/client/petstore/java/okhttp-jackson/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp-jackson/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp-jackson/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp-jackson/.travis.yml create mode 100644 samples/client/petstore/java/okhttp-jackson/README.md create mode 100644 samples/client/petstore/java/okhttp-jackson/api/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp-jackson/build.gradle create mode 100644 samples/client/petstore/java/okhttp-jackson/build.sbt create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOf.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfAttributes.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfAttributesC.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/AllOfRefToDouble.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/AllOfRefToFloat.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/AllOfRefToLong.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Animal.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/AnotherFakeApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Apple.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/AppleReq.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ArrayAnyOf.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ArrayDefault.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ArrayOfInlineAllOf.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ArrayOneOf.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ArrayTest.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Banana.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/BananaReq.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/BasquePig.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Capitalization.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Cat.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Category.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ClassModel.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Client.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ComplexQuadrilateral.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/DanishPig.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/DefaultApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/DeprecatedObject.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Dog.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Drawing.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/EnumArrays.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/EnumClass.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/EnumStringDiscriminator.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/EnumTest.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/EquilateralTriangle.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/FakeAnyOfWIthSameErasureGet200Response.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/FakeApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/FakeClassnameTags123Api.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/FakeOneOfWIthSameErasureGet200Response.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/FakeRefParameterPetIdParameter.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Foo.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/FooGetDefaultResponse.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/FormatTest.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/FreeFormObjectTestClass.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/FreeFormObjectTestClassProperties.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Fruit.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/FruitReq.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/GmFruit.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/GrandparentAnimal.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/HasOnlyReadOnly.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/HealthCheckResult.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/IsoscelesTriangle.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Mammal.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/MammalAnyof.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/MapTest.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Model200Response.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ModelFile.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ModelList.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ModelReturn.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ModelWithOneOfAnyOfProperties.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Name.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/NestedArrayWithDefaultValues.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/NewPet.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/NewPetCategoryInlineAllof.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/NullableClass.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/NullableEnum.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsMapError.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsMapResponse.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsMapSuccess.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsValue.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/NullableShape.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/NumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ObjectWithDeprecatedFields.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Order.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/OuterComposite.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/OuterEnum.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/OuterEnumDefaultValue.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/OuterEnumInteger.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/OuterEnumIntegerDefaultValue.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ParentPet.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Pet.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/PetApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/PetComposition.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/PetRef.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/PetUsingAllOf.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/PetWithRequiredTags.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Pig.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/PropertyNameCollision.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Quadrilateral.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/QuadrilateralInterface.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ReadOnlyFirst.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/RequiredNullableBody.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Scalar.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ScalarAnyOf.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ScaleneTriangle.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Shape.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ShapeInterface.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ShapeOrNull.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/SimpleQuadrilateral.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/SpecialModelName.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/StoreApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Tag.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/TestInlineFreeformAdditionalPropertiesRequest.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Triangle.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/TriangleInterface.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/User.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/UserApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Value.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/ValuesApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Variable.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Whale.md create mode 100644 samples/client/petstore/java/okhttp-jackson/docs/Zebra.md create mode 100644 samples/client/petstore/java/okhttp-jackson/git_push.sh create mode 100644 samples/client/petstore/java/okhttp-jackson/gradle.properties create mode 100644 samples/client/petstore/java/okhttp-jackson/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp-jackson/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp-jackson/gradlew create mode 100644 samples/client/petstore/java/okhttp-jackson/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp-jackson/pom.xml create mode 100644 samples/client/petstore/java/okhttp-jackson/settings.gradle create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339DateFormat.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/DefaultApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/ValuesApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToLong.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Animal.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Apple.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AppleReq.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayAnyOf.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayDefault.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOneOf.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Banana.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BananaReq.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BasquePig.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Capitalization.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Cat.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ClassModel.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Client.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DanishPig.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DeprecatedObject.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Dog.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Drawing.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumArrays.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Foo.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FormatTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Fruit.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FruitReq.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GmFruit.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GrandparentAnimal.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HealthCheckResult.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Mammal.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MammalAnyof.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MapTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Model200Response.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelFile.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelList.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelReturn.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Name.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPet.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableClass.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableEnum.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsValue.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableShape.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterComposite.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnum.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnumInteger.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ParentPet.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetComposition.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetRef.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetUsingAllOf.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pig.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PropertyNameCollision.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Quadrilateral.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/RequiredNullableBody.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Scalar.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScalarAnyOf.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Shape.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeInterface.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeOrNull.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SpecialModelName.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Triangle.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TriangleInterface.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Value.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Variable.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Whale.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Zebra.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/DefaultApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/FakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/ValuesApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AnimalTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AppleReqTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AppleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayTestTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/BananaReqTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/BananaTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/BasquePigTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/CapitalizationTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/CatTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ClassModelTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ClientTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DanishPigTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DogTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DrawingTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumArraysTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumTestTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FooTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FormatTestTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FruitReqTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FruitTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/GmFruitTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MammalAnyofTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MammalTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MapTestTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/Model200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelFileTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelListTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelReturnTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NameTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NewPetTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableEnumTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableShapeTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterCompositeTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ParentPetTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetCompositionTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetRefTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PigTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/QuadrilateralTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ScalarTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ShapeTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TriangleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/VariableTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/WhaleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ZebraTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp-jackson3/.gitignore create mode 100644 samples/client/petstore/java/okhttp-jackson3/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp-jackson3/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp-jackson3/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp-jackson3/.travis.yml create mode 100644 samples/client/petstore/java/okhttp-jackson3/README.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/api/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp-jackson3/build.gradle create mode 100644 samples/client/petstore/java/okhttp-jackson3/build.sbt create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOf.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfAttributes.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfAttributesC.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/AllOfRefToDouble.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/AllOfRefToFloat.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/AllOfRefToLong.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Animal.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/AnotherFakeApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Apple.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/AppleReq.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ArrayAnyOf.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ArrayDefault.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfInlineAllOf.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ArrayOneOf.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ArrayTest.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Banana.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/BananaReq.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/BasquePig.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Capitalization.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Cat.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Category.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ClassModel.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Client.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ComplexQuadrilateral.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/DanishPig.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/DefaultApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/DeprecatedObject.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Dog.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Drawing.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/EnumArrays.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/EnumClass.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/EnumStringDiscriminator.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/EnumTest.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/EquilateralTriangle.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/FakeAnyOfWIthSameErasureGet200Response.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/FakeApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/FakeClassnameTags123Api.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/FakeOneOfWIthSameErasureGet200Response.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/FakeRefParameterPetIdParameter.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Foo.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/FooGetDefaultResponse.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/FormatTest.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/FreeFormObjectTestClass.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/FreeFormObjectTestClassProperties.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Fruit.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/FruitReq.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/GmFruit.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/GrandparentAnimal.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/HasOnlyReadOnly.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/HealthCheckResult.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/IsoscelesTriangle.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Mammal.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/MammalAnyof.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/MapTest.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Model200Response.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ModelFile.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ModelList.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ModelReturn.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ModelWithOneOfAnyOfProperties.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Name.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/NestedArrayWithDefaultValues.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/NewPet.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/NewPetCategoryInlineAllof.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/NullableClass.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/NullableEnum.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsMapError.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsMapResponse.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsMapSuccess.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsValue.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/NullableShape.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/NumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ObjectWithDeprecatedFields.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Order.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/OuterComposite.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/OuterEnum.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/OuterEnumDefaultValue.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/OuterEnumInteger.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/OuterEnumIntegerDefaultValue.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ParentPet.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Pet.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/PetApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/PetComposition.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/PetRef.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/PetUsingAllOf.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/PetWithRequiredTags.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Pig.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/PropertyNameCollision.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Quadrilateral.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/QuadrilateralInterface.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ReadOnlyFirst.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/RequiredNullableBody.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Scalar.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ScalarAnyOf.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ScaleneTriangle.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Shape.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ShapeInterface.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ShapeOrNull.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/SimpleQuadrilateral.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/SpecialModelName.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/StoreApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Tag.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/TestInlineFreeformAdditionalPropertiesRequest.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Triangle.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/TriangleInterface.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/User.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/UserApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Value.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/ValuesApi.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Variable.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Whale.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/docs/Zebra.md create mode 100644 samples/client/petstore/java/okhttp-jackson3/git_push.sh create mode 100644 samples/client/petstore/java/okhttp-jackson3/gradle.properties create mode 100644 samples/client/petstore/java/okhttp-jackson3/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp-jackson3/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp-jackson3/gradlew create mode 100644 samples/client/petstore/java/okhttp-jackson3/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp-jackson3/pom.xml create mode 100644 samples/client/petstore/java/okhttp-jackson3/settings.gradle create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339DateFormat.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/AnotherFakeApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/DefaultApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/ValuesApi.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/RetryingOAuth.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Animal.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Apple.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AppleReq.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayAnyOf.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayDefault.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOneOf.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Banana.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BananaReq.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BasquePig.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Capitalization.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Cat.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ClassModel.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Client.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DanishPig.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DeprecatedObject.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Dog.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Drawing.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumArrays.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Foo.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FormatTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Fruit.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FruitReq.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GmFruit.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HealthCheckResult.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Mammal.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MammalAnyof.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MapTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Model200Response.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelFile.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelList.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelReturn.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Name.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPet.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableEnum.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsValue.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableShape.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterComposite.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnum.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnumInteger.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ParentPet.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetComposition.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetRef.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetUsingAllOf.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pig.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PropertyNameCollision.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Quadrilateral.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/RequiredNullableBody.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Scalar.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScalarAnyOf.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Shape.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeInterface.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeOrNull.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SpecialModelName.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Triangle.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TriangleInterface.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Value.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Variable.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Whale.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Zebra.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/DefaultApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/FakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/ValuesApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AnimalTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AppleReqTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AppleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayTestTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/BananaReqTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/BananaTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/BasquePigTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/CapitalizationTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/CatTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ClassModelTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ClientTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DanishPigTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DogTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DrawingTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumArraysTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumTestTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FooTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FormatTestTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FruitReqTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FruitTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/GmFruitTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MammalAnyofTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MammalTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MapTestTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/Model200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelFileTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelListTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelReturnTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NameTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NewPetTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableEnumTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableShapeTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterCompositeTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ParentPetTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetCompositionTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetRefTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PigTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/QuadrilateralTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ScalarTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ShapeTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TriangleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/VariableTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/WhaleTest.java create mode 100644 samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ZebraTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp-jsonb/.gitignore create mode 100644 samples/client/petstore/java/okhttp-jsonb/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp-jsonb/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp-jsonb/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp-jsonb/.travis.yml create mode 100644 samples/client/petstore/java/okhttp-jsonb/README.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/api/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp-jsonb/build.gradle create mode 100644 samples/client/petstore/java/okhttp-jsonb/build.sbt create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOf.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfAttributes.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfAttributesC.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/AllOfRefToDouble.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/AllOfRefToFloat.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/AllOfRefToLong.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Animal.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/AnotherFakeApi.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Apple.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/AppleReq.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ArrayAnyOf.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ArrayDefault.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfInlineAllOf.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ArrayOneOf.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ArrayTest.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Banana.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/BananaReq.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/BasquePig.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Capitalization.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Cat.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Category.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ClassModel.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Client.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ComplexQuadrilateral.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/DanishPig.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/DefaultApi.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/DeprecatedObject.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Dog.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Drawing.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/EnumArrays.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/EnumClass.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/EnumStringDiscriminator.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/EnumTest.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/EquilateralTriangle.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/FakeAnyOfWIthSameErasureGet200Response.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/FakeApi.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/FakeClassnameTags123Api.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/FakeOneOfWIthSameErasureGet200Response.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/FakeRefParameterPetIdParameter.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Foo.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/FooGetDefaultResponse.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/FormatTest.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/FreeFormObjectTestClass.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/FreeFormObjectTestClassProperties.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Fruit.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/FruitReq.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/GmFruit.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/GrandparentAnimal.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/HasOnlyReadOnly.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/HealthCheckResult.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/IsoscelesTriangle.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Mammal.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/MammalAnyof.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/MapTest.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Model200Response.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ModelFile.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ModelList.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ModelReturn.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ModelWithOneOfAnyOfProperties.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Name.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/NestedArrayWithDefaultValues.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/NewPet.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/NewPetCategoryInlineAllof.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/NullableClass.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/NullableEnum.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsMapError.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsMapResponse.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsMapSuccess.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsValue.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/NullableShape.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/NumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ObjectWithDeprecatedFields.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Order.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/OuterComposite.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/OuterEnum.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/OuterEnumDefaultValue.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/OuterEnumInteger.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/OuterEnumIntegerDefaultValue.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ParentPet.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Pet.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/PetApi.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/PetComposition.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/PetRef.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/PetUsingAllOf.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/PetWithRequiredTags.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Pig.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/PropertyNameCollision.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Quadrilateral.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/QuadrilateralInterface.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ReadOnlyFirst.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/RequiredNullableBody.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Scalar.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ScalarAnyOf.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ScaleneTriangle.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Shape.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ShapeInterface.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ShapeOrNull.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/SimpleQuadrilateral.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/SpecialModelName.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/StoreApi.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Tag.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/TestInlineFreeformAdditionalPropertiesRequest.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Triangle.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/TriangleInterface.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/User.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/UserApi.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Value.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/ValuesApi.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Variable.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Whale.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/docs/Zebra.md create mode 100644 samples/client/petstore/java/okhttp-jsonb/git_push.sh create mode 100644 samples/client/petstore/java/okhttp-jsonb/gradle.properties create mode 100644 samples/client/petstore/java/okhttp-jsonb/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp-jsonb/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp-jsonb/gradlew create mode 100644 samples/client/petstore/java/okhttp-jsonb/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp-jsonb/pom.xml create mode 100644 samples/client/petstore/java/okhttp-jsonb/settings.gradle create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/AnotherFakeApi.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/DefaultApi.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/ValuesApi.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/RetryingOAuth.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToLong.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Animal.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Apple.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AppleReq.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayAnyOf.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayDefault.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOneOf.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Banana.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BananaReq.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BasquePig.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Capitalization.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Cat.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ClassModel.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Client.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DanishPig.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DeprecatedObject.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Dog.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Drawing.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumArrays.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EquilateralTriangle.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Foo.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FormatTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Fruit.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FruitReq.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GmFruit.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GrandparentAnimal.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HealthCheckResult.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Mammal.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MammalAnyof.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MapTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Model200Response.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelFile.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelList.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelReturn.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Name.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPet.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableClass.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableEnum.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsValue.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableShape.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterComposite.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnum.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnumInteger.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ParentPet.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetComposition.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetRef.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetUsingAllOf.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pig.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PropertyNameCollision.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Quadrilateral.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/RequiredNullableBody.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Scalar.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScalarAnyOf.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScaleneTriangle.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Shape.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeInterface.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeOrNull.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SpecialModelName.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Triangle.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TriangleInterface.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Value.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Variable.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Whale.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Zebra.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/DefaultApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/FakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/ValuesApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AnimalTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AppleReqTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AppleTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayTestTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/BananaReqTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/BananaTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/BasquePigTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/CapitalizationTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/CatTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ClassModelTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ClientTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DanishPigTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DogTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DrawingTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumArraysTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumTestTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FooTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FormatTestTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FruitReqTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FruitTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/GmFruitTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MammalAnyofTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MammalTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MapTestTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/Model200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelFileTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelListTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelReturnTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NameTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NewPetTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableClassTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableEnumTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableShapeTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterCompositeTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ParentPetTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetCompositionTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetRefTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PigTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/QuadrilateralTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ScalarTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ShapeTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TriangleTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ValueTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/VariableTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/WhaleTest.java create mode 100644 samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ZebraTest.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp-jspecify/.gitignore create mode 100644 samples/client/petstore/java/okhttp-jspecify/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp-jspecify/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp-jspecify/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp-jspecify/.travis.yml create mode 100644 samples/client/petstore/java/okhttp-jspecify/README.md create mode 100644 samples/client/petstore/java/okhttp-jspecify/api/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp-jspecify/build.gradle create mode 100644 samples/client/petstore/java/okhttp-jspecify/build.sbt create mode 100644 samples/client/petstore/java/okhttp-jspecify/docs/DefaultApi.md create mode 100644 samples/client/petstore/java/okhttp-jspecify/docs/Foo.md create mode 100644 samples/client/petstore/java/okhttp-jspecify/git_push.sh create mode 100644 samples/client/petstore/java/okhttp-jspecify/gradle.properties create mode 100644 samples/client/petstore/java/okhttp-jspecify/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp-jspecify/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp-jspecify/gradlew create mode 100644 samples/client/petstore/java/okhttp-jspecify/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp-jspecify/pom.xml create mode 100644 samples/client/petstore/java/okhttp-jspecify/settings.gradle create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/api/package-info.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/Foo.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/package-info.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/package-info.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java create mode 100644 samples/client/petstore/java/okhttp-jspecify/src/test/java/org/openapitools/client/model/FooTest.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp-nullable-required/.gitignore create mode 100644 samples/client/petstore/java/okhttp-nullable-required/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp-nullable-required/.travis.yml create mode 100644 samples/client/petstore/java/okhttp-nullable-required/README.md create mode 100644 samples/client/petstore/java/okhttp-nullable-required/api/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp-nullable-required/build.gradle create mode 100644 samples/client/petstore/java/okhttp-nullable-required/build.sbt create mode 100644 samples/client/petstore/java/okhttp-nullable-required/docs/Category.md create mode 100644 samples/client/petstore/java/okhttp-nullable-required/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/okhttp-nullable-required/docs/Order.md create mode 100644 samples/client/petstore/java/okhttp-nullable-required/docs/Pet.md create mode 100644 samples/client/petstore/java/okhttp-nullable-required/docs/PetApi.md create mode 100644 samples/client/petstore/java/okhttp-nullable-required/docs/PetWithRequiredNullableCases1.md create mode 100644 samples/client/petstore/java/okhttp-nullable-required/docs/PetWithRequiredNullableCases2.md create mode 100644 samples/client/petstore/java/okhttp-nullable-required/docs/StoreApi.md create mode 100644 samples/client/petstore/java/okhttp-nullable-required/docs/Tag.md create mode 100644 samples/client/petstore/java/okhttp-nullable-required/docs/User.md create mode 100644 samples/client/petstore/java/okhttp-nullable-required/docs/UserApi.md create mode 100644 samples/client/petstore/java/okhttp-nullable-required/git_push.sh create mode 100644 samples/client/petstore/java/okhttp-nullable-required/gradle.properties create mode 100644 samples/client/petstore/java/okhttp-nullable-required/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp-nullable-required/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp-nullable-required/gradlew create mode 100644 samples/client/petstore/java/okhttp-nullable-required/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp-nullable-required/pom.xml create mode 100644 samples/client/petstore/java/okhttp-nullable-required/settings.gradle create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/RetryingOAuth.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases1.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases2.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/PetWithRequiredNullableCases1Test.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/PetWithRequiredNullableCases2Test.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/.gitignore create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/.travis.yml create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/README.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/api/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/build.gradle create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/build.sbt create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesAnyType.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesArray.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesBoolean.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesInteger.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesNumber.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesObject.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesString.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/Animal.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/AnotherFakeApi.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/ArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/ArrayTest.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/BigCat.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/Capitalization.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/Cat.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/Category.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/ClassModel.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/Client.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/Dog.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/EnumArrays.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/EnumClass.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/EnumTest.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/FakeApi.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/FakeClassnameTags123Api.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/FormatTest.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/HasOnlyReadOnly.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/MapTest.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/Model200Response.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/ModelFile.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/ModelList.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/ModelReturn.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/Name.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/NumberOnly.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/Order.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/OuterComposite.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/OuterEnum.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/Pet.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/PetApi.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/ReadOnlyFirst.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/SpecialModelName.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/StoreApi.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/Tag.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/TypeHolderDefault.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/TypeHolderExample.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/User.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/UserApi.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/docs/XmlItem.md create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/git_push.sh create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/gradle.properties create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/gradlew create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/pom.xml create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/settings.gradle create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/RetryingOAuth.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Client.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Name.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/OuterEnum.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/FakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AnimalTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ArrayTestTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/BigCatTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/CapitalizationTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/CatTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ClassModelTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ClientTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/DogTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/EnumArraysTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/EnumClassTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/EnumTestTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/FormatTestTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/MapTestTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/Model200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelFileTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelListTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelReturnTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/NameTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/NumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/OuterCompositeTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/OuterEnumTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/XmlItemTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp-swagger1/.gitignore create mode 100644 samples/client/petstore/java/okhttp-swagger1/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp-swagger1/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp-swagger1/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp-swagger1/.travis.yml create mode 100644 samples/client/petstore/java/okhttp-swagger1/README.md create mode 100644 samples/client/petstore/java/okhttp-swagger1/api/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp-swagger1/build.gradle create mode 100644 samples/client/petstore/java/okhttp-swagger1/build.sbt create mode 100644 samples/client/petstore/java/okhttp-swagger1/docs/Category.md create mode 100644 samples/client/petstore/java/okhttp-swagger1/docs/CommonApi.md create mode 100644 samples/client/petstore/java/okhttp-swagger1/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/okhttp-swagger1/docs/Order.md create mode 100644 samples/client/petstore/java/okhttp-swagger1/docs/Pet.md create mode 100644 samples/client/petstore/java/okhttp-swagger1/docs/Tag.md create mode 100644 samples/client/petstore/java/okhttp-swagger1/docs/User.md create mode 100644 samples/client/petstore/java/okhttp-swagger1/git_push.sh create mode 100644 samples/client/petstore/java/okhttp-swagger1/gradle.properties create mode 100644 samples/client/petstore/java/okhttp-swagger1/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp-swagger1/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp-swagger1/gradlew create mode 100644 samples/client/petstore/java/okhttp-swagger1/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp-swagger1/pom.xml create mode 100644 samples/client/petstore/java/okhttp-swagger1/settings.gradle create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/api/CommonApi.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/RetryingOAuth.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/api/CommonApiTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp-swagger2/.gitignore create mode 100644 samples/client/petstore/java/okhttp-swagger2/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp-swagger2/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp-swagger2/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp-swagger2/.travis.yml create mode 100644 samples/client/petstore/java/okhttp-swagger2/README.md create mode 100644 samples/client/petstore/java/okhttp-swagger2/api/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp-swagger2/build.gradle create mode 100644 samples/client/petstore/java/okhttp-swagger2/build.sbt create mode 100644 samples/client/petstore/java/okhttp-swagger2/docs/Category.md create mode 100644 samples/client/petstore/java/okhttp-swagger2/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/okhttp-swagger2/docs/Order.md create mode 100644 samples/client/petstore/java/okhttp-swagger2/docs/Pet.md create mode 100644 samples/client/petstore/java/okhttp-swagger2/docs/PetApi.md create mode 100644 samples/client/petstore/java/okhttp-swagger2/docs/StoreApi.md create mode 100644 samples/client/petstore/java/okhttp-swagger2/docs/Tag.md create mode 100644 samples/client/petstore/java/okhttp-swagger2/docs/User.md create mode 100644 samples/client/petstore/java/okhttp-swagger2/docs/UserApi.md create mode 100644 samples/client/petstore/java/okhttp-swagger2/git_push.sh create mode 100644 samples/client/petstore/java/okhttp-swagger2/gradle.properties create mode 100644 samples/client/petstore/java/okhttp-swagger2/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp-swagger2/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp-swagger2/gradlew create mode 100644 samples/client/petstore/java/okhttp-swagger2/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp-swagger2/pom.xml create mode 100644 samples/client/petstore/java/okhttp-swagger2/settings.gradle create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/RetryingOAuth.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/okhttp/.github/workflows/maven.yml create mode 100644 samples/client/petstore/java/okhttp/.gitignore create mode 100644 samples/client/petstore/java/okhttp/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/okhttp/.openapi-generator/FILES create mode 100644 samples/client/petstore/java/okhttp/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/okhttp/.travis.yml create mode 100644 samples/client/petstore/java/okhttp/README.md create mode 100644 samples/client/petstore/java/okhttp/api/openapi.yaml create mode 100644 samples/client/petstore/java/okhttp/build.gradle create mode 100644 samples/client/petstore/java/okhttp/build.sbt create mode 100644 samples/client/petstore/java/okhttp/docs/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOf.md create mode 100644 samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfAttributes.md create mode 100644 samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfAttributesC.md create mode 100644 samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md create mode 100644 samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md create mode 100644 samples/client/petstore/java/okhttp/docs/AllOfRefToDouble.md create mode 100644 samples/client/petstore/java/okhttp/docs/AllOfRefToFloat.md create mode 100644 samples/client/petstore/java/okhttp/docs/AllOfRefToLong.md create mode 100644 samples/client/petstore/java/okhttp/docs/Animal.md create mode 100644 samples/client/petstore/java/okhttp/docs/AnotherFakeApi.md create mode 100644 samples/client/petstore/java/okhttp/docs/Apple.md create mode 100644 samples/client/petstore/java/okhttp/docs/AppleReq.md create mode 100644 samples/client/petstore/java/okhttp/docs/ArrayAnyOf.md create mode 100644 samples/client/petstore/java/okhttp/docs/ArrayDefault.md create mode 100644 samples/client/petstore/java/okhttp/docs/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/okhttp/docs/ArrayOfInlineAllOf.md create mode 100644 samples/client/petstore/java/okhttp/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md create mode 100644 samples/client/petstore/java/okhttp/docs/ArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/okhttp/docs/ArrayOneOf.md create mode 100644 samples/client/petstore/java/okhttp/docs/ArrayTest.md create mode 100644 samples/client/petstore/java/okhttp/docs/Banana.md create mode 100644 samples/client/petstore/java/okhttp/docs/BananaReq.md create mode 100644 samples/client/petstore/java/okhttp/docs/BasquePig.md create mode 100644 samples/client/petstore/java/okhttp/docs/Capitalization.md create mode 100644 samples/client/petstore/java/okhttp/docs/Cat.md create mode 100644 samples/client/petstore/java/okhttp/docs/Category.md create mode 100644 samples/client/petstore/java/okhttp/docs/ClassModel.md create mode 100644 samples/client/petstore/java/okhttp/docs/Client.md create mode 100644 samples/client/petstore/java/okhttp/docs/ComplexQuadrilateral.md create mode 100644 samples/client/petstore/java/okhttp/docs/DanishPig.md create mode 100644 samples/client/petstore/java/okhttp/docs/DefaultApi.md create mode 100644 samples/client/petstore/java/okhttp/docs/DeprecatedObject.md create mode 100644 samples/client/petstore/java/okhttp/docs/Dog.md create mode 100644 samples/client/petstore/java/okhttp/docs/Drawing.md create mode 100644 samples/client/petstore/java/okhttp/docs/EnumArrays.md create mode 100644 samples/client/petstore/java/okhttp/docs/EnumClass.md create mode 100644 samples/client/petstore/java/okhttp/docs/EnumStringDiscriminator.md create mode 100644 samples/client/petstore/java/okhttp/docs/EnumTest.md create mode 100644 samples/client/petstore/java/okhttp/docs/EquilateralTriangle.md create mode 100644 samples/client/petstore/java/okhttp/docs/FakeAnyOfWIthSameErasureGet200Response.md create mode 100644 samples/client/petstore/java/okhttp/docs/FakeApi.md create mode 100644 samples/client/petstore/java/okhttp/docs/FakeClassnameTags123Api.md create mode 100644 samples/client/petstore/java/okhttp/docs/FakeOneOfWIthSameErasureGet200Response.md create mode 100644 samples/client/petstore/java/okhttp/docs/FakeRefParameterPetIdParameter.md create mode 100644 samples/client/petstore/java/okhttp/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/java/okhttp/docs/Foo.md create mode 100644 samples/client/petstore/java/okhttp/docs/FooGetDefaultResponse.md create mode 100644 samples/client/petstore/java/okhttp/docs/FormatTest.md create mode 100644 samples/client/petstore/java/okhttp/docs/FreeFormObjectTestClass.md create mode 100644 samples/client/petstore/java/okhttp/docs/FreeFormObjectTestClassProperties.md create mode 100644 samples/client/petstore/java/okhttp/docs/Fruit.md create mode 100644 samples/client/petstore/java/okhttp/docs/FruitReq.md create mode 100644 samples/client/petstore/java/okhttp/docs/GmFruit.md create mode 100644 samples/client/petstore/java/okhttp/docs/GrandparentAnimal.md create mode 100644 samples/client/petstore/java/okhttp/docs/HasOnlyReadOnly.md create mode 100644 samples/client/petstore/java/okhttp/docs/HealthCheckResult.md create mode 100644 samples/client/petstore/java/okhttp/docs/IsoscelesTriangle.md create mode 100644 samples/client/petstore/java/okhttp/docs/Mammal.md create mode 100644 samples/client/petstore/java/okhttp/docs/MammalAnyof.md create mode 100644 samples/client/petstore/java/okhttp/docs/MapTest.md create mode 100644 samples/client/petstore/java/okhttp/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/okhttp/docs/Model200Response.md create mode 100644 samples/client/petstore/java/okhttp/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/okhttp/docs/ModelFile.md create mode 100644 samples/client/petstore/java/okhttp/docs/ModelList.md create mode 100644 samples/client/petstore/java/okhttp/docs/ModelReturn.md create mode 100644 samples/client/petstore/java/okhttp/docs/ModelWithOneOfAnyOfProperties.md create mode 100644 samples/client/petstore/java/okhttp/docs/Name.md create mode 100644 samples/client/petstore/java/okhttp/docs/NestedArrayWithDefaultValues.md create mode 100644 samples/client/petstore/java/okhttp/docs/NewPet.md create mode 100644 samples/client/petstore/java/okhttp/docs/NewPetCategoryInlineAllof.md create mode 100644 samples/client/petstore/java/okhttp/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md create mode 100644 samples/client/petstore/java/okhttp/docs/NullableClass.md create mode 100644 samples/client/petstore/java/okhttp/docs/NullableEnum.md create mode 100644 samples/client/petstore/java/okhttp/docs/NullableFieldsMapError.md create mode 100644 samples/client/petstore/java/okhttp/docs/NullableFieldsMapResponse.md create mode 100644 samples/client/petstore/java/okhttp/docs/NullableFieldsMapSuccess.md create mode 100644 samples/client/petstore/java/okhttp/docs/NullableFieldsValue.md create mode 100644 samples/client/petstore/java/okhttp/docs/NullableShape.md create mode 100644 samples/client/petstore/java/okhttp/docs/NumberOnly.md create mode 100644 samples/client/petstore/java/okhttp/docs/ObjectWithDeprecatedFields.md create mode 100644 samples/client/petstore/java/okhttp/docs/Order.md create mode 100644 samples/client/petstore/java/okhttp/docs/OuterComposite.md create mode 100644 samples/client/petstore/java/okhttp/docs/OuterEnum.md create mode 100644 samples/client/petstore/java/okhttp/docs/OuterEnumDefaultValue.md create mode 100644 samples/client/petstore/java/okhttp/docs/OuterEnumInteger.md create mode 100644 samples/client/petstore/java/okhttp/docs/OuterEnumIntegerDefaultValue.md create mode 100644 samples/client/petstore/java/okhttp/docs/ParentPet.md create mode 100644 samples/client/petstore/java/okhttp/docs/Pet.md create mode 100644 samples/client/petstore/java/okhttp/docs/PetApi.md create mode 100644 samples/client/petstore/java/okhttp/docs/PetComposition.md create mode 100644 samples/client/petstore/java/okhttp/docs/PetRef.md create mode 100644 samples/client/petstore/java/okhttp/docs/PetUsingAllOf.md create mode 100644 samples/client/petstore/java/okhttp/docs/PetWithRequiredTags.md create mode 100644 samples/client/petstore/java/okhttp/docs/Pig.md create mode 100644 samples/client/petstore/java/okhttp/docs/PropertyNameCollision.md create mode 100644 samples/client/petstore/java/okhttp/docs/Quadrilateral.md create mode 100644 samples/client/petstore/java/okhttp/docs/QuadrilateralInterface.md create mode 100644 samples/client/petstore/java/okhttp/docs/ReadOnlyFirst.md create mode 100644 samples/client/petstore/java/okhttp/docs/RequiredNullableBody.md create mode 100644 samples/client/petstore/java/okhttp/docs/Scalar.md create mode 100644 samples/client/petstore/java/okhttp/docs/ScalarAnyOf.md create mode 100644 samples/client/petstore/java/okhttp/docs/ScaleneTriangle.md create mode 100644 samples/client/petstore/java/okhttp/docs/Shape.md create mode 100644 samples/client/petstore/java/okhttp/docs/ShapeInterface.md create mode 100644 samples/client/petstore/java/okhttp/docs/ShapeOrNull.md create mode 100644 samples/client/petstore/java/okhttp/docs/SimpleQuadrilateral.md create mode 100644 samples/client/petstore/java/okhttp/docs/SpecialModelName.md create mode 100644 samples/client/petstore/java/okhttp/docs/StoreApi.md create mode 100644 samples/client/petstore/java/okhttp/docs/Tag.md create mode 100644 samples/client/petstore/java/okhttp/docs/TestInlineFreeformAdditionalPropertiesRequest.md create mode 100644 samples/client/petstore/java/okhttp/docs/Triangle.md create mode 100644 samples/client/petstore/java/okhttp/docs/TriangleInterface.md create mode 100644 samples/client/petstore/java/okhttp/docs/User.md create mode 100644 samples/client/petstore/java/okhttp/docs/UserApi.md create mode 100644 samples/client/petstore/java/okhttp/docs/Value.md create mode 100644 samples/client/petstore/java/okhttp/docs/ValuesApi.md create mode 100644 samples/client/petstore/java/okhttp/docs/Variable.md create mode 100644 samples/client/petstore/java/okhttp/docs/Whale.md create mode 100644 samples/client/petstore/java/okhttp/docs/Zebra.md create mode 100644 samples/client/petstore/java/okhttp/git_push.sh create mode 100644 samples/client/petstore/java/okhttp/gradle.properties create mode 100644 samples/client/petstore/java/okhttp/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/okhttp/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/okhttp/gradlew create mode 100644 samples/client/petstore/java/okhttp/gradlew.bat create mode 100644 samples/client/petstore/java/okhttp/pom.xml create mode 100644 samples/client/petstore/java/okhttp/settings.gradle create mode 100644 samples/client/petstore/java/okhttp/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiCallback.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ProgressRequestBody.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ProgressResponseBody.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/AnotherFakeApi.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/DefaultApi.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/ValuesApi.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/RetryingOAuth.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToLong.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Animal.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Apple.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AppleReq.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayAnyOf.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayDefault.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOneOf.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayTest.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Banana.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BananaReq.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BasquePig.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Capitalization.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Cat.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ClassModel.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Client.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DanishPig.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DeprecatedObject.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Dog.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Drawing.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumArrays.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumTest.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EquilateralTriangle.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Foo.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FormatTest.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Fruit.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FruitReq.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GmFruit.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GrandparentAnimal.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HealthCheckResult.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Mammal.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MammalAnyof.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MapTest.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Model200Response.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelFile.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelList.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelReturn.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Name.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPet.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableClass.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableEnum.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsValue.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableShape.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NumberOnly.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterComposite.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnum.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnumInteger.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ParentPet.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetComposition.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetRef.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetUsingAllOf.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pig.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PropertyNameCollision.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Quadrilateral.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/RequiredNullableBody.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Scalar.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScalarAnyOf.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScaleneTriangle.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Shape.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeInterface.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeOrNull.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SpecialModelName.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Triangle.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TriangleInterface.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Value.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Variable.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Whale.java create mode 100644 samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Zebra.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/DefaultApiTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/FakeApiTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/ValuesApiTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AnimalTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AppleReqTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AppleTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayTestTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/BananaReqTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/BananaTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/BasquePigTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/CapitalizationTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/CatTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ClassModelTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ClientTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DanishPigTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DogTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DrawingTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumArraysTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumClassTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumTestTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FooTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FormatTestTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FruitReqTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FruitTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/GmFruitTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MammalAnyofTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MammalTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MapTestTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/Model200ResponseTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelFileTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelListTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelReturnTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NameTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NewPetTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableClassTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableEnumTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableShapeTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NumberOnlyTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterCompositeTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ParentPetTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetCompositionTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetRefTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PigTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/QuadrilateralTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ScalarTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ShapeTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TriangleTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ValueTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/VariableTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/WhaleTest.java create mode 100644 samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ZebraTest.java diff --git a/bin/configs/java-okhttp-3.1-duplicated-operationid.yaml b/bin/configs/java-okhttp-3.1-duplicated-operationid.yaml new file mode 100644 index 000000000000..840948f2aad0 --- /dev/null +++ b/bin/configs/java-okhttp-3.1-duplicated-operationid.yaml @@ -0,0 +1,12 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp-3.1-duplicated-operationid +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_1/java/duplicated_operationid.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +validateSpec: false +additionalProperties: + artifactId: petstore-okhttp-31-do + hideGenerationTimestamp: "true" + disallowAdditionalPropertiesIfNotPresent: false +openapiNormalizer: + FIX_DUPLICATED_OPERATIONID: true diff --git a/bin/configs/java-okhttp-3.1.yaml b/bin/configs/java-okhttp-3.1.yaml new file mode 100644 index 000000000000..97e073fa0c34 --- /dev/null +++ b/bin/configs/java-okhttp-3.1.yaml @@ -0,0 +1,20 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp-3.1 +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_1/java/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +validateSpec: false +nameMappings: + _type: underscoreType + type_: typeWithUnderscore +parameterNameMappings: + _type: underscoreType + type_: typeWithUnderscore +additionalProperties: + artifactId: petstore-okhttp-31 + hideGenerationTimestamp: "true" + useOneOfDiscriminatorLookup: "true" + disallowAdditionalPropertiesIfNotPresent: false + enumPropertyNaming: legacy +openapiNormalizer: + FIX_DUPLICATED_OPERATIONID: true diff --git a/bin/configs/java-okhttp-awsv4signature.yaml b/bin/configs/java-okhttp-awsv4signature.yaml new file mode 100644 index 000000000000..fb44f3572406 --- /dev/null +++ b/bin/configs/java-okhttp-awsv4signature.yaml @@ -0,0 +1,11 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp-awsv4signature +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + artifactId: okhttp-awsv4signature + hideGenerationTimestamp: "true" + useOneOfDiscriminatorLookup: "true" + disallowAdditionalPropertiesIfNotPresent: false + withAWSV4Signature: true diff --git a/bin/configs/java-okhttp-dynamicOperations.yaml b/bin/configs/java-okhttp-dynamicOperations.yaml new file mode 100644 index 000000000000..a59bbb4fb4e2 --- /dev/null +++ b/bin/configs/java-okhttp-dynamicOperations.yaml @@ -0,0 +1,9 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp-dynamicOperations +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + artifactId: petstore-okhttp-dynamicoperations + hideGenerationTimestamp: "true" + dynamicOperations: "true" diff --git a/bin/configs/java-okhttp-echo-api.yaml b/bin/configs/java-okhttp-echo-api.yaml new file mode 100644 index 000000000000..ff869505ba04 --- /dev/null +++ b/bin/configs/java-okhttp-echo-api.yaml @@ -0,0 +1,8 @@ +generatorName: java +outputDir: samples/client/echo_api/java/okhttp +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + artifactId: echo-api-okhttp + hideGenerationTimestamp: "true" diff --git a/bin/configs/java-okhttp-group-parameter.yaml b/bin/configs/java-okhttp-group-parameter.yaml new file mode 100644 index 000000000000..cc018e0e5fe5 --- /dev/null +++ b/bin/configs/java-okhttp-group-parameter.yaml @@ -0,0 +1,10 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp-group-parameter +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-group-parameter.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + artifactId: petstore-okhttp-group-parameter + hideGenerationTimestamp: "true" + disallowAdditionalPropertiesIfNotPresent: false + useSingleRequestParameter: true diff --git a/bin/configs/java-okhttp-gson-user-defined-templates.yaml b/bin/configs/java-okhttp-gson-user-defined-templates.yaml new file mode 100644 index 000000000000..650c2dc1b195 --- /dev/null +++ b/bin/configs/java-okhttp-gson-user-defined-templates.yaml @@ -0,0 +1,17 @@ +generatorName: java +outputDir: samples/client/echo_api/java/okhttp-gson-user-defined-templates +library: okhttp-gson +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + hideGenerationTimestamp: "true" +files: + README.mustache: + destinationFilename: info.md + api_doc.mustache: + templateType: APIDocs + destinationFilename: Documentation.md + pojo.mustache: + templateType: Model + folder: modelCopy + destinationFilename: .java diff --git a/bin/configs/java-okhttp-jackson.yaml b/bin/configs/java-okhttp-jackson.yaml new file mode 100644 index 000000000000..591442357762 --- /dev/null +++ b/bin/configs/java-okhttp-jackson.yaml @@ -0,0 +1,26 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp-jackson +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +nameMappings: + _type: underscoreType + type_: typeWithUnderscore +parameterNameMappings: + _type: underscoreType + type_: typeWithUnderscore +additionalProperties: + serializationLibrary: jackson + defaultToEmptyContainer: "array?|array|map?" + artifactId: petstore-okhttp-jackson + hideGenerationTimestamp: true + useOneOfDiscriminatorLookup: true + disallowAdditionalPropertiesIfNotPresent: false + useReflectionEqualsHashCode: true + removeEnumValuePrefix: true +enumNameMappings: + s: LOWER_CASE_S + S: UPPER_CASE_S +operationIdNameMappings: + getArrayOfEnums: getFakeArrayofenums + fakeHealthGet: getFakeHealth diff --git a/bin/configs/java-okhttp-jackson3.yaml b/bin/configs/java-okhttp-jackson3.yaml new file mode 100644 index 000000000000..f6cfbb543d55 --- /dev/null +++ b/bin/configs/java-okhttp-jackson3.yaml @@ -0,0 +1,27 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp-jackson3 +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +nameMappings: + _type: underscoreType + type_: typeWithUnderscore +parameterNameMappings: + _type: underscoreType + type_: typeWithUnderscore +additionalProperties: + serializationLibrary: jackson + useJackson3: true + defaultToEmptyContainer: "array?|array|map?" + artifactId: petstore-okhttp-jackson3 + hideGenerationTimestamp: true + useOneOfDiscriminatorLookup: true + disallowAdditionalPropertiesIfNotPresent: false + useReflectionEqualsHashCode: true + removeEnumValuePrefix: true +enumNameMappings: + s: LOWER_CASE_S + S: UPPER_CASE_S +operationIdNameMappings: + getArrayOfEnums: getFakeArrayofenums + fakeHealthGet: getFakeHealth diff --git a/bin/configs/java-okhttp-jsonb.yaml b/bin/configs/java-okhttp-jsonb.yaml new file mode 100644 index 000000000000..7c09beba0903 --- /dev/null +++ b/bin/configs/java-okhttp-jsonb.yaml @@ -0,0 +1,27 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp-jsonb +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +nameMappings: + _type: underscoreType + type_: typeWithUnderscore +parameterNameMappings: + _type: underscoreType + type_: typeWithUnderscore +additionalProperties: + serializationLibrary: jsonb + useJakartaEe: true + defaultToEmptyContainer: "array?|array|map?" + artifactId: petstore-okhttp-jsonb + hideGenerationTimestamp: true + useOneOfDiscriminatorLookup: true + disallowAdditionalPropertiesIfNotPresent: false + useReflectionEqualsHashCode: true + removeEnumValuePrefix: true +enumNameMappings: + s: LOWER_CASE_S + S: UPPER_CASE_S +operationIdNameMappings: + getArrayOfEnums: getFakeArrayofenums + fakeHealthGet: getFakeHealth diff --git a/bin/configs/java-okhttp-jspecify.yaml b/bin/configs/java-okhttp-jspecify.yaml new file mode 100644 index 000000000000..65c392833045 --- /dev/null +++ b/bin/configs/java-okhttp-jspecify.yaml @@ -0,0 +1,13 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp-jspecify +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/java/okhttp-jspecify.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + artifactId: petstore-okhttp-jspecify + hideGenerationTimestamp: true + useJspecify: true + containerDefaultToNull: true +typeMappings: + OffsetDateTime: java.time.Instant + BigDecimal: java.math.BigDecimal diff --git a/bin/configs/java-okhttp-nullable-required.yaml b/bin/configs/java-okhttp-nullable-required.yaml new file mode 100644 index 000000000000..bcbea4844bf5 --- /dev/null +++ b/bin/configs/java-okhttp-nullable-required.yaml @@ -0,0 +1,10 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp-nullable-required +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-nullable-required.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + artifactId: nullable-required-okhttp + hideGenerationTimestamp: "true" + useOneOfDiscriminatorLookup: "true" + disallowAdditionalPropertiesIfNotPresent: false diff --git a/bin/configs/java-okhttp-oneOf-array.yaml b/bin/configs/java-okhttp-oneOf-array.yaml new file mode 100644 index 000000000000..0b08167db70e --- /dev/null +++ b/bin/configs/java-okhttp-oneOf-array.yaml @@ -0,0 +1,8 @@ +generatorName: java +outputDir: samples/client/others/java/okhttp-oneOf-array +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf_array.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + hideGenerationTimestamp: "true" + useBeanValidation: "true" diff --git a/bin/configs/java-okhttp-oneOf.yaml b/bin/configs/java-okhttp-oneOf.yaml new file mode 100644 index 000000000000..41349c2cb740 --- /dev/null +++ b/bin/configs/java-okhttp-oneOf.yaml @@ -0,0 +1,7 @@ +generatorName: java +outputDir: samples/client/others/java/okhttp-oneOf +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf_twoPrimitives.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + hideGenerationTimestamp: "true" diff --git a/bin/configs/java-okhttp-parcelableModel.yaml b/bin/configs/java-okhttp-parcelableModel.yaml new file mode 100644 index 000000000000..fcd784ad575b --- /dev/null +++ b/bin/configs/java-okhttp-parcelableModel.yaml @@ -0,0 +1,9 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp-parcelableModel +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + parcelableModel: "true" + artifactId: petstore-okhttp-parcelableModel + hideGenerationTimestamp: "true" diff --git a/bin/configs/java-okhttp-streaming.yaml b/bin/configs/java-okhttp-streaming.yaml new file mode 100644 index 000000000000..d05edb2dfa2b --- /dev/null +++ b/bin/configs/java-okhttp-streaming.yaml @@ -0,0 +1,11 @@ +generatorName: java +outputDir: samples/client/others/java/okhttp-streaming +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/streaming.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + artifactId: petstore-okhttp + hideGenerationTimestamp: "true" + supportStreaming: true + serializableModel: true + enumPropertyNaming: legacy diff --git a/bin/configs/java-okhttp-swagger1.yaml b/bin/configs/java-okhttp-swagger1.yaml new file mode 100644 index 000000000000..acc00784b891 --- /dev/null +++ b/bin/configs/java-okhttp-swagger1.yaml @@ -0,0 +1,13 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp-swagger1 +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + artifactId: petstore-okhttp + hideGenerationTimestamp: "true" + useOneOfDiscriminatorLookup: "true" + disallowAdditionalPropertiesIfNotPresent: false + annotationLibrary: "swagger1" +openapiNormalizer: + SET_TAGS_FOR_ALL_OPERATIONS: common diff --git a/bin/configs/java-okhttp-swagger2.yaml b/bin/configs/java-okhttp-swagger2.yaml new file mode 100644 index 000000000000..d029804c8d4c --- /dev/null +++ b/bin/configs/java-okhttp-swagger2.yaml @@ -0,0 +1,11 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp-swagger2 +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +additionalProperties: + artifactId: petstore-okhttp + hideGenerationTimestamp: "true" + useOneOfDiscriminatorLookup: "true" + disallowAdditionalPropertiesIfNotPresent: false + annotationLibrary: "swagger2" diff --git a/bin/configs/java-okhttp.yaml b/bin/configs/java-okhttp.yaml new file mode 100644 index 000000000000..936fbfbed3b6 --- /dev/null +++ b/bin/configs/java-okhttp.yaml @@ -0,0 +1,25 @@ +generatorName: java +outputDir: samples/client/petstore/java/okhttp +library: okhttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml +templateDir: modules/openapi-generator/src/main/resources/Java +nameMappings: + _type: underscoreType + type_: typeWithUnderscore +parameterNameMappings: + _type: underscoreType + type_: typeWithUnderscore +additionalProperties: + defaultToEmptyContainer: "array?|array|map?" + artifactId: petstore-okhttp + hideGenerationTimestamp: true + useOneOfDiscriminatorLookup: true + disallowAdditionalPropertiesIfNotPresent: false + useReflectionEqualsHashCode: true + removeEnumValuePrefix: true +enumNameMappings: + s: LOWER_CASE_S + S: UPPER_CASE_S +operationIdNameMappings: + getArrayOfEnums: getFakeArrayofenums + fakeHealthGet: getFakeHealth diff --git a/docs/generators/java-microprofile.md b/docs/generators/java-microprofile.md index 2dfaf5e0bcf4..5dcf4794792d 100644 --- a/docs/generators/java-microprofile.md +++ b/docs/generators/java-microprofile.md @@ -32,7 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| |camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false| -|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false| +|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2, and okhttp libraries| |false| |configKey|Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.| |null| |configKeyFromClassName|If true, set tag as key in @RegisterRestClient. Default to false. Only `microprofile` supports this option.| |null| |containerDefaultToNull|Set containers (array, set, map) default to null| |false| @@ -51,7 +51,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumPropertyNaming|Naming convention for enum properties: 'MACRO_CASE', 'legacy' and 'original'| |MACRO_CASE| |enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response. With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enums are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| -|errorObjectType|Error Object type. (This option is for okhttp-gson only)| |null| +|errorObjectType|Error Object type. (This option is for okhttp-gson and okhttp only)| |null| |failOnUnknownProperties|Fail Jackson de-serialization on unknown properties| |false| |generateBuilders|Whether to generate builders for models| |false| |generateClientAsBean|For resttemplate, restclient and webclient, configure whether to create `ApiClient.java` and Apis clients as bean (with `@Component` annotation).| |false| @@ -64,7 +64,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null| |invokerPackage|root package for generated code| |org.openapitools.client| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| -|library|library template (sub-template) to use|
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.18.9
**jersey3**
HTTP client: Jersey client 3.1.11. JSON processing: Jackson 2.x (3.x if `useJackson3=true`, requires Java 17+)
**feign**
HTTP client: OpenFeign 13.2.1. JSON processing: Jackson 2.18.9 or Gson 2.10.1
**feign-hc5**
HTTP client: OpenFeign 13.2.1/HttpClient5 5.4.2. JSON processing: Jackson 2.18.9 or Gson 2.10.1
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**retrofit2**
HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1 (Retrofit 2.5.0) or Jackson 2.18.9. Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)
**resttemplate**
HTTP client: Spring RestTemplate 5.3.33 (6.2.x if `useJakartaEe=true`, 7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.x (3.x if `useJackson3=true`)
**webclient**
HTTP client: Spring WebClient 5.1.18 (7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`)
**restclient**
HTTP client: Spring RestClient 6.1.6 (7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`)
**resteasy**
HTTP client: Resteasy client 4.7.6. JSON processing: Jackson 2.18.9
**vertx**
HTTP client: VertX client 3.5.2. JSON processing: Jackson 2.18.9
**google-api-client**
HTTP client: Google API client 2.2.0. JSON processing: Jackson 2.18.9
**rest-assured**
HTTP client: rest-assured 5.3.2. JSON processing: Gson 2.10.1 or Jackson 2.18.9. Only for Java 8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`). Only for Java11+
**microprofile**
HTTP client: Microprofile client 2.0 (default, set desired version via `microprofileRestClientVersion=x.x.x`). JSON processing: JSON-B 1.0.2 or Jackson 2.18.9
**apache-httpclient**
HTTP client: Apache httpclient 5.2.1. JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`)
|okhttp-gson| +|library|library template (sub-template) to use|
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.18.9
**jersey3**
HTTP client: Jersey client 3.1.11. JSON processing: Jackson 2.x (3.x if `useJackson3=true`, requires Java 17+)
**feign**
HTTP client: OpenFeign 13.2.1. JSON processing: Jackson 2.18.9 or Gson 2.10.1
**feign-hc5**
HTTP client: OpenFeign 13.2.1/HttpClient5 5.4.2. JSON processing: Jackson 2.18.9 or Gson 2.10.1
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**okhttp**
HTTP client: OkHttp 5.4.0. JSON processing: Gson 2.10.1, Jackson 2.x/3.x, or JSON-B. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**retrofit2**
HTTP client: OkHttp 4.11.0. JSON processing: Gson 2.10.1 (Retrofit 2.5.0) or Jackson 2.18.9. Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)
**resttemplate**
HTTP client: Spring RestTemplate 5.3.33 (6.2.x if `useJakartaEe=true`, 7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.x (3.x if `useJackson3=true`)
**webclient**
HTTP client: Spring WebClient 5.1.18 (7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`)
**restclient**
HTTP client: Spring RestClient 6.1.6 (7.x.x if `useSpringBoot4=true`). JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`)
**resteasy**
HTTP client: Resteasy client 4.7.6. JSON processing: Jackson 2.18.9
**vertx**
HTTP client: VertX client 3.5.2. JSON processing: Jackson 2.18.9
**google-api-client**
HTTP client: Google API client 2.2.0. JSON processing: Jackson 2.18.9
**rest-assured**
HTTP client: rest-assured 5.3.2. JSON processing: Gson 2.10.1 or Jackson 2.18.9. Only for Java 8
**native**
HTTP client: Java native HttpClient. JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`). Only for Java11+
**microprofile**
HTTP client: Microprofile client 2.0 (default, set desired version via `microprofileRestClientVersion=x.x.x`). JSON processing: JSON-B 1.0.2 or Jackson 2.18.9
**apache-httpclient**
HTTP client: Apache httpclient 5.2.1. JSON processing: Jackson 2.18.9 (3.x if `useJackson3=true`)
|okhttp-gson| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null| @@ -74,7 +74,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |microprofileRestClientVersion|Version of MicroProfile Rest Client API.| |null| |modelPackage|package for generated models| |org.openapitools.client.model| |openApiNullable|Enable OpenAPI Jackson Nullable library. Not supported by `microprofile` library.| |true| -|parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson library.| |false| +|parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson and okhttp libraries.| |false| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| @@ -90,7 +90,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sourceFolder|source folder for generated code| |src/main/java| |supportStreaming|Support streaming endpoint (beta)| |false| -|supportUrlQuery|Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient` libraries.| |false| +|supportUrlQuery|Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient`, `okhttp`, `feign`, `restclient`, `resttemplate`, `webclient` libraries.| |false| |supportVertxFuture|Also generate api methods that return a vertx Future instead of taking a callback. Only `vertx` supports this option. Requires vertx 4 or greater.| |false| |testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| |useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, restclient, libraries| |false| @@ -100,21 +100,21 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useGzipFeature|Send gzip-encoded requests| |false| |useJackson3|Use Jackson 3 instead of Jackson 2. Supported for 'native', 'apache-httpclient', and 'jersey3' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).| |false| |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| -|useJspecify|Use Jspecify for null checks. Only supported for [native, restclient, resttemplate, webclient]| |false| -|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson support this option.| |false| +|useJspecify|Use Jspecify for null checks. Only supported for [native, okhttp, restclient, resttemplate, webclient]| |false| +|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson, okhttp support this option.| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |usePlayWS|Use Play! Async HTTP client (Play WS API)| |false| |useReflectionEqualsHashCode|Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.| |false| -|useRuntimeException|Use RuntimeException instead of Exception. Only jersey2, jersey3, okhttp-gson, vertx, microprofile support this option.| |false| +|useRuntimeException|Use RuntimeException instead of Exception. Only jersey2, jersey3, okhttp-gson, okhttp, vertx, microprofile support this option.| |false| |useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false| |useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false| |useSealedOneOfInterfaces|Generate the oneOf interfaces as sealed interfaces. Only supported for WebClient, RestClient and Microprofile (with Jackson).| |false| -|useSingleRequestParameter|Setting this property to "true" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY native, jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to "static" does the same as "true", but also makes the generated arguments class static with single parameter instantiation.| |false| +|useSingleRequestParameter|Setting this property to "true" will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY native, jersey2, jersey3, okhttp-gson, okhttp, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to "static" does the same as "true", but also makes the generated arguments class static with single parameter instantiation.| |false| |useSpringBoot4|Generate code and provide dependencies for use with Spring Boot 4.x.| |false| |useUnaryInterceptor|If true it will generate ResponseInterceptors using a UnaryOperator. This can be usefull for manipulating the request before it gets passed, for example doing your own decryption| |false| |useVertx5|Whether to use Vert.x 5 syntax.| |false| |webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false| -|withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false| +|withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson and okhttp libraries)| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| ## SUPPORTED VENDOR EXTENSIONS diff --git a/docs/generators/java.md b/docs/generators/java.md index 6c716e0189b7..8115baee4fa8 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -11,7 +11,7 @@ title: Documentation for the java Generator | generator type | CLIENT | | | generator language | Java | | | generator default templating engine | mustache | | -| helpTxt | Generates a Java client library (HTTP lib: Jersey (1.x, 2.x), Retrofit (2.x), OpenFeign (10.x), OkHttp and more. | | +| helpTxt | Generates a Java client library (HTTP lib: Jersey (1.x, 2.x), Retrofit (2.x), OpenFeign (10.x) and more. | | ## CONFIG OPTIONS These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. @@ -98,9 +98,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useDeductionForOneOfInterfaces|Annotate discriminator-free oneOf interfaces with Jackson's @JsonTypeInfo(use = Id.DEDUCTION) and @JsonSubTypes so the concrete subtype is resolved from the JSON field set rather than a type-tag property. Has no effect when a discriminator is present (name-based resolution is used instead). Requires subtypes to have structurally distinct sets of properties.| |false| |useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false| |useGzipFeature|Send gzip-encoded requests| |false| -|useJackson3|Use Jackson 3 instead of Jackson 2. Supported for 'native', 'apache-httpclient', 'jersey3', and 'okhttp' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).| |false| +|useJackson3|Use Jackson 3 instead of Jackson 2. Supported for 'native', 'apache-httpclient', and 'jersey3' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).| |false| |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| -|useJspecify|Use Jspecify for null checks. Only supported for [native, restclient, resttemplate, webclient, okhttp]| |false| +|useJspecify|Use Jspecify for null checks. Only supported for [native, okhttp, restclient, resttemplate, webclient]| |false| |useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson, okhttp support this option.| |false| |useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false| |usePlayWS|Use Play! Async HTTP client (Play WS API)| |false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 4285999dbf02..69e47f662a89 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -281,7 +281,7 @@ public JavaClientCodegen() { cliOptions.add(CliOption.newBoolean(SUPPORT_URL_QUERY, "Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient`, `okhttp`, `feign`, `restclient`, `resttemplate`, `webclient` libraries.")); cliOptions.add(CliOption.newBoolean(USE_ENUM_CASE_INSENSITIVE, "Use `equalsIgnoreCase` when String for enum comparison", useEnumCaseInsensitive)); cliOptions.add(CliOption.newBoolean(FAIL_ON_UNKNOWN_PROPERTIES, "Fail Jackson de-serialization on unknown properties", this.failOnUnknownProperties)); - cliOptions.add(CliOption.newBoolean(USE_JACKSON_3, "Use Jackson 3 instead of Jackson 2. Supported for 'native', 'apache-httpclient', and 'jersey3' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).", this.useJackson3)); + cliOptions.add(CliOption.newBoolean(USE_JACKSON_3, "Use Jackson 3 instead of Jackson 2. Supported for 'native', 'apache-httpclient', 'jersey3', and 'okhttp' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).", this.useJackson3)); cliOptions.add(CliOption.newBoolean(SUPPORT_VERTX_FUTURE, "Also generate api methods that return a vertx Future instead of taking a callback. Only `vertx` supports this option. Requires vertx 4 or greater.", this.supportVertxFuture)); cliOptions.add(CliOption.newBoolean(USE_SEALED_ONE_OF_INTERFACES, "Generate the oneOf interfaces as sealed interfaces. Only supported for WebClient, RestClient and Microprofile (with Jackson).", this.useSealedOneOfInterfaces)); cliOptions.add(CliOption.newBoolean(USE_UNARY_INTERCEPTOR, "If true it will generate ResponseInterceptors using a UnaryOperator. This can be usefull for manipulating the request before it gets passed, for example doing your own decryption", this.useUnaryInterceptor)); @@ -357,7 +357,7 @@ public String getName() { @Override public String getHelp() { - return "Generates a Java client library (HTTP lib: Jersey (1.x, 2.x), Retrofit (2.x), OpenFeign (10.x) and more."; + return "Generates a Java client library (HTTP lib: Jersey (1.x, 2.x), Retrofit (2.x), OpenFeign (10.x), OkHttp and more."; } @Override diff --git a/modules/openapi-generator/src/test/resources/3_0/java/okhttp-jspecify.yaml b/modules/openapi-generator/src/test/resources/3_0/java/okhttp-jspecify.yaml new file mode 100644 index 000000000000..a110f078d0c4 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/java/okhttp-jspecify.yaml @@ -0,0 +1,88 @@ +openapi: 3.0.0 +info: + description: test fully qualified name and jspecify + title: jspecify + version: 1.0.0 +paths: + /foo/{dtParam}: + get: + parameters: + - in: path + name: dtParam + required: true + schema: + type: string + format: date-time + - in: query + name: dtQuery + schema: + type: string + format: date-time + - in: cookie + name: dtCookie + schema: + type: string + format: date-time + responses: + default: + description: response + content: + application/json: + schema: + $ref: '#/components/schemas/Foo' + /upload: + post: + requestBody: + description: file + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + responses: + default: + description: ok + + /file/{id}: + get: + parameters: + - in: path + name: id + required: true + schema: + type: string + responses: + '200': + description: ok + +components: + schemas: + Foo: + required: + - requiredDt + properties: + dt: + type: string + format: date-time + binary: + type: string + format: binary + listOfDt: + type: array + items: + type: string + format: date-time + listMinIntems: + type: array + minItems: 1 + items: + type: string + format: date-time + requiredDt: + type: string + format: date-time + number: + type: number diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Category.java b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Category.java index a0128b59662f..e9e0ff127ede 100644 --- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Category.java @@ -100,6 +100,50 @@ public void setName(@javax.annotation.Nullable String name) { this.name = name; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } Category category = (Category) o; return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); + Objects.equals(this.name, category.name)&& + Objects.equals(this.additionalProperties, category.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, name); + return Objects.hash(id, name, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class Category {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -162,14 +208,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Category.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Category` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); @@ -191,6 +229,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Category value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -198,7 +258,28 @@ public void write(JsonWriter out, Category value) throws IOException { public Category read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 5d4c64a1c89b..d5fc1e3babcb 100644 --- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -124,6 +124,50 @@ public void setMessage(@javax.annotation.Nullable String message) { this.message = message; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -137,12 +181,13 @@ public boolean equals(Object o) { ModelApiResponse _apiResponse = (ModelApiResponse) o; return Objects.equals(this.code, _apiResponse.code) && Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message); + Objects.equals(this.message, _apiResponse.message)&& + Objects.equals(this.additionalProperties, _apiResponse.additionalProperties); } @Override public int hashCode() { - return Objects.hash(code, type, message); + return Objects.hash(code, type, message, additionalProperties); } @Override @@ -152,6 +197,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -188,14 +234,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ModelApiResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ModelApiResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); @@ -220,6 +258,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ModelApiResponse value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -227,7 +287,28 @@ public void write(JsonWriter out, ModelApiResponse value) throws IOException { public ModelApiResponse read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelApiResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Order.java b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Order.java index 08f162eacb66..f98ad4569edf 100644 --- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Order.java @@ -251,6 +251,50 @@ public void setComplete(@javax.annotation.Nullable Boolean complete) { this.complete = complete; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -267,12 +311,13 @@ public boolean equals(Object o) { Objects.equals(this.quantity, order.quantity) && Objects.equals(this.shipDate, order.shipDate) && Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete); + Objects.equals(this.complete, order.complete)&& + Objects.equals(this.additionalProperties, order.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, petId, quantity, shipDate, status, complete); + return Objects.hash(id, petId, quantity, shipDate, status, complete, additionalProperties); } @Override @@ -285,6 +330,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -321,14 +367,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Order.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Order` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); @@ -354,6 +392,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Order value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -361,7 +421,28 @@ public void write(JsonWriter out, Order value) throws IOException { public Order read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Order instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Pet.java index 8aa97551b066..36e7b36187a7 100644 --- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Pet.java @@ -275,6 +275,50 @@ public void setStatus(@javax.annotation.Nullable StatusEnum status) { this.status = status; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -291,12 +335,13 @@ public boolean equals(Object o) { Objects.equals(this.name, pet.name) && Objects.equals(this.photoUrls, pet.photoUrls) && Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); + Objects.equals(this.status, pet.status)&& + Objects.equals(this.additionalProperties, pet.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, category, name, photoUrls, tags, status); + return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); } @Override @@ -309,6 +354,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -346,14 +392,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Pet.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Pet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Pet.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -412,6 +450,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Pet value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -419,7 +479,28 @@ public void write(JsonWriter out, Pet value) throws IOException { public Pet read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Tag.java index bef647c981ae..5c6a2dcf6e64 100644 --- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/Tag.java @@ -100,6 +100,50 @@ public void setName(@javax.annotation.Nullable String name) { this.name = name; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } Tag tag = (Tag) o; return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); + Objects.equals(this.name, tag.name)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, name); + return Objects.hash(id, name, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class Tag {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -162,14 +208,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Tag.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Tag` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); @@ -191,6 +229,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Tag value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -198,7 +258,28 @@ public void write(JsonWriter out, Tag value) throws IOException { public Tag read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/User.java b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/User.java index 6cad6efb84b5..e44eb2d5e17c 100644 --- a/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/model/User.java @@ -244,6 +244,50 @@ public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { this.userStatus = userStatus; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -262,12 +306,13 @@ public boolean equals(Object o) { Objects.equals(this.email, user.email) && Objects.equals(this.password, user.password) && Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); + Objects.equals(this.userStatus, user.userStatus)&& + Objects.equals(this.additionalProperties, user.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, additionalProperties); } @Override @@ -282,6 +327,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -318,14 +364,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!User.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `User` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); @@ -362,6 +400,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, User value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -369,7 +429,28 @@ public void write(JsonWriter out, User value) throws IOException { public User read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Bird.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Bird.java index f55bf8309cc0..d09bb2e55fd6 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Bird.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Bird.java @@ -100,6 +100,50 @@ public void setColor(@javax.annotation.Nullable String color) { this.color = color; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Bird instance itself + */ + public Bird putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } Bird bird = (Bird) o; return Objects.equals(this.size, bird.size) && - Objects.equals(this.color, bird.color); + Objects.equals(this.color, bird.color)&& + Objects.equals(this.additionalProperties, bird.additionalProperties); } @Override public int hashCode() { - return Objects.hash(size, color); + return Objects.hash(size, color, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class Bird {\n"); sb.append(" size: ").append(toIndentedString(size)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -162,14 +208,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Bird is not found in the empty JSON string", Bird.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Bird.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Bird` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("size") != null && !jsonObj.get("size").isJsonNull()) && !jsonObj.get("size").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `size` to be a primitive type in the JSON string but got `%s`", jsonObj.get("size").toString())); @@ -194,6 +232,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Bird value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -201,7 +261,28 @@ public void write(JsonWriter out, Bird value) throws IOException { public Bird read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Bird instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java index 5f7919e6fe85..6c9ba27f14ab 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java @@ -100,6 +100,50 @@ public void setName(@javax.annotation.Nullable String name) { this.name = name; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } Category category = (Category) o; return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); + Objects.equals(this.name, category.name)&& + Objects.equals(this.additionalProperties, category.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, name); + return Objects.hash(id, name, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class Category {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -162,14 +208,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Category.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Category` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); @@ -191,6 +229,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Category value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -198,7 +258,28 @@ public void write(JsonWriter out, Category value) throws IOException { public Category read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/DataQuery.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/DataQuery.java index b7230dfbed7e..ff4c3275c665 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/DataQuery.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/DataQuery.java @@ -128,6 +128,50 @@ public void setDate(@javax.annotation.Nullable OffsetDateTime date) { this.date = date; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DataQuery instance itself + */ + public DataQuery putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -141,13 +185,14 @@ public boolean equals(Object o) { DataQuery dataQuery = (DataQuery) o; return Objects.equals(this.suffix, dataQuery.suffix) && Objects.equals(this.text, dataQuery.text) && - Objects.equals(this.date, dataQuery.date) && + Objects.equals(this.date, dataQuery.date)&& + Objects.equals(this.additionalProperties, dataQuery.additionalProperties) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(suffix, text, date, super.hashCode()); + return Objects.hash(suffix, text, date, super.hashCode(), additionalProperties); } @Override @@ -158,6 +203,7 @@ public String toString() { sb.append(" suffix: ").append(toIndentedString(suffix)).append("\n"); sb.append(" text: ").append(toIndentedString(text)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -194,14 +240,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in DataQuery is not found in the empty JSON string", DataQuery.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!DataQuery.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `DataQuery` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("suffix") != null && !jsonObj.get("suffix").isJsonNull()) && !jsonObj.get("suffix").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `suffix` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suffix").toString())); @@ -226,6 +264,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, DataQuery value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -233,7 +293,28 @@ public void write(JsonWriter out, DataQuery value) throws IOException { public DataQuery read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DataQuery instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/DefaultValue.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/DefaultValue.java index f06dedbc764b..d4fa5b17b0d5 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/DefaultValue.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/DefaultValue.java @@ -358,6 +358,50 @@ public void setStringNullable(@javax.annotation.Nullable String stringNullable) this.stringNullable = stringNullable; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DefaultValue instance itself + */ + public DefaultValue putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -376,7 +420,8 @@ public boolean equals(Object o) { Objects.equals(this.arrayString, defaultValue.arrayString) && Objects.equals(this.arrayStringNullable, defaultValue.arrayStringNullable) && Objects.equals(this.arrayStringExtensionNullable, defaultValue.arrayStringExtensionNullable) && - Objects.equals(this.stringNullable, defaultValue.stringNullable); + Objects.equals(this.stringNullable, defaultValue.stringNullable)&& + Objects.equals(this.additionalProperties, defaultValue.additionalProperties); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -385,7 +430,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(arrayStringEnumRefDefault, arrayStringEnumDefault, arrayStringDefault, arrayIntegerDefault, arrayString, arrayStringNullable, arrayStringExtensionNullable, stringNullable); + return Objects.hash(arrayStringEnumRefDefault, arrayStringEnumDefault, arrayStringDefault, arrayIntegerDefault, arrayString, arrayStringNullable, arrayStringExtensionNullable, stringNullable, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -407,6 +452,7 @@ public String toString() { sb.append(" arrayStringNullable: ").append(toIndentedString(arrayStringNullable)).append("\n"); sb.append(" arrayStringExtensionNullable: ").append(toIndentedString(arrayStringExtensionNullable)).append("\n"); sb.append(" stringNullable: ").append(toIndentedString(stringNullable)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -443,14 +489,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in DefaultValue is not found in the empty JSON string", DefaultValue.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!DefaultValue.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `DefaultValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the optional json data is an array if present if (jsonObj.get("array_string_enum_ref_default") != null && !jsonObj.get("array_string_enum_ref_default").isJsonNull() && !jsonObj.get("array_string_enum_ref_default").isJsonArray()) { @@ -500,6 +538,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, DefaultValue value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -507,7 +567,28 @@ public void write(JsonWriter out, DefaultValue value) throws IOException { public DefaultValue read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DefaultValue instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java index 90d5ccffa423..c85b9cfea7d7 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java @@ -127,6 +127,50 @@ public void setDouble(@javax.annotation.Nullable Double _double) { this._double = _double; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NumberPropertiesOnly instance itself + */ + public NumberPropertiesOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -140,12 +184,13 @@ public boolean equals(Object o) { NumberPropertiesOnly numberPropertiesOnly = (NumberPropertiesOnly) o; return Objects.equals(this.number, numberPropertiesOnly.number) && Objects.equals(this._float, numberPropertiesOnly._float) && - Objects.equals(this._double, numberPropertiesOnly._double); + Objects.equals(this._double, numberPropertiesOnly._double)&& + Objects.equals(this.additionalProperties, numberPropertiesOnly.additionalProperties); } @Override public int hashCode() { - return Objects.hash(number, _float, _double); + return Objects.hash(number, _float, _double, additionalProperties); } @Override @@ -155,6 +200,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -191,14 +237,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NumberPropertiesOnly is not found in the empty JSON string", NumberPropertiesOnly.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!NumberPropertiesOnly.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `NumberPropertiesOnly` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); } @@ -217,6 +255,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, NumberPropertiesOnly value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -224,7 +284,28 @@ public void write(JsonWriter out, NumberPropertiesOnly value) throws IOException public NumberPropertiesOnly read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NumberPropertiesOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java index 284026bbb34d..cb12d98a374f 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java @@ -270,6 +270,50 @@ public void setStatus(@javax.annotation.Nullable StatusEnum status) { this.status = status; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -286,12 +330,13 @@ public boolean equals(Object o) { Objects.equals(this.category, pet.category) && Objects.equals(this.photoUrls, pet.photoUrls) && Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); + Objects.equals(this.status, pet.status)&& + Objects.equals(this.additionalProperties, pet.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, name, category, photoUrls, tags, status); + return Objects.hash(id, name, category, photoUrls, tags, status, additionalProperties); } @Override @@ -304,6 +349,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -341,14 +387,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Pet.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Pet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Pet.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -407,6 +445,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Pet value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -414,7 +474,28 @@ public void write(JsonWriter out, Pet value) throws IOException { public Pet read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Query.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Query.java index 767589f04f9a..2d46922b38e7 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Query.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Query.java @@ -164,6 +164,50 @@ public void setOutcomes(@javax.annotation.Nullable List outcomes) this.outcomes = outcomes; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Query instance itself + */ + public Query putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -176,12 +220,13 @@ public boolean equals(Object o) { } Query query = (Query) o; return Objects.equals(this.id, query.id) && - Objects.equals(this.outcomes, query.outcomes); + Objects.equals(this.outcomes, query.outcomes)&& + Objects.equals(this.additionalProperties, query.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, outcomes); + return Objects.hash(id, outcomes, additionalProperties); } @Override @@ -190,6 +235,7 @@ public String toString() { sb.append("class Query {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" outcomes: ").append(toIndentedString(outcomes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java index 3351b617eb5c..596a49a95b87 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java @@ -100,6 +100,50 @@ public void setName(@javax.annotation.Nullable String name) { this.name = name; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } Tag tag = (Tag) o; return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); + Objects.equals(this.name, tag.name)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, name); + return Objects.hash(id, name, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class Tag {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -162,14 +208,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Tag.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Tag` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); @@ -191,6 +229,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Tag value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -198,7 +258,28 @@ public void write(JsonWriter out, Tag value) throws IOException { public Tag read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java index a67c4555852b..43179f0d842c 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java @@ -76,6 +76,50 @@ public void setName(@javax.annotation.Nullable String name) { this.name = name; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TestFormObjectMultipartRequestMarker instance itself + */ + public TestFormObjectMultipartRequestMarker putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } TestFormObjectMultipartRequestMarker testFormObjectMultipartRequestMarker = (TestFormObjectMultipartRequestMarker) o; - return Objects.equals(this.name, testFormObjectMultipartRequestMarker.name); + return Objects.equals(this.name, testFormObjectMultipartRequestMarker.name)&& + Objects.equals(this.additionalProperties, testFormObjectMultipartRequestMarker.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(name, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TestFormObjectMultipartRequestMarker {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -136,14 +182,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TestFormObjectMultipartRequestMarker is not found in the empty JSON string", TestFormObjectMultipartRequestMarker.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TestFormObjectMultipartRequestMarker.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TestFormObjectMultipartRequestMarker` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); @@ -165,6 +203,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TestFormObjectMultipartRequestMarker value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -172,7 +232,28 @@ public void write(JsonWriter out, TestFormObjectMultipartRequestMarker value) th public TestFormObjectMultipartRequestMarker read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TestFormObjectMultipartRequestMarker instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java index 9cced6c441bd..217e2a38e761 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java @@ -148,6 +148,50 @@ public void setName(@javax.annotation.Nullable String name) { this.name = name; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter instance itself + */ + public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -162,12 +206,13 @@ public boolean equals(Object o) { return Objects.equals(this.size, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.size) && Objects.equals(this.color, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.color) && Objects.equals(this.id, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.id) && - Objects.equals(this.name, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.name); + Objects.equals(this.name, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.name)&& + Objects.equals(this.additionalProperties, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.additionalProperties); } @Override public int hashCode() { - return Objects.hash(size, color, id, name); + return Objects.hash(size, color, id, name, additionalProperties); } @Override @@ -178,6 +223,7 @@ public String toString() { sb.append(" color: ").append(toIndentedString(color)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -214,14 +260,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter is not found in the empty JSON string", TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("size") != null && !jsonObj.get("size").isJsonNull()) && !jsonObj.get("size").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `size` to be a primitive type in the JSON string but got `%s`", jsonObj.get("size").toString())); @@ -249,6 +287,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -256,7 +316,28 @@ public void write(JsonWriter out, TestQueryStyleDeepObjectExplodeTrueObjectAllOf public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java index d20e001a5552..b196e9898543 100644 --- a/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java +++ b/samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java @@ -86,6 +86,50 @@ public void setValues(@javax.annotation.Nullable List values) { this.values = values; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter instance itself + */ + public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -97,12 +141,13 @@ public boolean equals(Object o) { return false; } TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter testQueryStyleFormExplodeTrueArrayStringQueryObjectParameter = (TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) o; - return Objects.equals(this.values, testQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.values); + return Objects.equals(this.values, testQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.values)&& + Objects.equals(this.additionalProperties, testQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.additionalProperties); } @Override public int hashCode() { - return Objects.hash(values); + return Objects.hash(values, additionalProperties); } @Override @@ -110,6 +155,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {\n"); sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -146,14 +192,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter is not found in the empty JSON string", TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the optional json data is an array if present if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { @@ -176,6 +214,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -183,7 +243,28 @@ public void write(JsonWriter out, TestQueryStyleFormExplodeTrueArrayStringQueryO public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/echo_api/java/okhttp/.github/workflows/maven.yml b/samples/client/echo_api/java/okhttp/.github/workflows/maven.yml new file mode 100644 index 000000000000..543a3007900a --- /dev/null +++ b/samples/client/echo_api/java/okhttp/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build Echo Server API + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/echo_api/java/okhttp/.gitignore b/samples/client/echo_api/java/okhttp/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/echo_api/java/okhttp/.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/client/echo_api/java/okhttp/.openapi-generator-ignore b/samples/client/echo_api/java/okhttp/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/.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/client/echo_api/java/okhttp/.openapi-generator/FILES b/samples/client/echo_api/java/okhttp/.openapi-generator/FILES new file mode 100644 index 000000000000..92c9a620b940 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/.openapi-generator/FILES @@ -0,0 +1,81 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/AuthApi.md +docs/Bird.md +docs/BodyApi.md +docs/Category.md +docs/DataQuery.md +docs/DefaultValue.md +docs/FormApi.md +docs/HeaderApi.md +docs/NumberPropertiesOnly.md +docs/PathApi.md +docs/Pet.md +docs/Query.md +docs/QueryApi.md +docs/StringEnumRef.md +docs/Tag.md +docs/TestFormObjectMultipartRequestMarker.md +docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md +docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/AuthApi.java +src/main/java/org/openapitools/client/api/BodyApi.java +src/main/java/org/openapitools/client/api/FormApi.java +src/main/java/org/openapitools/client/api/HeaderApi.java +src/main/java/org/openapitools/client/api/PathApi.java +src/main/java/org/openapitools/client/api/QueryApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/Bird.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/DataQuery.java +src/main/java/org/openapitools/client/model/DefaultValue.java +src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/Query.java +src/main/java/org/openapitools/client/model/StringEnumRef.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java +src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java +src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java +src/test/java/org/openapitools/client/api/AuthApiTest.java +src/test/java/org/openapitools/client/api/BodyApiTest.java +src/test/java/org/openapitools/client/api/FormApiTest.java +src/test/java/org/openapitools/client/api/HeaderApiTest.java +src/test/java/org/openapitools/client/api/PathApiTest.java +src/test/java/org/openapitools/client/api/QueryApiTest.java +src/test/java/org/openapitools/client/model/StringEnumRefTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java +src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java +src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java diff --git a/samples/client/echo_api/java/okhttp/.openapi-generator/VERSION b/samples/client/echo_api/java/okhttp/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/echo_api/java/okhttp/.travis.yml b/samples/client/echo_api/java/okhttp/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/.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/client/echo_api/java/okhttp/README.md b/samples/client/echo_api/java/okhttp/README.md new file mode 100644 index 000000000000..9be234ee3d2c --- /dev/null +++ b/samples/client/echo_api/java/okhttp/README.md @@ -0,0 +1,191 @@ +# echo-api-okhttp + +Echo Server API +- API version: 0.1.0 + - Generator version: 7.24.0-SNAPSHOT + +Echo Server API + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + echo-api-okhttp + 0.1.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'echo-api-okhttp' jar has been published to maven central. + mavenLocal() // Needed if the 'echo-api-okhttp' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:echo-api-okhttp:0.1.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/echo-api-okhttp-0.1.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.AuthApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + // Configure HTTP basic authorization: http_auth + HttpBasicAuth http_auth = (HttpBasicAuth) defaultClient.getAuthentication("http_auth"); + http_auth.setUsername("YOUR USERNAME"); + http_auth.setPassword("YOUR PASSWORD"); + + AuthApi apiInstance = new AuthApi(defaultClient); + try { + String result = apiInstance.testAuthHttpBasic(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AuthApi#testAuthHttpBasic"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:3000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AuthApi* | [**testAuthHttpBasic**](docs/AuthApi.md#testAuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication +*AuthApi* | [**testAuthHttpBearer**](docs/AuthApi.md#testAuthHttpBearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication +*BodyApi* | [**testBinaryGif**](docs/BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body +*BodyApi* | [**testBodyApplicationOctetstreamBinary**](docs/BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) +*BodyApi* | [**testBodyMultipartFormdataArrayOfBinary**](docs/BodyApi.md#testBodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime +*BodyApi* | [**testBodyMultipartFormdataSingleBinary**](docs/BodyApi.md#testBodyMultipartFormdataSingleBinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime +*BodyApi* | [**testEchoBodyAllOfPet**](docs/BodyApi.md#testEchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s) +*BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object +*BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) +*BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body +*BodyApi* | [**testEchoBodyStringEnum**](docs/BodyApi.md#testEchoBodyStringEnum) | **POST** /echo/body/string_enum | Test string enum response body +*BodyApi* | [**testEchoBodyTagResponseString**](docs/BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body) +*FormApi* | [**testFormIntegerBooleanString**](docs/FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) +*FormApi* | [**testFormObjectMultipart**](docs/FormApi.md#testFormObjectMultipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema +*FormApi* | [**testFormOneof**](docs/FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema +*HeaderApi* | [**testHeaderIntegerBooleanStringEnums**](docs/HeaderApi.md#testHeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) +*PathApi* | [**testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](docs/PathApi.md#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) +*QueryApi* | [**testEnumRefString**](docs/QueryApi.md#testEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s) +*QueryApi* | [**testQueryDatetimeDateString**](docs/QueryApi.md#testQueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s) +*QueryApi* | [**testQueryIntegerBooleanString**](docs/QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s) +*QueryApi* | [**testQueryStyleDeepObjectExplodeTrueObject**](docs/QueryApi.md#testQueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) +*QueryApi* | [**testQueryStyleDeepObjectExplodeTrueObjectAllOf**](docs/QueryApi.md#testQueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) +*QueryApi* | [**testQueryStyleFormExplodeFalseArrayInteger**](docs/QueryApi.md#testQueryStyleFormExplodeFalseArrayInteger) | **GET** /query/style_form/explode_false/array_integer | Test query parameter(s) +*QueryApi* | [**testQueryStyleFormExplodeFalseArrayString**](docs/QueryApi.md#testQueryStyleFormExplodeFalseArrayString) | **GET** /query/style_form/explode_false/array_string | Test query parameter(s) +*QueryApi* | [**testQueryStyleFormExplodeTrueArrayString**](docs/QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +*QueryApi* | [**testQueryStyleFormExplodeTrueObject**](docs/QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) +*QueryApi* | [**testQueryStyleFormExplodeTrueObjectAllOf**](docs/QueryApi.md#testQueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) +*QueryApi* | [**testQueryStyleJsonSerializationObject**](docs/QueryApi.md#testQueryStyleJsonSerializationObject) | **GET** /query/style_jsonSerialization/object | Test query parameter(s) + + +## Documentation for Models + + - [Bird](docs/Bird.md) + - [Category](docs/Category.md) + - [DataQuery](docs/DataQuery.md) + - [DefaultValue](docs/DefaultValue.md) + - [NumberPropertiesOnly](docs/NumberPropertiesOnly.md) + - [Pet](docs/Pet.md) + - [Query](docs/Query.md) + - [StringEnumRef](docs/StringEnumRef.md) + - [Tag](docs/Tag.md) + - [TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md) + - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) + - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### http_auth + +- **Type**: HTTP basic authentication + + +### http_bearer_auth + +- **Type**: HTTP Bearer Token authentication + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + +team@openapitools.org + diff --git a/samples/client/echo_api/java/okhttp/api/openapi.yaml b/samples/client/echo_api/java/okhttp/api/openapi.yaml new file mode 100644 index 000000000000..3db61941ab2c --- /dev/null +++ b/samples/client/echo_api/java/okhttp/api/openapi.yaml @@ -0,0 +1,1037 @@ +openapi: 3.0.3 +info: + contact: + email: team@openapitools.org + description: Echo Server API + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: Echo Server API + version: 0.1.0 +servers: +- url: http://localhost:3000/ +paths: + /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}: + get: + description: Test path parameter(s) + operationId: "tests/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}" + parameters: + - explode: false + in: path + name: path_string + required: true + schema: + type: string + style: simple + - explode: false + in: path + name: path_integer + required: true + schema: + type: integer + style: simple + - explode: false + in: path + name: enum_nonref_string_path + required: true + schema: + enum: + - success + - failure + - unclassified + type: string + style: simple + - explode: false + in: path + name: enum_ref_string_path + required: true + schema: + $ref: "#/components/schemas/StringEnumRef" + style: simple + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test path parameter(s) + tags: + - path + x-accepts: + - text/plain + /form/integer/boolean/string: + post: + description: Test form parameter(s) + operationId: test/form/integer/boolean/string + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/test_form_integer_boolean_string_request" + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test form parameter(s) + tags: + - form + x-content-type: application/x-www-form-urlencoded + x-accepts: + - text/plain + /form/oneof: + post: + description: Test form parameter(s) for oneOf schema + operationId: test/form/oneof + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/test_form_oneof_request" + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test form parameter(s) for oneOf schema + tags: + - form + x-content-type: application/x-www-form-urlencoded + x-accepts: + - text/plain + /form/object/multipart: + post: + description: Test form parameter(s) for multipart schema + operationId: test/form/object/multipart + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/test_form_object_multipart_request" + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test form parameter(s) for multipart schema + tags: + - form + x-content-type: multipart/form-data + x-accepts: + - text/plain + /header/integer/boolean/string/enums: + get: + description: Test header parameter(s) + operationId: test/header/integer/boolean/string/enums + parameters: + - explode: true + in: header + name: integer_header + required: false + schema: + type: integer + style: form + - explode: true + in: header + name: boolean_header + required: false + schema: + type: boolean + style: form + - explode: true + in: header + name: string_header + required: false + schema: + type: string + style: form + - explode: true + in: header + name: enum_nonref_string_header + required: false + schema: + enum: + - success + - failure + - unclassified + type: string + style: form + - explode: true + in: header + name: enum_ref_string_header + required: false + schema: + $ref: "#/components/schemas/StringEnumRef" + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test header parameter(s) + tags: + - header + x-accepts: + - text/plain + /query/enum_ref_string: + get: + description: Test query parameter(s) + operationId: test/enum_ref_string + parameters: + - explode: true + in: query + name: enum_nonref_string_query + required: false + schema: + enum: + - success + - failure + - unclassified + type: string + style: form + - explode: true + in: query + name: enum_ref_string_query + required: false + schema: + $ref: "#/components/schemas/StringEnumRef" + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + x-accepts: + - text/plain + /query/datetime/date/string: + get: + description: Test query parameter(s) + operationId: test/query/datetime/date/string + parameters: + - explode: true + in: query + name: datetime_query + required: false + schema: + format: date-time + type: string + style: form + - explode: true + in: query + name: date_query + required: false + schema: + format: date + type: string + style: form + - explode: true + in: query + name: string_query + required: false + schema: + type: string + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + x-accepts: + - text/plain + /query/integer/boolean/string: + get: + description: Test query parameter(s) + operationId: test/query/integer/boolean/string + parameters: + - explode: true + in: query + name: integer_query + required: false + schema: + type: integer + style: form + - explode: true + in: query + name: boolean_query + required: false + schema: + type: boolean + style: form + - explode: true + in: query + name: string_query + required: false + schema: + type: string + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + x-accepts: + - text/plain + /query/style_form/explode_true/array_string: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_true/array_string + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: "#/components/schemas/test_query_style_form_explode_true_array_string_query_object_parameter" + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + x-accepts: + - text/plain + /query/style_form/explode_false/array_integer: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_false/array_integer + parameters: + - explode: false + in: query + name: query_object + required: false + schema: + items: + type: integer + type: array + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + x-accepts: + - text/plain + /query/style_form/explode_false/array_string: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_false/array_string + parameters: + - explode: false + in: query + name: query_object + required: false + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + x-accepts: + - text/plain + /query/style_form/explode_true/object: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_true/object + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: "#/components/schemas/Pet" + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + x-accepts: + - text/plain + /query/style_form/explode_true/object/allOf: + get: + description: Test query parameter(s) + operationId: test/query/style_form/explode_true/object/allOf + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: "#/components/schemas/DataQuery" + style: form + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + x-accepts: + - text/plain + /query/style_deepObject/explode_true/object: + get: + description: Test query parameter(s) + operationId: test/query/style_deepObject/explode_true/object + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: "#/components/schemas/Pet" + style: deepObject + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + x-accepts: + - text/plain + /query/style_deepObject/explode_true/object/allOf: + get: + description: Test query parameter(s) + operationId: test/query/style_deepObject/explode_true/object/allOf + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: "#/components/schemas/test_query_style_deepObject_explode_true_object_allOf_query_object_parameter" + style: deepObject + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + x-accepts: + - text/plain + /query/style_jsonSerialization/object: + get: + description: Test query parameter(s) + operationId: test/query/style_jsonSerialization/object + parameters: + - content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + in: query + name: json_serialized_object_ref_string_query + required: false + - content: + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + in: query + name: json_serialized_object_array_ref_string_query + required: false + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test query parameter(s) + tags: + - query + x-accepts: + - text/plain + /body/application/octetstream/binary: + post: + description: Test body parameter(s) + operationId: test/body/application/octetstream/binary + requestBody: + content: + application/octet-stream: + schema: + format: binary + type: string + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test body parameter(s) + tags: + - body + x-content-type: application/octet-stream + x-accepts: + - text/plain + /echo/body/Pet: + post: + description: Test body parameter(s) + operationId: test/echo/body/Pet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: Successful operation + summary: Test body parameter(s) + tags: + - body + x-content-type: application/json + x-accepts: + - application/json + /echo/body/allOf/Pet: + post: + description: Test body parameter(s) + operationId: test/echo/body/allOf/Pet + requestBody: + $ref: "#/components/requestBodies/AllOfPet" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: Successful operation + summary: Test body parameter(s) + tags: + - body + x-content-type: application/json + x-accepts: + - application/json + /echo/body/Pet/response_string: + post: + description: Test empty response body + operationId: test/echo/body/Pet/response_string + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test empty response body + tags: + - body + x-content-type: application/json + x-accepts: + - text/plain + /echo/body/Tag/response_string: + post: + description: Test empty json (request body) + operationId: test/echo/body/Tag/response_string + requestBody: + $ref: "#/components/requestBodies/Tag" + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test empty json (request body) + tags: + - body + x-content-type: application/json + x-accepts: + - text/plain + /echo/body/FreeFormObject/response_string: + post: + description: Test free form object + operationId: test/echo/body/FreeFormObject/response_string + requestBody: + content: + application/json: + schema: + type: object + description: Free form object + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test free form object + tags: + - body + x-content-type: application/json + x-accepts: + - text/plain + /echo/body/string_enum: + post: + description: Test string enum response body + operationId: test/echo/body/string_enum + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/StringEnumRef" + description: String enum + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/StringEnumRef" + description: Successful operation + summary: Test string enum response body + tags: + - body + x-content-type: application/json + x-accepts: + - application/json + /binary/gif: + post: + description: Test binary (gif) response body + operationId: test/binary/gif + responses: + "200": + content: + image/gif: + schema: + format: binary + type: string + description: Successful operation + summary: Test binary (gif) response body + tags: + - body + x-accepts: + - image/gif + /body/application/octetstream/single_binary: + post: + description: Test single binary in multipart mime + operationId: test/body/multipart/formdata/single_binary + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/test_body_multipart_formdata_single_binary_request" + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test single binary in multipart mime + tags: + - body + x-content-type: multipart/form-data + x-accepts: + - text/plain + /body/application/octetstream/array_of_binary: + post: + description: Test array of binary in multipart mime + operationId: test/body/multipart/formdata/array_of_binary + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/test_body_multipart_formdata_array_of_binary_request" + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + summary: Test array of binary in multipart mime + tags: + - body + x-content-type: multipart/form-data + x-accepts: + - text/plain + /auth/http/basic: + post: + description: To test HTTP basic authentication + operationId: test/auth/http/basic + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + security: + - http_auth: [] + summary: To test HTTP basic authentication + tags: + - auth + x-accepts: + - text/plain + /auth/http/bearer: + post: + description: To test HTTP bearer authentication + operationId: test/auth/http/bearer + responses: + "200": + content: + text/plain: + schema: + type: string + description: Successful operation + security: + - http_bearer_auth: [] + summary: To test HTTP bearer authentication + tags: + - auth + x-accepts: + - text/plain +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + AllOfPet: + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + Tag: + content: + application/json: + schema: + $ref: "#/components/schemas/Tag" + description: Tag object + schemas: + Category: + example: + id: 1 + name: Dogs + properties: + id: + example: 1 + format: int64 + type: integer + name: + example: Dogs + type: string + type: object + xml: + name: category + Tag: + example: + id: 0 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: tag + Pet: + example: + id: 10 + name: doggie + category: + id: 1 + name: Dogs + photoUrls: + - photoUrls + - photoUrls + tags: + - id: 0 + name: name + - id: 0 + name: name + status: available + properties: + id: + example: 10 + format: int64 + type: integer + name: + example: doggie + type: string + category: + $ref: "#/components/schemas/Category" + photoUrls: + items: + type: string + xml: + name: photoUrl + type: array + xml: + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: pet + StringEnumRef: + enum: + - success + - failure + - unclassified + type: string + DefaultValue: + description: to test the default value of properties + properties: + array_string_enum_ref_default: + default: + - success + - failure + items: + $ref: "#/components/schemas/StringEnumRef" + type: array + array_string_enum_default: + default: + - success + - failure + items: + enum: + - success + - failure + - unclassified + type: string + type: array + array_string_default: + default: + - failure + - skipped + items: + type: string + type: array + array_integer_default: + default: + - 1 + - 3 + items: + type: integer + type: array + array_string: + items: + type: string + type: array + array_string_nullable: + items: + type: string + nullable: true + type: array + array_string_extension_nullable: + items: + type: string + type: array + x-nullable: true + string_nullable: + nullable: true + type: string + type: object + Bird: + properties: + size: + type: string + color: + type: string + type: object + Query: + properties: + id: + description: Query + format: int64 + type: integer + outcomes: + default: + - SUCCESS + - FAILURE + items: + enum: + - SUCCESS + - FAILURE + - SKIPPED + type: string + type: array + type: object + x-parent: true + DataQuery: + allOf: + - properties: + suffix: + description: test suffix + type: string + text: + description: Some text containing white spaces + example: Some text + type: string + date: + description: A date + format: date-time + type: string + type: object + - $ref: "#/components/schemas/Query" + NumberPropertiesOnly: + properties: + number: + type: number + float: + format: float + type: number + double: + format: double + maximum: 50.2 + minimum: 0.8 + type: number + type: object + test_form_integer_boolean_string_request: + properties: + integer_form: + type: integer + boolean_form: + type: boolean + string_form: + type: string + type: object + test_form_oneof_request_oneOf: + properties: + form1: + type: string + form2: + type: integer + type: object + test_form_oneof_request_oneOf_1: + properties: + form3: + type: string + form4: + type: boolean + type: object + test_form_oneof_request: + oneOf: + - $ref: "#/components/schemas/test_form_oneof_request_oneOf" + - $ref: "#/components/schemas/test_form_oneof_request_oneOf_1" + - $ref: "#/components/schemas/Tag" + type: object + test_form_object_multipart_request_marker: + properties: + name: + type: string + type: object + test_form_object_multipart_request: + properties: + marker: + $ref: "#/components/schemas/test_form_object_multipart_request_marker" + required: + - marker + type: object + test_query_style_form_explode_true_array_string_query_object_parameter: + properties: + values: + items: + type: string + type: array + type: object + test_query_style_deepObject_explode_true_object_allOf_query_object_parameter: + allOf: + - $ref: "#/components/schemas/Bird" + - $ref: "#/components/schemas/Category" + test_body_multipart_formdata_single_binary_request: + properties: + my-file: + format: binary + type: string + type: object + test_body_multipart_formdata_array_of_binary_request: + properties: + files: + items: + format: binary + type: string + type: array + required: + - files + type: object + securitySchemes: + http_auth: + scheme: basic + type: http + http_bearer_auth: + scheme: bearer + type: http + diff --git a/samples/client/echo_api/java/okhttp/build.gradle b/samples/client/echo_api/java/okhttp/build.gradle new file mode 100644 index 000000000000..36cac547a650 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/build.gradle @@ -0,0 +1,63 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '0.1.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'echo-api-okhttp' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/echo_api/java/okhttp/build.sbt b/samples/client/echo_api/java/okhttp/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/echo_api/java/okhttp/docs/AuthApi.md b/samples/client/echo_api/java/okhttp/docs/AuthApi.md new file mode 100644 index 000000000000..387a0f3dcbd1 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/AuthApi.md @@ -0,0 +1,137 @@ +# AuthApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**testAuthHttpBasic**](AuthApi.md#testAuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication | +| [**testAuthHttpBearer**](AuthApi.md#testAuthHttpBearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication | + + + +# **testAuthHttpBasic** +> String testAuthHttpBasic() + +To test HTTP basic authentication + +To test HTTP basic authentication + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AuthApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + // Configure HTTP basic authorization: http_auth + HttpBasicAuth http_auth = (HttpBasicAuth) defaultClient.getAuthentication("http_auth"); + http_auth.setUsername("YOUR USERNAME"); + http_auth.setPassword("YOUR PASSWORD"); + + AuthApi apiInstance = new AuthApi(defaultClient); + try { + String result = apiInstance.testAuthHttpBasic(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AuthApi#testAuthHttpBasic"); + 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 + +**String** + +### Authorization + +[http_auth](../README.md#http_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testAuthHttpBearer** +> String testAuthHttpBearer() + +To test HTTP bearer authentication + +To test HTTP bearer authentication + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AuthApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + // Configure HTTP bearer authorization: http_bearer_auth + HttpBearerAuth http_bearer_auth = (HttpBearerAuth) defaultClient.getAuthentication("http_bearer_auth"); + http_bearer_auth.setBearerToken("BEARER TOKEN"); + + AuthApi apiInstance = new AuthApi(defaultClient); + try { + String result = apiInstance.testAuthHttpBearer(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AuthApi#testAuthHttpBearer"); + 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 + +**String** + +### Authorization + +[http_bearer_auth](../README.md#http_bearer_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + diff --git a/samples/client/echo_api/java/okhttp/docs/Bird.md b/samples/client/echo_api/java/okhttp/docs/Bird.md new file mode 100644 index 000000000000..2a6f8a660d65 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/Bird.md @@ -0,0 +1,14 @@ + + +# Bird + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**size** | **String** | | [optional] | +|**color** | **String** | | [optional] | + + + diff --git a/samples/client/echo_api/java/okhttp/docs/BodyApi.md b/samples/client/echo_api/java/okhttp/docs/BodyApi.md new file mode 100644 index 000000000000..cdaa4dc6e1a8 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/BodyApi.md @@ -0,0 +1,634 @@ +# BodyApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**testBinaryGif**](BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body | +| [**testBodyApplicationOctetstreamBinary**](BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) | +| [**testBodyMultipartFormdataArrayOfBinary**](BodyApi.md#testBodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime | +| [**testBodyMultipartFormdataSingleBinary**](BodyApi.md#testBodyMultipartFormdataSingleBinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime | +| [**testEchoBodyAllOfPet**](BodyApi.md#testEchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s) | +| [**testEchoBodyFreeFormObjectResponseString**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object | +| [**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) | +| [**testEchoBodyPetResponseString**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body | +| [**testEchoBodyStringEnum**](BodyApi.md#testEchoBodyStringEnum) | **POST** /echo/body/string_enum | Test string enum response body | +| [**testEchoBodyTagResponseString**](BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body) | + + + +# **testBinaryGif** +> File testBinaryGif() + +Test binary (gif) response body + +Test binary (gif) response body + +### 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.BodyApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + BodyApi apiInstance = new BodyApi(defaultClient); + try { + File result = apiInstance.testBinaryGif(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling BodyApi#testBinaryGif"); + 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 + +[**File**](File.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: image/gif + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testBodyApplicationOctetstreamBinary** +> String testBodyApplicationOctetstreamBinary(body) + +Test body parameter(s) + +Test body parameter(s) + +### 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.BodyApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + BodyApi apiInstance = new BodyApi(defaultClient); + File body = new File("/path/to/file"); // File | + try { + String result = apiInstance.testBodyApplicationOctetstreamBinary(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling BodyApi#testBodyApplicationOctetstreamBinary"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **File**| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/octet-stream + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testBodyMultipartFormdataArrayOfBinary** +> String testBodyMultipartFormdataArrayOfBinary(files) + +Test array of binary in multipart mime + +Test array of binary in multipart mime + +### 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.BodyApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + BodyApi apiInstance = new BodyApi(defaultClient); + List files = Arrays.asList(); // List | + try { + String result = apiInstance.testBodyMultipartFormdataArrayOfBinary(files); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling BodyApi#testBodyMultipartFormdataArrayOfBinary"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **files** | **List<File>**| | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testBodyMultipartFormdataSingleBinary** +> String testBodyMultipartFormdataSingleBinary(myFile) + +Test single binary in multipart mime + +Test single binary in multipart mime + +### 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.BodyApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + BodyApi apiInstance = new BodyApi(defaultClient); + File myFile = new File("/path/to/file"); // File | + try { + String result = apiInstance.testBodyMultipartFormdataSingleBinary(myFile); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling BodyApi#testBodyMultipartFormdataSingleBinary"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **myFile** | **File**| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testEchoBodyAllOfPet** +> Pet testEchoBodyAllOfPet(pet) + +Test body parameter(s) + +Test body parameter(s) + +### 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.BodyApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + BodyApi apiInstance = new BodyApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.testEchoBodyAllOfPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling BodyApi#testEchoBodyAllOfPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testEchoBodyFreeFormObjectResponseString** +> String testEchoBodyFreeFormObjectResponseString(body) + +Test free form object + +Test free form object + +### 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.BodyApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + BodyApi apiInstance = new BodyApi(defaultClient); + Object body = null; // Object | Free form object + try { + String result = apiInstance.testEchoBodyFreeFormObjectResponseString(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling BodyApi#testEchoBodyFreeFormObjectResponseString"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **Object**| Free form object | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testEchoBodyPet** +> Pet testEchoBodyPet(pet) + +Test body parameter(s) + +Test body parameter(s) + +### 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.BodyApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + BodyApi apiInstance = new BodyApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.testEchoBodyPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling BodyApi#testEchoBodyPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testEchoBodyPetResponseString** +> String testEchoBodyPetResponseString(pet) + +Test empty response body + +Test empty response body + +### 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.BodyApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + BodyApi apiInstance = new BodyApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + String result = apiInstance.testEchoBodyPetResponseString(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling BodyApi#testEchoBodyPetResponseString"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testEchoBodyStringEnum** +> StringEnumRef testEchoBodyStringEnum(body) + +Test string enum response body + +Test string enum response body + +### 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.BodyApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + BodyApi apiInstance = new BodyApi(defaultClient); + String body = "body_example"; // String | String enum + try { + StringEnumRef result = apiInstance.testEchoBodyStringEnum(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling BodyApi#testEchoBodyStringEnum"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **String**| String enum | [optional] | + +### Return type + +[**StringEnumRef**](StringEnumRef.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testEchoBodyTagResponseString** +> String testEchoBodyTagResponseString(tag) + +Test empty json (request body) + +Test empty json (request body) + +### 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.BodyApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + BodyApi apiInstance = new BodyApi(defaultClient); + Tag tag = new Tag(); // Tag | Tag object + try { + String result = apiInstance.testEchoBodyTagResponseString(tag); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling BodyApi#testEchoBodyTagResponseString"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tag** | [**Tag**](Tag.md)| Tag object | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + diff --git a/samples/client/echo_api/java/okhttp/docs/Category.md b/samples/client/echo_api/java/okhttp/docs/Category.md new file mode 100644 index 000000000000..7289ebf585bb --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/Category.md @@ -0,0 +1,14 @@ + + +# Category + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/echo_api/java/okhttp/docs/DataQuery.md b/samples/client/echo_api/java/okhttp/docs/DataQuery.md new file mode 100644 index 000000000000..338c467b2d56 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/DataQuery.md @@ -0,0 +1,15 @@ + + +# DataQuery + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**suffix** | **String** | test suffix | [optional] | +|**text** | **String** | Some text containing white spaces | [optional] | +|**date** | **OffsetDateTime** | A date | [optional] | + + + diff --git a/samples/client/echo_api/java/okhttp/docs/DefaultValue.md b/samples/client/echo_api/java/okhttp/docs/DefaultValue.md new file mode 100644 index 000000000000..20a9b8ee2508 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/DefaultValue.md @@ -0,0 +1,31 @@ + + +# DefaultValue + +to test the default value of properties + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayStringEnumRefDefault** | **List<StringEnumRef>** | | [optional] | +|**arrayStringEnumDefault** | [**List<ArrayStringEnumDefaultEnum>**](#List<ArrayStringEnumDefaultEnum>) | | [optional] | +|**arrayStringDefault** | **List<String>** | | [optional] | +|**arrayIntegerDefault** | **List<Integer>** | | [optional] | +|**arrayString** | **List<String>** | | [optional] | +|**arrayStringNullable** | **List<String>** | | [optional] | +|**arrayStringExtensionNullable** | **List<String>** | | [optional] | +|**stringNullable** | **String** | | [optional] | + + + +## Enum: List<ArrayStringEnumDefaultEnum> + +| Name | Value | +|---- | -----| +| SUCCESS | "success" | +| FAILURE | "failure" | +| UNCLASSIFIED | "unclassified" | + + + diff --git a/samples/client/echo_api/java/okhttp/docs/FormApi.md b/samples/client/echo_api/java/okhttp/docs/FormApi.md new file mode 100644 index 000000000000..836fc999837c --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/FormApi.md @@ -0,0 +1,211 @@ +# FormApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**testFormIntegerBooleanString**](FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) | +| [**testFormObjectMultipart**](FormApi.md#testFormObjectMultipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema | +| [**testFormOneof**](FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema | + + + +# **testFormIntegerBooleanString** +> String testFormIntegerBooleanString(integerForm, booleanForm, stringForm) + +Test form parameter(s) + +Test form parameter(s) + +### 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.FormApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + FormApi apiInstance = new FormApi(defaultClient); + Integer integerForm = 56; // Integer | + Boolean booleanForm = true; // Boolean | + String stringForm = "stringForm_example"; // String | + try { + String result = apiInstance.testFormIntegerBooleanString(integerForm, booleanForm, stringForm); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FormApi#testFormIntegerBooleanString"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **integerForm** | **Integer**| | [optional] | +| **booleanForm** | **Boolean**| | [optional] | +| **stringForm** | **String**| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testFormObjectMultipart** +> String testFormObjectMultipart(marker) + +Test form parameter(s) for multipart schema + +Test form parameter(s) for multipart schema + +### 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.FormApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + FormApi apiInstance = new FormApi(defaultClient); + TestFormObjectMultipartRequestMarker marker = new TestFormObjectMultipartRequestMarker(); // TestFormObjectMultipartRequestMarker | + try { + String result = apiInstance.testFormObjectMultipart(marker); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FormApi#testFormObjectMultipart"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **marker** | [**TestFormObjectMultipartRequestMarker**](TestFormObjectMultipartRequestMarker.md)| | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testFormOneof** +> String testFormOneof(form1, form2, form3, form4, id, name) + +Test form parameter(s) for oneOf schema + +Test form parameter(s) for oneOf schema + +### 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.FormApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + FormApi apiInstance = new FormApi(defaultClient); + String form1 = "form1_example"; // String | + Integer form2 = 56; // Integer | + String form3 = "form3_example"; // String | + Boolean form4 = true; // Boolean | + Long id = 56L; // Long | + String name = "name_example"; // String | + try { + String result = apiInstance.testFormOneof(form1, form2, form3, form4, id, name); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FormApi#testFormOneof"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **form1** | **String**| | [optional] | +| **form2** | **Integer**| | [optional] | +| **form3** | **String**| | [optional] | +| **form4** | **Boolean**| | [optional] | +| **id** | **Long**| | [optional] | +| **name** | **String**| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + diff --git a/samples/client/echo_api/java/okhttp/docs/HeaderApi.md b/samples/client/echo_api/java/okhttp/docs/HeaderApi.md new file mode 100644 index 000000000000..8420eab45b60 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/HeaderApi.md @@ -0,0 +1,79 @@ +# HeaderApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**testHeaderIntegerBooleanStringEnums**](HeaderApi.md#testHeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) | + + + +# **testHeaderIntegerBooleanStringEnums** +> String testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader) + +Test header parameter(s) + +Test header parameter(s) + +### 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.HeaderApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + HeaderApi apiInstance = new HeaderApi(defaultClient); + Integer integerHeader = 56; // Integer | + Boolean booleanHeader = true; // Boolean | + String stringHeader = "stringHeader_example"; // String | + String enumNonrefStringHeader = "success"; // String | + StringEnumRef enumRefStringHeader = StringEnumRef.fromValue("success"); // StringEnumRef | + try { + String result = apiInstance.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling HeaderApi#testHeaderIntegerBooleanStringEnums"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **integerHeader** | **Integer**| | [optional] | +| **booleanHeader** | **Boolean**| | [optional] | +| **stringHeader** | **String**| | [optional] | +| **enumNonrefStringHeader** | **String**| | [optional] [enum: success, failure, unclassified] | +| **enumRefStringHeader** | [**StringEnumRef**](.md)| | [optional] [enum: success, failure, unclassified] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + diff --git a/samples/client/echo_api/java/okhttp/docs/NumberPropertiesOnly.md b/samples/client/echo_api/java/okhttp/docs/NumberPropertiesOnly.md new file mode 100644 index 000000000000..7e153538475a --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/NumberPropertiesOnly.md @@ -0,0 +1,15 @@ + + +# NumberPropertiesOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**number** | **BigDecimal** | | [optional] | +|**_float** | **Float** | | [optional] | +|**_double** | **Double** | | [optional] | + + + diff --git a/samples/client/echo_api/java/okhttp/docs/PathApi.md b/samples/client/echo_api/java/okhttp/docs/PathApi.md new file mode 100644 index 000000000000..f7bae92568f0 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/PathApi.md @@ -0,0 +1,77 @@ +# PathApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](PathApi.md#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) | + + + +# **testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath** +> String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath) + +Test path parameter(s) + +Test path parameter(s) + +### 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.PathApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + PathApi apiInstance = new PathApi(defaultClient); + String pathString = "pathString_example"; // String | + Integer pathInteger = 56; // Integer | + String enumNonrefStringPath = "success"; // String | + StringEnumRef enumRefStringPath = StringEnumRef.fromValue("success"); // StringEnumRef | + try { + String result = apiInstance.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PathApi#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pathString** | **String**| | | +| **pathInteger** | **Integer**| | | +| **enumNonrefStringPath** | **String**| | [enum: success, failure, unclassified] | +| **enumRefStringPath** | [**StringEnumRef**](.md)| | [enum: success, failure, unclassified] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + diff --git a/samples/client/echo_api/java/okhttp/docs/Pet.md b/samples/client/echo_api/java/okhttp/docs/Pet.md new file mode 100644 index 000000000000..82aa8a25ed7c --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/Pet.md @@ -0,0 +1,28 @@ + + +# Pet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | +|**category** | [**Category**](Category.md) | | [optional] | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/echo_api/java/okhttp/docs/Query.md b/samples/client/echo_api/java/okhttp/docs/Query.md new file mode 100644 index 000000000000..99c6fd6faa5d --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/Query.md @@ -0,0 +1,24 @@ + + +# Query + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | Query | [optional] | +|**outcomes** | [**List<OutcomesEnum>**](#List<OutcomesEnum>) | | [optional] | + + + +## Enum: List<OutcomesEnum> + +| Name | Value | +|---- | -----| +| SUCCESS | "SUCCESS" | +| FAILURE | "FAILURE" | +| SKIPPED | "SKIPPED" | + + + diff --git a/samples/client/echo_api/java/okhttp/docs/QueryApi.md b/samples/client/echo_api/java/okhttp/docs/QueryApi.md new file mode 100644 index 000000000000..7a5fb4dc09d8 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/QueryApi.md @@ -0,0 +1,713 @@ +# QueryApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**testEnumRefString**](QueryApi.md#testEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s) | +| [**testQueryDatetimeDateString**](QueryApi.md#testQueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s) | +| [**testQueryIntegerBooleanString**](QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s) | +| [**testQueryStyleDeepObjectExplodeTrueObject**](QueryApi.md#testQueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) | +| [**testQueryStyleDeepObjectExplodeTrueObjectAllOf**](QueryApi.md#testQueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) | +| [**testQueryStyleFormExplodeFalseArrayInteger**](QueryApi.md#testQueryStyleFormExplodeFalseArrayInteger) | **GET** /query/style_form/explode_false/array_integer | Test query parameter(s) | +| [**testQueryStyleFormExplodeFalseArrayString**](QueryApi.md#testQueryStyleFormExplodeFalseArrayString) | **GET** /query/style_form/explode_false/array_string | Test query parameter(s) | +| [**testQueryStyleFormExplodeTrueArrayString**](QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) | +| [**testQueryStyleFormExplodeTrueObject**](QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) | +| [**testQueryStyleFormExplodeTrueObjectAllOf**](QueryApi.md#testQueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) | +| [**testQueryStyleJsonSerializationObject**](QueryApi.md#testQueryStyleJsonSerializationObject) | **GET** /query/style_jsonSerialization/object | Test query parameter(s) | + + + +# **testEnumRefString** +> String testEnumRefString(enumNonrefStringQuery, enumRefStringQuery) + +Test query parameter(s) + +Test query parameter(s) + +### 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.QueryApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + QueryApi apiInstance = new QueryApi(defaultClient); + String enumNonrefStringQuery = "success"; // String | + StringEnumRef enumRefStringQuery = StringEnumRef.fromValue("success"); // StringEnumRef | + try { + String result = apiInstance.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling QueryApi#testEnumRefString"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **enumNonrefStringQuery** | **String**| | [optional] [enum: success, failure, unclassified] | +| **enumRefStringQuery** | [**StringEnumRef**](.md)| | [optional] [enum: success, failure, unclassified] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testQueryDatetimeDateString** +> String testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery) + +Test query parameter(s) + +Test query parameter(s) + +### 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.QueryApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + QueryApi apiInstance = new QueryApi(defaultClient); + OffsetDateTime datetimeQuery = OffsetDateTime.now(); // OffsetDateTime | + LocalDate dateQuery = LocalDate.now(); // LocalDate | + String stringQuery = "stringQuery_example"; // String | + try { + String result = apiInstance.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling QueryApi#testQueryDatetimeDateString"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **datetimeQuery** | **OffsetDateTime**| | [optional] | +| **dateQuery** | **LocalDate**| | [optional] | +| **stringQuery** | **String**| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testQueryIntegerBooleanString** +> String testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery) + +Test query parameter(s) + +Test query parameter(s) + +### 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.QueryApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + QueryApi apiInstance = new QueryApi(defaultClient); + Integer integerQuery = 56; // Integer | + Boolean booleanQuery = true; // Boolean | + String stringQuery = "stringQuery_example"; // String | + try { + String result = apiInstance.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling QueryApi#testQueryIntegerBooleanString"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **integerQuery** | **Integer**| | [optional] | +| **booleanQuery** | **Boolean**| | [optional] | +| **stringQuery** | **String**| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testQueryStyleDeepObjectExplodeTrueObject** +> String testQueryStyleDeepObjectExplodeTrueObject(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### 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.QueryApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + QueryApi apiInstance = new QueryApi(defaultClient); + Pet queryObject = new Pet(); // Pet | + try { + String result = apiInstance.testQueryStyleDeepObjectExplodeTrueObject(queryObject); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling QueryApi#testQueryStyleDeepObjectExplodeTrueObject"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **queryObject** | [**Pet**](.md)| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testQueryStyleDeepObjectExplodeTrueObjectAllOf** +> String testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### 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.QueryApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + QueryApi apiInstance = new QueryApi(defaultClient); + TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject = new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(); // TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter | + try { + String result = apiInstance.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling QueryApi#testQueryStyleDeepObjectExplodeTrueObjectAllOf"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **queryObject** | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](.md)| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testQueryStyleFormExplodeFalseArrayInteger** +> String testQueryStyleFormExplodeFalseArrayInteger(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### 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.QueryApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + QueryApi apiInstance = new QueryApi(defaultClient); + List queryObject = Arrays.asList(); // List | + try { + String result = apiInstance.testQueryStyleFormExplodeFalseArrayInteger(queryObject); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling QueryApi#testQueryStyleFormExplodeFalseArrayInteger"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **queryObject** | [**List<Integer>**](Integer.md)| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testQueryStyleFormExplodeFalseArrayString** +> String testQueryStyleFormExplodeFalseArrayString(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### 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.QueryApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + QueryApi apiInstance = new QueryApi(defaultClient); + List queryObject = Arrays.asList(); // List | + try { + String result = apiInstance.testQueryStyleFormExplodeFalseArrayString(queryObject); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling QueryApi#testQueryStyleFormExplodeFalseArrayString"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **queryObject** | [**List<String>**](String.md)| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testQueryStyleFormExplodeTrueArrayString** +> String testQueryStyleFormExplodeTrueArrayString(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### 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.QueryApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + QueryApi apiInstance = new QueryApi(defaultClient); + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(); // TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | + try { + String result = apiInstance.testQueryStyleFormExplodeTrueArrayString(queryObject); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling QueryApi#testQueryStyleFormExplodeTrueArrayString"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **queryObject** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md)| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testQueryStyleFormExplodeTrueObject** +> String testQueryStyleFormExplodeTrueObject(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### 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.QueryApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + QueryApi apiInstance = new QueryApi(defaultClient); + Pet queryObject = new Pet(); // Pet | + try { + String result = apiInstance.testQueryStyleFormExplodeTrueObject(queryObject); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling QueryApi#testQueryStyleFormExplodeTrueObject"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **queryObject** | [**Pet**](.md)| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testQueryStyleFormExplodeTrueObjectAllOf** +> String testQueryStyleFormExplodeTrueObjectAllOf(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### 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.QueryApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + QueryApi apiInstance = new QueryApi(defaultClient); + DataQuery queryObject = new DataQuery(); // DataQuery | + try { + String result = apiInstance.testQueryStyleFormExplodeTrueObjectAllOf(queryObject); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling QueryApi#testQueryStyleFormExplodeTrueObjectAllOf"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **queryObject** | [**DataQuery**](.md)| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + + +# **testQueryStyleJsonSerializationObject** +> String testQueryStyleJsonSerializationObject(jsonSerializedObjectRefStringQuery, jsonSerializedObjectArrayRefStringQuery) + +Test query parameter(s) + +Test query parameter(s) + +### 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.QueryApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:3000"); + + QueryApi apiInstance = new QueryApi(defaultClient); + Pet jsonSerializedObjectRefStringQuery = new Pet(); // Pet | + List jsonSerializedObjectArrayRefStringQuery = Arrays.asList(); // List | + try { + String result = apiInstance.testQueryStyleJsonSerializationObject(jsonSerializedObjectRefStringQuery, jsonSerializedObjectArrayRefStringQuery); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling QueryApi#testQueryStyleJsonSerializationObject"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **jsonSerializedObjectRefStringQuery** | [**Pet**](.md)| | [optional] | +| **jsonSerializedObjectArrayRefStringQuery** | [**List<Pet>**](Pet.md)| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful operation | - | + diff --git a/samples/client/echo_api/java/okhttp/docs/StringEnumRef.md b/samples/client/echo_api/java/okhttp/docs/StringEnumRef.md new file mode 100644 index 000000000000..dff22ecf074b --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/StringEnumRef.md @@ -0,0 +1,15 @@ + + +# StringEnumRef + +## Enum + + +* `SUCCESS` (value: `"success"`) + +* `FAILURE` (value: `"failure"`) + +* `UNCLASSIFIED` (value: `"unclassified"`) + + + diff --git a/samples/client/echo_api/java/okhttp/docs/Tag.md b/samples/client/echo_api/java/okhttp/docs/Tag.md new file mode 100644 index 000000000000..5088b2dd1c31 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/Tag.md @@ -0,0 +1,14 @@ + + +# Tag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/echo_api/java/okhttp/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/java/okhttp/docs/TestFormObjectMultipartRequestMarker.md new file mode 100644 index 000000000000..3e67574f36d3 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/TestFormObjectMultipartRequestMarker.md @@ -0,0 +1,13 @@ + + +# TestFormObjectMultipartRequestMarker + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/echo_api/java/okhttp/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md b/samples/client/echo_api/java/okhttp/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md new file mode 100644 index 000000000000..a756a343e8a8 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md @@ -0,0 +1,16 @@ + + +# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**size** | **String** | | [optional] | +|**color** | **String** | | [optional] | +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/echo_api/java/okhttp/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/java/okhttp/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md new file mode 100644 index 000000000000..9235e80fb823 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md @@ -0,0 +1,13 @@ + + +# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**values** | **List<String>** | | [optional] | + + + diff --git a/samples/client/echo_api/java/okhttp/git_push.sh b/samples/client/echo_api/java/okhttp/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/echo_api/java/okhttp/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/echo_api/java/okhttp/gradle.properties b/samples/client/echo_api/java/okhttp/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/echo_api/java/okhttp/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/echo_api/java/okhttp/gradle/wrapper/gradle-wrapper.jar b/samples/client/echo_api/java/okhttp/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/echo_api/java/okhttp/gradlew.bat b/samples/client/echo_api/java/okhttp/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/echo_api/java/okhttp/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/echo_api/java/okhttp/pom.xml b/samples/client/echo_api/java/okhttp/pom.xml new file mode 100644 index 000000000000..879760dd69f9 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/pom.xml @@ -0,0 +1,279 @@ + + 4.0.0 + org.openapitools + echo-api-okhttp + jar + echo-api-okhttp + 0.1.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 + http://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-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.10.1 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/echo_api/java/okhttp/settings.gradle b/samples/client/echo_api/java/okhttp/settings.gradle new file mode 100644 index 000000000000..d3fef62614ad --- /dev/null +++ b/samples/client/echo_api/java/okhttp/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "echo-api-okhttp" \ No newline at end of file diff --git a/samples/client/echo_api/java/okhttp/src/main/AndroidManifest.xml b/samples/client/echo_api/java/okhttp/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..fd67ceb6f155 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..e19dcb7716a4 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1657 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://localhost:3000"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://localhost:3000", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("http_auth", new HttpBasicAuth()); + authentications.put("http_bearer_auth", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("http_auth", new HttpBasicAuth()); + authentications.put("http_bearer_auth", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/0.1.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://localhost:3000) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 access token for the first Bearer authentication. + * @param bearerToken Bearer token + */ + public void setBearerToken(String bearerToken) { + setBearerToken(() -> bearerToken); + } + + /** + * Helper method to set the supplier of access tokens for Bearer authentication. + * + * @param tokenSupplier The supplier of bearer tokens + */ + public void setBearerToken(Supplier tokenSupplier) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(tokenSupplier); + return; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiException.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..8d0a87fbc8f9 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..c303029e56eb --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Configuration.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..3e89fc9d1bf4 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "0.1.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/JSON.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..c4c182090816 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,449 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Bird.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Category.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.DataQuery.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.DefaultValue.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NumberPropertiesOnly.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Pet.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Tag.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.TestFormObjectMultipartRequestMarker.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Pair.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..d1fae1e9e59b --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..9a0a141e318d --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..d47e32e00f5a --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..a4e83eee7d63 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..2139c6c8c510 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..3e909a428230 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/AuthApi.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/AuthApi.java new file mode 100644 index 000000000000..744c2ae38826 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/AuthApi.java @@ -0,0 +1,313 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AuthApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AuthApi() { + this(Configuration.getDefaultApiClient()); + } + + public AuthApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for testAuthHttpBasic + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testAuthHttpBasicCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/auth/http/basic"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "http_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testAuthHttpBasicValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return testAuthHttpBasicCall(_callback); + + } + + /** + * To test HTTP basic authentication + * To test HTTP basic authentication + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testAuthHttpBasic() throws ApiException { + ApiResponse localVarResp = testAuthHttpBasicWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * To test HTTP basic authentication + * To test HTTP basic authentication + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testAuthHttpBasicWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = testAuthHttpBasicValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test HTTP basic authentication (asynchronously) + * To test HTTP basic authentication + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testAuthHttpBasicAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testAuthHttpBasicValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testAuthHttpBearer + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testAuthHttpBearerCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/auth/http/bearer"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "http_bearer_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testAuthHttpBearerValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return testAuthHttpBearerCall(_callback); + + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testAuthHttpBearer() throws ApiException { + ApiResponse localVarResp = testAuthHttpBearerWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * To test HTTP bearer authentication + * To test HTTP bearer authentication + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testAuthHttpBearerWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = testAuthHttpBearerValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test HTTP bearer authentication (asynchronously) + * To test HTTP bearer authentication + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testAuthHttpBearerAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testAuthHttpBearerValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/BodyApi.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/BodyApi.java new file mode 100644 index 000000000000..8b32e333a129 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/BodyApi.java @@ -0,0 +1,1327 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.StringEnumRef; +import org.openapitools.client.model.Tag; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class BodyApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public BodyApi() { + this(Configuration.getDefaultApiClient()); + } + + public BodyApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for testBinaryGif + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testBinaryGifCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/binary/gif"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "image/gif" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBinaryGifValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return testBinaryGifCall(_callback); + + } + + /** + * Test binary (gif) response body + * Test binary (gif) response body + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public File testBinaryGif() throws ApiException { + ApiResponse localVarResp = testBinaryGifWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Test binary (gif) response body + * Test binary (gif) response body + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testBinaryGifWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = testBinaryGifValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test binary (gif) response body (asynchronously) + * Test binary (gif) response body + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testBinaryGifAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBinaryGifValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testBodyApplicationOctetstreamBinary + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testBodyApplicationOctetstreamBinaryCall(@javax.annotation.Nullable File body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/body/application/octetstream/binary"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/octet-stream" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyApplicationOctetstreamBinaryValidateBeforeCall(@javax.annotation.Nullable File body, final ApiCallback _callback) throws ApiException { + return testBodyApplicationOctetstreamBinaryCall(body, _callback); + + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param body (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testBodyApplicationOctetstreamBinary(@javax.annotation.Nullable File body) throws ApiException { + ApiResponse localVarResp = testBodyApplicationOctetstreamBinaryWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param body (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testBodyApplicationOctetstreamBinaryWithHttpInfo(@javax.annotation.Nullable File body) throws ApiException { + okhttp3.Call localVarCall = testBodyApplicationOctetstreamBinaryValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test body parameter(s) (asynchronously) + * Test body parameter(s) + * @param body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testBodyApplicationOctetstreamBinaryAsync(@javax.annotation.Nullable File body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyApplicationOctetstreamBinaryValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testBodyMultipartFormdataArrayOfBinary + * @param files (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testBodyMultipartFormdataArrayOfBinaryCall(@javax.annotation.Nonnull List files, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/body/application/octetstream/array_of_binary"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (files != null) { + localVarFormParams.put("files", files); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyMultipartFormdataArrayOfBinaryValidateBeforeCall(@javax.annotation.Nonnull List files, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'files' is set + if (files == null) { + throw new ApiException("Missing the required parameter 'files' when calling testBodyMultipartFormdataArrayOfBinary(Async)"); + } + + return testBodyMultipartFormdataArrayOfBinaryCall(files, _callback); + + } + + /** + * Test array of binary in multipart mime + * Test array of binary in multipart mime + * @param files (required) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testBodyMultipartFormdataArrayOfBinary(@javax.annotation.Nonnull List files) throws ApiException { + ApiResponse localVarResp = testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files); + return localVarResp.getData(); + } + + /** + * Test array of binary in multipart mime + * Test array of binary in multipart mime + * @param files (required) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(@javax.annotation.Nonnull List files) throws ApiException { + okhttp3.Call localVarCall = testBodyMultipartFormdataArrayOfBinaryValidateBeforeCall(files, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test array of binary in multipart mime (asynchronously) + * Test array of binary in multipart mime + * @param files (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testBodyMultipartFormdataArrayOfBinaryAsync(@javax.annotation.Nonnull List files, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyMultipartFormdataArrayOfBinaryValidateBeforeCall(files, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testBodyMultipartFormdataSingleBinary + * @param myFile (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testBodyMultipartFormdataSingleBinaryCall(@javax.annotation.Nullable File myFile, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/body/application/octetstream/single_binary"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (myFile != null) { + localVarFormParams.put("my-file", myFile); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyMultipartFormdataSingleBinaryValidateBeforeCall(@javax.annotation.Nullable File myFile, final ApiCallback _callback) throws ApiException { + return testBodyMultipartFormdataSingleBinaryCall(myFile, _callback); + + } + + /** + * Test single binary in multipart mime + * Test single binary in multipart mime + * @param myFile (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testBodyMultipartFormdataSingleBinary(@javax.annotation.Nullable File myFile) throws ApiException { + ApiResponse localVarResp = testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile); + return localVarResp.getData(); + } + + /** + * Test single binary in multipart mime + * Test single binary in multipart mime + * @param myFile (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testBodyMultipartFormdataSingleBinaryWithHttpInfo(@javax.annotation.Nullable File myFile) throws ApiException { + okhttp3.Call localVarCall = testBodyMultipartFormdataSingleBinaryValidateBeforeCall(myFile, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test single binary in multipart mime (asynchronously) + * Test single binary in multipart mime + * @param myFile (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testBodyMultipartFormdataSingleBinaryAsync(@javax.annotation.Nullable File myFile, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyMultipartFormdataSingleBinaryValidateBeforeCall(myFile, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testEchoBodyAllOfPet + * @param pet Pet object that needs to be added to the store (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEchoBodyAllOfPetCall(@javax.annotation.Nullable Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/echo/body/allOf/Pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEchoBodyAllOfPetValidateBeforeCall(@javax.annotation.Nullable Pet pet, final ApiCallback _callback) throws ApiException { + return testEchoBodyAllOfPetCall(pet, _callback); + + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param pet Pet object that needs to be added to the store (optional) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public Pet testEchoBodyAllOfPet(@javax.annotation.Nullable Pet pet) throws ApiException { + ApiResponse localVarResp = testEchoBodyAllOfPetWithHttpInfo(pet); + return localVarResp.getData(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param pet Pet object that needs to be added to the store (optional) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testEchoBodyAllOfPetWithHttpInfo(@javax.annotation.Nullable Pet pet) throws ApiException { + okhttp3.Call localVarCall = testEchoBodyAllOfPetValidateBeforeCall(pet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test body parameter(s) (asynchronously) + * Test body parameter(s) + * @param pet Pet object that needs to be added to the store (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEchoBodyAllOfPetAsync(@javax.annotation.Nullable Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEchoBodyAllOfPetValidateBeforeCall(pet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testEchoBodyFreeFormObjectResponseString + * @param body Free form object (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEchoBodyFreeFormObjectResponseStringCall(@javax.annotation.Nullable Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/echo/body/FreeFormObject/response_string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEchoBodyFreeFormObjectResponseStringValidateBeforeCall(@javax.annotation.Nullable Object body, final ApiCallback _callback) throws ApiException { + return testEchoBodyFreeFormObjectResponseStringCall(body, _callback); + + } + + /** + * Test free form object + * Test free form object + * @param body Free form object (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testEchoBodyFreeFormObjectResponseString(@javax.annotation.Nullable Object body) throws ApiException { + ApiResponse localVarResp = testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * Test free form object + * Test free form object + * @param body Free form object (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testEchoBodyFreeFormObjectResponseStringWithHttpInfo(@javax.annotation.Nullable Object body) throws ApiException { + okhttp3.Call localVarCall = testEchoBodyFreeFormObjectResponseStringValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test free form object (asynchronously) + * Test free form object + * @param body Free form object (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEchoBodyFreeFormObjectResponseStringAsync(@javax.annotation.Nullable Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEchoBodyFreeFormObjectResponseStringValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testEchoBodyPet + * @param pet Pet object that needs to be added to the store (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEchoBodyPetCall(@javax.annotation.Nullable Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/echo/body/Pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEchoBodyPetValidateBeforeCall(@javax.annotation.Nullable Pet pet, final ApiCallback _callback) throws ApiException { + return testEchoBodyPetCall(pet, _callback); + + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param pet Pet object that needs to be added to the store (optional) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public Pet testEchoBodyPet(@javax.annotation.Nullable Pet pet) throws ApiException { + ApiResponse localVarResp = testEchoBodyPetWithHttpInfo(pet); + return localVarResp.getData(); + } + + /** + * Test body parameter(s) + * Test body parameter(s) + * @param pet Pet object that needs to be added to the store (optional) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testEchoBodyPetWithHttpInfo(@javax.annotation.Nullable Pet pet) throws ApiException { + okhttp3.Call localVarCall = testEchoBodyPetValidateBeforeCall(pet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test body parameter(s) (asynchronously) + * Test body parameter(s) + * @param pet Pet object that needs to be added to the store (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEchoBodyPetAsync(@javax.annotation.Nullable Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEchoBodyPetValidateBeforeCall(pet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testEchoBodyPetResponseString + * @param pet Pet object that needs to be added to the store (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEchoBodyPetResponseStringCall(@javax.annotation.Nullable Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/echo/body/Pet/response_string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEchoBodyPetResponseStringValidateBeforeCall(@javax.annotation.Nullable Pet pet, final ApiCallback _callback) throws ApiException { + return testEchoBodyPetResponseStringCall(pet, _callback); + + } + + /** + * Test empty response body + * Test empty response body + * @param pet Pet object that needs to be added to the store (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testEchoBodyPetResponseString(@javax.annotation.Nullable Pet pet) throws ApiException { + ApiResponse localVarResp = testEchoBodyPetResponseStringWithHttpInfo(pet); + return localVarResp.getData(); + } + + /** + * Test empty response body + * Test empty response body + * @param pet Pet object that needs to be added to the store (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testEchoBodyPetResponseStringWithHttpInfo(@javax.annotation.Nullable Pet pet) throws ApiException { + okhttp3.Call localVarCall = testEchoBodyPetResponseStringValidateBeforeCall(pet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test empty response body (asynchronously) + * Test empty response body + * @param pet Pet object that needs to be added to the store (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEchoBodyPetResponseStringAsync(@javax.annotation.Nullable Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEchoBodyPetResponseStringValidateBeforeCall(pet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testEchoBodyStringEnum + * @param body String enum (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEchoBodyStringEnumCall(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/echo/body/string_enum"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEchoBodyStringEnumValidateBeforeCall(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + return testEchoBodyStringEnumCall(body, _callback); + + } + + /** + * Test string enum response body + * Test string enum response body + * @param body String enum (optional) + * @return StringEnumRef + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public StringEnumRef testEchoBodyStringEnum(@javax.annotation.Nullable String body) throws ApiException { + ApiResponse localVarResp = testEchoBodyStringEnumWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * Test string enum response body + * Test string enum response body + * @param body String enum (optional) + * @return ApiResponse<StringEnumRef> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testEchoBodyStringEnumWithHttpInfo(@javax.annotation.Nullable String body) throws ApiException { + okhttp3.Call localVarCall = testEchoBodyStringEnumValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test string enum response body (asynchronously) + * Test string enum response body + * @param body String enum (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEchoBodyStringEnumAsync(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEchoBodyStringEnumValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testEchoBodyTagResponseString + * @param tag Tag object (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEchoBodyTagResponseStringCall(@javax.annotation.Nullable Tag tag, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = tag; + + // create path and map variables + String localVarPath = "/echo/body/Tag/response_string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEchoBodyTagResponseStringValidateBeforeCall(@javax.annotation.Nullable Tag tag, final ApiCallback _callback) throws ApiException { + return testEchoBodyTagResponseStringCall(tag, _callback); + + } + + /** + * Test empty json (request body) + * Test empty json (request body) + * @param tag Tag object (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testEchoBodyTagResponseString(@javax.annotation.Nullable Tag tag) throws ApiException { + ApiResponse localVarResp = testEchoBodyTagResponseStringWithHttpInfo(tag); + return localVarResp.getData(); + } + + /** + * Test empty json (request body) + * Test empty json (request body) + * @param tag Tag object (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testEchoBodyTagResponseStringWithHttpInfo(@javax.annotation.Nullable Tag tag) throws ApiException { + okhttp3.Call localVarCall = testEchoBodyTagResponseStringValidateBeforeCall(tag, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test empty json (request body) (asynchronously) + * Test empty json (request body) + * @param tag Tag object (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEchoBodyTagResponseStringAsync(@javax.annotation.Nullable Tag tag, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEchoBodyTagResponseStringValidateBeforeCall(tag, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/FormApi.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/FormApi.java new file mode 100644 index 000000000000..8e61d88c0729 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/FormApi.java @@ -0,0 +1,521 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.TestFormObjectMultipartRequestMarker; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FormApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FormApi() { + this(Configuration.getDefaultApiClient()); + } + + public FormApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for testFormIntegerBooleanString + * @param integerForm (optional) + * @param booleanForm (optional) + * @param stringForm (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testFormIntegerBooleanStringCall(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/form/integer/boolean/string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (integerForm != null) { + localVarFormParams.put("integer_form", integerForm); + } + + if (booleanForm != null) { + localVarFormParams.put("boolean_form", booleanForm); + } + + if (stringForm != null) { + localVarFormParams.put("string_form", stringForm); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testFormIntegerBooleanStringValidateBeforeCall(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm, final ApiCallback _callback) throws ApiException { + return testFormIntegerBooleanStringCall(integerForm, booleanForm, stringForm, _callback); + + } + + /** + * Test form parameter(s) + * Test form parameter(s) + * @param integerForm (optional) + * @param booleanForm (optional) + * @param stringForm (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testFormIntegerBooleanString(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm) throws ApiException { + ApiResponse localVarResp = testFormIntegerBooleanStringWithHttpInfo(integerForm, booleanForm, stringForm); + return localVarResp.getData(); + } + + /** + * Test form parameter(s) + * Test form parameter(s) + * @param integerForm (optional) + * @param booleanForm (optional) + * @param stringForm (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testFormIntegerBooleanStringWithHttpInfo(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm) throws ApiException { + okhttp3.Call localVarCall = testFormIntegerBooleanStringValidateBeforeCall(integerForm, booleanForm, stringForm, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test form parameter(s) (asynchronously) + * Test form parameter(s) + * @param integerForm (optional) + * @param booleanForm (optional) + * @param stringForm (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testFormIntegerBooleanStringAsync(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testFormIntegerBooleanStringValidateBeforeCall(integerForm, booleanForm, stringForm, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testFormObjectMultipart + * @param marker (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testFormObjectMultipartCall(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/form/object/multipart"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (marker != null) { + localVarFormParams.put("marker", marker); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testFormObjectMultipartValidateBeforeCall(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'marker' is set + if (marker == null) { + throw new ApiException("Missing the required parameter 'marker' when calling testFormObjectMultipart(Async)"); + } + + return testFormObjectMultipartCall(marker, _callback); + + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker (required) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testFormObjectMultipart(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker) throws ApiException { + ApiResponse localVarResp = testFormObjectMultipartWithHttpInfo(marker); + return localVarResp.getData(); + } + + /** + * Test form parameter(s) for multipart schema + * Test form parameter(s) for multipart schema + * @param marker (required) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testFormObjectMultipartWithHttpInfo(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker) throws ApiException { + okhttp3.Call localVarCall = testFormObjectMultipartValidateBeforeCall(marker, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test form parameter(s) for multipart schema (asynchronously) + * Test form parameter(s) for multipart schema + * @param marker (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testFormObjectMultipartAsync(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testFormObjectMultipartValidateBeforeCall(marker, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testFormOneof + * @param form1 (optional) + * @param form2 (optional) + * @param form3 (optional) + * @param form4 (optional) + * @param id (optional) + * @param name (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testFormOneofCall(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/form/oneof"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (form1 != null) { + localVarFormParams.put("form1", form1); + } + + if (form2 != null) { + localVarFormParams.put("form2", form2); + } + + if (form3 != null) { + localVarFormParams.put("form3", form3); + } + + if (form4 != null) { + localVarFormParams.put("form4", form4); + } + + if (id != null) { + localVarFormParams.put("id", id); + } + + if (name != null) { + localVarFormParams.put("name", name); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testFormOneofValidateBeforeCall(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name, final ApiCallback _callback) throws ApiException { + return testFormOneofCall(form1, form2, form3, form4, id, name, _callback); + + } + + /** + * Test form parameter(s) for oneOf schema + * Test form parameter(s) for oneOf schema + * @param form1 (optional) + * @param form2 (optional) + * @param form3 (optional) + * @param form4 (optional) + * @param id (optional) + * @param name (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testFormOneof(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name) throws ApiException { + ApiResponse localVarResp = testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name); + return localVarResp.getData(); + } + + /** + * Test form parameter(s) for oneOf schema + * Test form parameter(s) for oneOf schema + * @param form1 (optional) + * @param form2 (optional) + * @param form3 (optional) + * @param form4 (optional) + * @param id (optional) + * @param name (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testFormOneofWithHttpInfo(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name) throws ApiException { + okhttp3.Call localVarCall = testFormOneofValidateBeforeCall(form1, form2, form3, form4, id, name, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test form parameter(s) for oneOf schema (asynchronously) + * Test form parameter(s) for oneOf schema + * @param form1 (optional) + * @param form2 (optional) + * @param form3 (optional) + * @param form4 (optional) + * @param id (optional) + * @param name (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testFormOneofAsync(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testFormOneofValidateBeforeCall(form1, form2, form3, form4, id, name, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/HeaderApi.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/HeaderApi.java new file mode 100644 index 000000000000..6d1b6d5f1cc1 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/HeaderApi.java @@ -0,0 +1,240 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.StringEnumRef; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class HeaderApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public HeaderApi() { + this(Configuration.getDefaultApiClient()); + } + + public HeaderApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for testHeaderIntegerBooleanStringEnums + * @param integerHeader (optional) + * @param booleanHeader (optional) + * @param stringHeader (optional) + * @param enumNonrefStringHeader (optional) + * @param enumRefStringHeader (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testHeaderIntegerBooleanStringEnumsCall(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/header/integer/boolean/string/enums"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (integerHeader != null) { + localVarHeaderParams.put("integer_header", localVarApiClient.parameterToString(integerHeader)); + } + + + if (booleanHeader != null) { + localVarHeaderParams.put("boolean_header", localVarApiClient.parameterToString(booleanHeader)); + } + + + if (stringHeader != null) { + localVarHeaderParams.put("string_header", localVarApiClient.parameterToString(stringHeader)); + } + + + if (enumNonrefStringHeader != null) { + localVarHeaderParams.put("enum_nonref_string_header", localVarApiClient.parameterToString(enumNonrefStringHeader)); + } + + + if (enumRefStringHeader != null) { + localVarHeaderParams.put("enum_ref_string_header", localVarApiClient.parameterToString(enumRefStringHeader)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testHeaderIntegerBooleanStringEnumsValidateBeforeCall(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader, final ApiCallback _callback) throws ApiException { + return testHeaderIntegerBooleanStringEnumsCall(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, _callback); + + } + + /** + * Test header parameter(s) + * Test header parameter(s) + * @param integerHeader (optional) + * @param booleanHeader (optional) + * @param stringHeader (optional) + * @param enumNonrefStringHeader (optional) + * @param enumRefStringHeader (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testHeaderIntegerBooleanStringEnums(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader) throws ApiException { + ApiResponse localVarResp = testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader); + return localVarResp.getData(); + } + + /** + * Test header parameter(s) + * Test header parameter(s) + * @param integerHeader (optional) + * @param booleanHeader (optional) + * @param stringHeader (optional) + * @param enumNonrefStringHeader (optional) + * @param enumRefStringHeader (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testHeaderIntegerBooleanStringEnumsWithHttpInfo(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader) throws ApiException { + okhttp3.Call localVarCall = testHeaderIntegerBooleanStringEnumsValidateBeforeCall(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test header parameter(s) (asynchronously) + * Test header parameter(s) + * @param integerHeader (optional) + * @param booleanHeader (optional) + * @param stringHeader (optional) + * @param enumNonrefStringHeader (optional) + * @param enumRefStringHeader (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testHeaderIntegerBooleanStringEnumsAsync(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testHeaderIntegerBooleanStringEnumsValidateBeforeCall(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/PathApi.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/PathApi.java new file mode 100644 index 000000000000..94dc01a4b865 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/PathApi.java @@ -0,0 +1,235 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.StringEnumRef; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PathApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PathApi() { + this(Configuration.getDefaultApiClient()); + } + + public PathApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath + * @param pathString (required) + * @param pathInteger (required) + * @param enumNonrefStringPath (required) + * @param enumRefStringPath (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathCall(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}" + .replace("{" + "path_string" + "}", localVarApiClient.escapeString(pathString.toString())) + .replace("{" + "path_integer" + "}", localVarApiClient.escapeString(pathInteger.toString())) + .replace("{" + "enum_nonref_string_path" + "}", localVarApiClient.escapeString(enumNonrefStringPath.toString())) + .replace("{" + "enum_ref_string_path" + "}", localVarApiClient.escapeString(enumRefStringPath.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathValidateBeforeCall(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pathString' is set + if (pathString == null) { + throw new ApiException("Missing the required parameter 'pathString' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(Async)"); + } + + // verify the required parameter 'pathInteger' is set + if (pathInteger == null) { + throw new ApiException("Missing the required parameter 'pathInteger' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(Async)"); + } + + // verify the required parameter 'enumNonrefStringPath' is set + if (enumNonrefStringPath == null) { + throw new ApiException("Missing the required parameter 'enumNonrefStringPath' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(Async)"); + } + + // verify the required parameter 'enumRefStringPath' is set + if (enumRefStringPath == null) { + throw new ApiException("Missing the required parameter 'enumRefStringPath' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(Async)"); + } + + return testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathCall(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, _callback); + + } + + /** + * Test path parameter(s) + * Test path parameter(s) + * @param pathString (required) + * @param pathInteger (required) + * @param enumNonrefStringPath (required) + * @param enumRefStringPath (required) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath) throws ApiException { + ApiResponse localVarResp = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath); + return localVarResp.getData(); + } + + /** + * Test path parameter(s) + * Test path parameter(s) + * @param pathString (required) + * @param pathInteger (required) + * @param enumNonrefStringPath (required) + * @param enumRefStringPath (required) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath) throws ApiException { + okhttp3.Call localVarCall = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathValidateBeforeCall(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test path parameter(s) (asynchronously) + * Test path parameter(s) + * @param pathString (required) + * @param pathInteger (required) + * @param enumNonrefStringPath (required) + * @param enumRefStringPath (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathAsync(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathValidateBeforeCall(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/QueryApi.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/QueryApi.java new file mode 100644 index 000000000000..a16c6d183ef8 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/api/QueryApi.java @@ -0,0 +1,1527 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.DataQuery; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.StringEnumRef; +import org.openapitools.client.model.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter; +import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class QueryApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public QueryApi() { + this(Configuration.getDefaultApiClient()); + } + + public QueryApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for testEnumRefString + * @param enumNonrefStringQuery (optional) + * @param enumRefStringQuery (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEnumRefStringCall(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/query/enum_ref_string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (enumNonrefStringQuery != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_nonref_string_query", enumNonrefStringQuery)); + } + + if (enumRefStringQuery != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_ref_string_query", enumRefStringQuery)); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEnumRefStringValidateBeforeCall(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery, final ApiCallback _callback) throws ApiException { + return testEnumRefStringCall(enumNonrefStringQuery, enumRefStringQuery, _callback); + + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param enumNonrefStringQuery (optional) + * @param enumRefStringQuery (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testEnumRefString(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery) throws ApiException { + ApiResponse localVarResp = testEnumRefStringWithHttpInfo(enumNonrefStringQuery, enumRefStringQuery); + return localVarResp.getData(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param enumNonrefStringQuery (optional) + * @param enumRefStringQuery (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testEnumRefStringWithHttpInfo(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery) throws ApiException { + okhttp3.Call localVarCall = testEnumRefStringValidateBeforeCall(enumNonrefStringQuery, enumRefStringQuery, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test query parameter(s) (asynchronously) + * Test query parameter(s) + * @param enumNonrefStringQuery (optional) + * @param enumRefStringQuery (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testEnumRefStringAsync(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEnumRefStringValidateBeforeCall(enumNonrefStringQuery, enumRefStringQuery, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryDatetimeDateString + * @param datetimeQuery (optional) + * @param dateQuery (optional) + * @param stringQuery (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryDatetimeDateStringCall(@javax.annotation.Nullable OffsetDateTime datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/query/datetime/date/string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (datetimeQuery != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("datetime_query", datetimeQuery)); + } + + if (dateQuery != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("date_query", dateQuery)); + } + + if (stringQuery != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("string_query", stringQuery)); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryDatetimeDateStringValidateBeforeCall(@javax.annotation.Nullable OffsetDateTime datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery, final ApiCallback _callback) throws ApiException { + return testQueryDatetimeDateStringCall(datetimeQuery, dateQuery, stringQuery, _callback); + + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param datetimeQuery (optional) + * @param dateQuery (optional) + * @param stringQuery (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testQueryDatetimeDateString(@javax.annotation.Nullable OffsetDateTime datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { + ApiResponse localVarResp = testQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery); + return localVarResp.getData(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param datetimeQuery (optional) + * @param dateQuery (optional) + * @param stringQuery (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testQueryDatetimeDateStringWithHttpInfo(@javax.annotation.Nullable OffsetDateTime datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { + okhttp3.Call localVarCall = testQueryDatetimeDateStringValidateBeforeCall(datetimeQuery, dateQuery, stringQuery, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test query parameter(s) (asynchronously) + * Test query parameter(s) + * @param datetimeQuery (optional) + * @param dateQuery (optional) + * @param stringQuery (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryDatetimeDateStringAsync(@javax.annotation.Nullable OffsetDateTime datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryDatetimeDateStringValidateBeforeCall(datetimeQuery, dateQuery, stringQuery, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryIntegerBooleanString + * @param integerQuery (optional) + * @param booleanQuery (optional) + * @param stringQuery (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryIntegerBooleanStringCall(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/query/integer/boolean/string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (integerQuery != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("integer_query", integerQuery)); + } + + if (booleanQuery != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("boolean_query", booleanQuery)); + } + + if (stringQuery != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("string_query", stringQuery)); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryIntegerBooleanStringValidateBeforeCall(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery, final ApiCallback _callback) throws ApiException { + return testQueryIntegerBooleanStringCall(integerQuery, booleanQuery, stringQuery, _callback); + + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param integerQuery (optional) + * @param booleanQuery (optional) + * @param stringQuery (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testQueryIntegerBooleanString(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { + ApiResponse localVarResp = testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery); + return localVarResp.getData(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param integerQuery (optional) + * @param booleanQuery (optional) + * @param stringQuery (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testQueryIntegerBooleanStringWithHttpInfo(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { + okhttp3.Call localVarCall = testQueryIntegerBooleanStringValidateBeforeCall(integerQuery, booleanQuery, stringQuery, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test query parameter(s) (asynchronously) + * Test query parameter(s) + * @param integerQuery (optional) + * @param booleanQuery (optional) + * @param stringQuery (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryIntegerBooleanStringAsync(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryIntegerBooleanStringValidateBeforeCall(integerQuery, booleanQuery, stringQuery, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryStyleDeepObjectExplodeTrueObject + * @param queryObject (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleDeepObjectExplodeTrueObjectCall(@javax.annotation.Nullable Pet queryObject, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/query/style_deepObject/explode_true/object"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (queryObject != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query_object", queryObject)); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryStyleDeepObjectExplodeTrueObjectValidateBeforeCall(@javax.annotation.Nullable Pet queryObject, final ApiCallback _callback) throws ApiException { + return testQueryStyleDeepObjectExplodeTrueObjectCall(queryObject, _callback); + + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testQueryStyleDeepObjectExplodeTrueObject(@javax.annotation.Nullable Pet queryObject) throws ApiException { + ApiResponse localVarResp = testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject); + return localVarResp.getData(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(@javax.annotation.Nullable Pet queryObject) throws ApiException { + okhttp3.Call localVarCall = testQueryStyleDeepObjectExplodeTrueObjectValidateBeforeCall(queryObject, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test query parameter(s) (asynchronously) + * Test query parameter(s) + * @param queryObject (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleDeepObjectExplodeTrueObjectAsync(@javax.annotation.Nullable Pet queryObject, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryStyleDeepObjectExplodeTrueObjectValidateBeforeCall(queryObject, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryStyleDeepObjectExplodeTrueObjectAllOf + * @param queryObject (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleDeepObjectExplodeTrueObjectAllOfCall(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/query/style_deepObject/explode_true/object/allOf"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (queryObject != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query_object", queryObject)); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryStyleDeepObjectExplodeTrueObjectAllOfValidateBeforeCall(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject, final ApiCallback _callback) throws ApiException { + return testQueryStyleDeepObjectExplodeTrueObjectAllOfCall(queryObject, _callback); + + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testQueryStyleDeepObjectExplodeTrueObjectAllOf(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws ApiException { + ApiResponse localVarResp = testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject); + return localVarResp.getData(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws ApiException { + okhttp3.Call localVarCall = testQueryStyleDeepObjectExplodeTrueObjectAllOfValidateBeforeCall(queryObject, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test query parameter(s) (asynchronously) + * Test query parameter(s) + * @param queryObject (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleDeepObjectExplodeTrueObjectAllOfAsync(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryStyleDeepObjectExplodeTrueObjectAllOfValidateBeforeCall(queryObject, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryStyleFormExplodeFalseArrayInteger + * @param queryObject (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleFormExplodeFalseArrayIntegerCall(@javax.annotation.Nullable List queryObject, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/query/style_form/explode_false/array_integer"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (queryObject != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "query_object", queryObject)); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryStyleFormExplodeFalseArrayIntegerValidateBeforeCall(@javax.annotation.Nullable List queryObject, final ApiCallback _callback) throws ApiException { + return testQueryStyleFormExplodeFalseArrayIntegerCall(queryObject, _callback); + + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testQueryStyleFormExplodeFalseArrayInteger(@javax.annotation.Nullable List queryObject) throws ApiException { + ApiResponse localVarResp = testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject); + return localVarResp.getData(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(@javax.annotation.Nullable List queryObject) throws ApiException { + okhttp3.Call localVarCall = testQueryStyleFormExplodeFalseArrayIntegerValidateBeforeCall(queryObject, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test query parameter(s) (asynchronously) + * Test query parameter(s) + * @param queryObject (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleFormExplodeFalseArrayIntegerAsync(@javax.annotation.Nullable List queryObject, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryStyleFormExplodeFalseArrayIntegerValidateBeforeCall(queryObject, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryStyleFormExplodeFalseArrayString + * @param queryObject (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleFormExplodeFalseArrayStringCall(@javax.annotation.Nullable List queryObject, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/query/style_form/explode_false/array_string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (queryObject != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "query_object", queryObject)); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryStyleFormExplodeFalseArrayStringValidateBeforeCall(@javax.annotation.Nullable List queryObject, final ApiCallback _callback) throws ApiException { + return testQueryStyleFormExplodeFalseArrayStringCall(queryObject, _callback); + + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testQueryStyleFormExplodeFalseArrayString(@javax.annotation.Nullable List queryObject) throws ApiException { + ApiResponse localVarResp = testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject); + return localVarResp.getData(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(@javax.annotation.Nullable List queryObject) throws ApiException { + okhttp3.Call localVarCall = testQueryStyleFormExplodeFalseArrayStringValidateBeforeCall(queryObject, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test query parameter(s) (asynchronously) + * Test query parameter(s) + * @param queryObject (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleFormExplodeFalseArrayStringAsync(@javax.annotation.Nullable List queryObject, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryStyleFormExplodeFalseArrayStringValidateBeforeCall(queryObject, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryStyleFormExplodeTrueArrayString + * @param queryObject (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleFormExplodeTrueArrayStringCall(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/query/style_form/explode_true/array_string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (queryObject != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query_object", queryObject)); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryStyleFormExplodeTrueArrayStringValidateBeforeCall(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject, final ApiCallback _callback) throws ApiException { + return testQueryStyleFormExplodeTrueArrayStringCall(queryObject, _callback); + + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testQueryStyleFormExplodeTrueArrayString(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws ApiException { + ApiResponse localVarResp = testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject); + return localVarResp.getData(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws ApiException { + okhttp3.Call localVarCall = testQueryStyleFormExplodeTrueArrayStringValidateBeforeCall(queryObject, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test query parameter(s) (asynchronously) + * Test query parameter(s) + * @param queryObject (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleFormExplodeTrueArrayStringAsync(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryStyleFormExplodeTrueArrayStringValidateBeforeCall(queryObject, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryStyleFormExplodeTrueObject + * @param queryObject (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleFormExplodeTrueObjectCall(@javax.annotation.Nullable Pet queryObject, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/query/style_form/explode_true/object"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (queryObject != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query_object", queryObject)); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryStyleFormExplodeTrueObjectValidateBeforeCall(@javax.annotation.Nullable Pet queryObject, final ApiCallback _callback) throws ApiException { + return testQueryStyleFormExplodeTrueObjectCall(queryObject, _callback); + + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testQueryStyleFormExplodeTrueObject(@javax.annotation.Nullable Pet queryObject) throws ApiException { + ApiResponse localVarResp = testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject); + return localVarResp.getData(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testQueryStyleFormExplodeTrueObjectWithHttpInfo(@javax.annotation.Nullable Pet queryObject) throws ApiException { + okhttp3.Call localVarCall = testQueryStyleFormExplodeTrueObjectValidateBeforeCall(queryObject, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test query parameter(s) (asynchronously) + * Test query parameter(s) + * @param queryObject (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleFormExplodeTrueObjectAsync(@javax.annotation.Nullable Pet queryObject, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryStyleFormExplodeTrueObjectValidateBeforeCall(queryObject, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryStyleFormExplodeTrueObjectAllOf + * @param queryObject (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleFormExplodeTrueObjectAllOfCall(@javax.annotation.Nullable DataQuery queryObject, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/query/style_form/explode_true/object/allOf"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (queryObject != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query_object", queryObject)); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryStyleFormExplodeTrueObjectAllOfValidateBeforeCall(@javax.annotation.Nullable DataQuery queryObject, final ApiCallback _callback) throws ApiException { + return testQueryStyleFormExplodeTrueObjectAllOfCall(queryObject, _callback); + + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testQueryStyleFormExplodeTrueObjectAllOf(@javax.annotation.Nullable DataQuery queryObject) throws ApiException { + ApiResponse localVarResp = testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject); + return localVarResp.getData(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param queryObject (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(@javax.annotation.Nullable DataQuery queryObject) throws ApiException { + okhttp3.Call localVarCall = testQueryStyleFormExplodeTrueObjectAllOfValidateBeforeCall(queryObject, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test query parameter(s) (asynchronously) + * Test query parameter(s) + * @param queryObject (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleFormExplodeTrueObjectAllOfAsync(@javax.annotation.Nullable DataQuery queryObject, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryStyleFormExplodeTrueObjectAllOfValidateBeforeCall(queryObject, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryStyleJsonSerializationObject + * @param jsonSerializedObjectRefStringQuery (optional) + * @param jsonSerializedObjectArrayRefStringQuery (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleJsonSerializationObjectCall(@javax.annotation.Nullable Pet jsonSerializedObjectRefStringQuery, @javax.annotation.Nullable List jsonSerializedObjectArrayRefStringQuery, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/query/style_jsonSerialization/object"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (jsonSerializedObjectRefStringQuery != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("json_serialized_object_ref_string_query", jsonSerializedObjectRefStringQuery)); + } + + if (jsonSerializedObjectArrayRefStringQuery != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "json_serialized_object_array_ref_string_query", jsonSerializedObjectArrayRefStringQuery)); + } + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryStyleJsonSerializationObjectValidateBeforeCall(@javax.annotation.Nullable Pet jsonSerializedObjectRefStringQuery, @javax.annotation.Nullable List jsonSerializedObjectArrayRefStringQuery, final ApiCallback _callback) throws ApiException { + return testQueryStyleJsonSerializationObjectCall(jsonSerializedObjectRefStringQuery, jsonSerializedObjectArrayRefStringQuery, _callback); + + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param jsonSerializedObjectRefStringQuery (optional) + * @param jsonSerializedObjectArrayRefStringQuery (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public String testQueryStyleJsonSerializationObject(@javax.annotation.Nullable Pet jsonSerializedObjectRefStringQuery, @javax.annotation.Nullable List jsonSerializedObjectArrayRefStringQuery) throws ApiException { + ApiResponse localVarResp = testQueryStyleJsonSerializationObjectWithHttpInfo(jsonSerializedObjectRefStringQuery, jsonSerializedObjectArrayRefStringQuery); + return localVarResp.getData(); + } + + /** + * Test query parameter(s) + * Test query parameter(s) + * @param jsonSerializedObjectRefStringQuery (optional) + * @param jsonSerializedObjectArrayRefStringQuery (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public ApiResponse testQueryStyleJsonSerializationObjectWithHttpInfo(@javax.annotation.Nullable Pet jsonSerializedObjectRefStringQuery, @javax.annotation.Nullable List jsonSerializedObjectArrayRefStringQuery) throws ApiException { + okhttp3.Call localVarCall = testQueryStyleJsonSerializationObjectValidateBeforeCall(jsonSerializedObjectRefStringQuery, jsonSerializedObjectArrayRefStringQuery, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Test query parameter(s) (asynchronously) + * Test query parameter(s) + * @param jsonSerializedObjectRefStringQuery (optional) + * @param jsonSerializedObjectArrayRefStringQuery (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation -
+ */ + public okhttp3.Call testQueryStyleJsonSerializationObjectAsync(@javax.annotation.Nullable Pet jsonSerializedObjectRefStringQuery, @javax.annotation.Nullable List jsonSerializedObjectArrayRefStringQuery, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryStyleJsonSerializationObjectValidateBeforeCall(jsonSerializedObjectRefStringQuery, jsonSerializedObjectArrayRefStringQuery, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..43667b658353 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..951184215a07 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..ea1ec808247e --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..12a64f0c4152 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,62 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..3f4a671a37b6 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,142 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Bird.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Bird.java new file mode 100644 index 000000000000..b29ba67d3336 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Bird.java @@ -0,0 +1,314 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Bird + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Bird { + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private String size; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + @javax.annotation.Nullable + private String color; + + public Bird() { + } + + public Bird size(@javax.annotation.Nullable String size) { + this.size = size; + return this; + } + + /** + * Get size + * @return size + */ + @javax.annotation.Nullable + + public String getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable String size) { + this.size = size; + } + + + public Bird color(@javax.annotation.Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @javax.annotation.Nullable + + public String getColor() { + return color; + } + + public void setColor(@javax.annotation.Nullable String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Bird instance itself + */ + public Bird putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Bird bird = (Bird) o; + return Objects.equals(this.size, bird.size) && + Objects.equals(this.color, bird.color)&& + Objects.equals(this.additionalProperties, bird.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(size, color, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Bird {\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("size", "color")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Bird + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Bird.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Bird is not found in the empty JSON string", Bird.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("size") != null && !jsonObj.get("size").isJsonNull()) && !jsonObj.get("size").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `size` to be a primitive type in the JSON string but got `%s`", jsonObj.get("size").toString())); + } + if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Bird.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Bird' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Bird.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Bird value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Bird read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Bird instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Bird given an JSON string + * + * @param jsonString JSON string + * @return An instance of Bird + * @throws IOException if the JSON string is invalid with respect to Bird + */ + public static Bird fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Bird.class); + } + + /** + * Convert an instance of Bird to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Category.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..64fc82ec9d4d --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,311 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Category + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Category { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, category.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Category + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Category.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Category' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Category.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Category value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Category read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Category given an JSON string + * + * @param jsonString JSON string + * @return An instance of Category + * @throws IOException if the JSON string is invalid with respect to Category + */ + public static Category fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Category.class); + } + + /** + * Convert an instance of Category to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DataQuery.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DataQuery.java new file mode 100644 index 000000000000..718b29086c9d --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DataQuery.java @@ -0,0 +1,348 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Query; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DataQuery + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class DataQuery extends Query { + public static final String SERIALIZED_NAME_SUFFIX = "suffix"; + @SerializedName(SERIALIZED_NAME_SUFFIX) + @javax.annotation.Nullable + private String suffix; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) + @javax.annotation.Nullable + private OffsetDateTime date; + + public DataQuery() { + } + + public DataQuery suffix(@javax.annotation.Nullable String suffix) { + this.suffix = suffix; + return this; + } + + /** + * test suffix + * @return suffix + */ + @javax.annotation.Nullable + + public String getSuffix() { + return suffix; + } + + public void setSuffix(@javax.annotation.Nullable String suffix) { + this.suffix = suffix; + } + + + public DataQuery text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * Some text containing white spaces + * @return text + */ + @javax.annotation.Nullable + + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + public DataQuery date(@javax.annotation.Nullable OffsetDateTime date) { + this.date = date; + return this; + } + + /** + * A date + * @return date + */ + @javax.annotation.Nullable + + public OffsetDateTime getDate() { + return date; + } + + public void setDate(@javax.annotation.Nullable OffsetDateTime date) { + this.date = date; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DataQuery instance itself + */ + public DataQuery putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DataQuery dataQuery = (DataQuery) o; + return Objects.equals(this.suffix, dataQuery.suffix) && + Objects.equals(this.text, dataQuery.text) && + Objects.equals(this.date, dataQuery.date)&& + Objects.equals(this.additionalProperties, dataQuery.additionalProperties) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(suffix, text, date, super.hashCode(), additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DataQuery {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" suffix: ").append(toIndentedString(suffix)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "outcomes", "suffix", "text", "date")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DataQuery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DataQuery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in DataQuery is not found in the empty JSON string", DataQuery.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("suffix") != null && !jsonObj.get("suffix").isJsonNull()) && !jsonObj.get("suffix").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `suffix` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suffix").toString())); + } + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DataQuery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DataQuery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DataQuery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DataQuery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public DataQuery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DataQuery instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DataQuery given an JSON string + * + * @param jsonString JSON string + * @return An instance of DataQuery + * @throws IOException if the JSON string is invalid with respect to DataQuery + */ + public static DataQuery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DataQuery.class); + } + + /** + * Convert an instance of DataQuery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DefaultValue.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DefaultValue.java new file mode 100644 index 000000000000..661720bc725e --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DefaultValue.java @@ -0,0 +1,627 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.StringEnumRef; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * to test the default value of properties + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class DefaultValue { + public static final String SERIALIZED_NAME_ARRAY_STRING_ENUM_REF_DEFAULT = "array_string_enum_ref_default"; + @SerializedName(SERIALIZED_NAME_ARRAY_STRING_ENUM_REF_DEFAULT) + @javax.annotation.Nullable + private List arrayStringEnumRefDefault = new ArrayList<>(Arrays.asList(StringEnumRef.SUCCESS, StringEnumRef.FAILURE)); + + /** + * Gets or Sets arrayStringEnumDefault + */ + @JsonAdapter(ArrayStringEnumDefaultEnum.Adapter.class) + public enum ArrayStringEnumDefaultEnum { + SUCCESS("success"), + + FAILURE("failure"), + + UNCLASSIFIED("unclassified"); + + private String value; + + ArrayStringEnumDefaultEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ArrayStringEnumDefaultEnum fromValue(String value) { + for (ArrayStringEnumDefaultEnum b : ArrayStringEnumDefaultEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ArrayStringEnumDefaultEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ArrayStringEnumDefaultEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ArrayStringEnumDefaultEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ArrayStringEnumDefaultEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ARRAY_STRING_ENUM_DEFAULT = "array_string_enum_default"; + @SerializedName(SERIALIZED_NAME_ARRAY_STRING_ENUM_DEFAULT) + @javax.annotation.Nullable + private List arrayStringEnumDefault = new ArrayList<>(Arrays.asList(ArrayStringEnumDefaultEnum.SUCCESS, ArrayStringEnumDefaultEnum.FAILURE)); + + public static final String SERIALIZED_NAME_ARRAY_STRING_DEFAULT = "array_string_default"; + @SerializedName(SERIALIZED_NAME_ARRAY_STRING_DEFAULT) + @javax.annotation.Nullable + private List arrayStringDefault = new ArrayList<>(Arrays.asList("failure", "skipped")); + + public static final String SERIALIZED_NAME_ARRAY_INTEGER_DEFAULT = "array_integer_default"; + @SerializedName(SERIALIZED_NAME_ARRAY_INTEGER_DEFAULT) + @javax.annotation.Nullable + private List arrayIntegerDefault = new ArrayList<>(Arrays.asList(1, 3)); + + public static final String SERIALIZED_NAME_ARRAY_STRING = "array_string"; + @SerializedName(SERIALIZED_NAME_ARRAY_STRING) + @javax.annotation.Nullable + private List arrayString = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ARRAY_STRING_NULLABLE = "array_string_nullable"; + @SerializedName(SERIALIZED_NAME_ARRAY_STRING_NULLABLE) + @javax.annotation.Nullable + private List arrayStringNullable; + + public static final String SERIALIZED_NAME_ARRAY_STRING_EXTENSION_NULLABLE = "array_string_extension_nullable"; + @SerializedName(SERIALIZED_NAME_ARRAY_STRING_EXTENSION_NULLABLE) + @javax.annotation.Nullable + private List arrayStringExtensionNullable; + + public static final String SERIALIZED_NAME_STRING_NULLABLE = "string_nullable"; + @SerializedName(SERIALIZED_NAME_STRING_NULLABLE) + @javax.annotation.Nullable + private String stringNullable; + + public DefaultValue() { + } + + public DefaultValue arrayStringEnumRefDefault(@javax.annotation.Nullable List arrayStringEnumRefDefault) { + this.arrayStringEnumRefDefault = arrayStringEnumRefDefault; + return this; + } + + public DefaultValue addArrayStringEnumRefDefaultItem(StringEnumRef arrayStringEnumRefDefaultItem) { + if (this.arrayStringEnumRefDefault == null) { + this.arrayStringEnumRefDefault = new ArrayList<>(Arrays.asList(StringEnumRef.SUCCESS, StringEnumRef.FAILURE)); + } + this.arrayStringEnumRefDefault.add(arrayStringEnumRefDefaultItem); + return this; + } + + /** + * Get arrayStringEnumRefDefault + * @return arrayStringEnumRefDefault + */ + @javax.annotation.Nullable + + public List getArrayStringEnumRefDefault() { + return arrayStringEnumRefDefault; + } + + public void setArrayStringEnumRefDefault(@javax.annotation.Nullable List arrayStringEnumRefDefault) { + this.arrayStringEnumRefDefault = arrayStringEnumRefDefault; + } + + + public DefaultValue arrayStringEnumDefault(@javax.annotation.Nullable List arrayStringEnumDefault) { + this.arrayStringEnumDefault = arrayStringEnumDefault; + return this; + } + + public DefaultValue addArrayStringEnumDefaultItem(ArrayStringEnumDefaultEnum arrayStringEnumDefaultItem) { + if (this.arrayStringEnumDefault == null) { + this.arrayStringEnumDefault = new ArrayList<>(Arrays.asList(ArrayStringEnumDefaultEnum.SUCCESS, ArrayStringEnumDefaultEnum.FAILURE)); + } + this.arrayStringEnumDefault.add(arrayStringEnumDefaultItem); + return this; + } + + /** + * Get arrayStringEnumDefault + * @return arrayStringEnumDefault + */ + @javax.annotation.Nullable + + public List getArrayStringEnumDefault() { + return arrayStringEnumDefault; + } + + public void setArrayStringEnumDefault(@javax.annotation.Nullable List arrayStringEnumDefault) { + this.arrayStringEnumDefault = arrayStringEnumDefault; + } + + + public DefaultValue arrayStringDefault(@javax.annotation.Nullable List arrayStringDefault) { + this.arrayStringDefault = arrayStringDefault; + return this; + } + + public DefaultValue addArrayStringDefaultItem(String arrayStringDefaultItem) { + if (this.arrayStringDefault == null) { + this.arrayStringDefault = new ArrayList<>(Arrays.asList("failure", "skipped")); + } + this.arrayStringDefault.add(arrayStringDefaultItem); + return this; + } + + /** + * Get arrayStringDefault + * @return arrayStringDefault + */ + @javax.annotation.Nullable + + public List getArrayStringDefault() { + return arrayStringDefault; + } + + public void setArrayStringDefault(@javax.annotation.Nullable List arrayStringDefault) { + this.arrayStringDefault = arrayStringDefault; + } + + + public DefaultValue arrayIntegerDefault(@javax.annotation.Nullable List arrayIntegerDefault) { + this.arrayIntegerDefault = arrayIntegerDefault; + return this; + } + + public DefaultValue addArrayIntegerDefaultItem(Integer arrayIntegerDefaultItem) { + if (this.arrayIntegerDefault == null) { + this.arrayIntegerDefault = new ArrayList<>(Arrays.asList(1, 3)); + } + this.arrayIntegerDefault.add(arrayIntegerDefaultItem); + return this; + } + + /** + * Get arrayIntegerDefault + * @return arrayIntegerDefault + */ + @javax.annotation.Nullable + + public List getArrayIntegerDefault() { + return arrayIntegerDefault; + } + + public void setArrayIntegerDefault(@javax.annotation.Nullable List arrayIntegerDefault) { + this.arrayIntegerDefault = arrayIntegerDefault; + } + + + public DefaultValue arrayString(@javax.annotation.Nullable List arrayString) { + this.arrayString = arrayString; + return this; + } + + public DefaultValue addArrayStringItem(String arrayStringItem) { + if (this.arrayString == null) { + this.arrayString = new ArrayList<>(); + } + this.arrayString.add(arrayStringItem); + return this; + } + + /** + * Get arrayString + * @return arrayString + */ + @javax.annotation.Nullable + + public List getArrayString() { + return arrayString; + } + + public void setArrayString(@javax.annotation.Nullable List arrayString) { + this.arrayString = arrayString; + } + + + public DefaultValue arrayStringNullable(@javax.annotation.Nullable List arrayStringNullable) { + this.arrayStringNullable = arrayStringNullable; + return this; + } + + public DefaultValue addArrayStringNullableItem(String arrayStringNullableItem) { + if (this.arrayStringNullable == null) { + this.arrayStringNullable = new ArrayList<>(); + } + this.arrayStringNullable.add(arrayStringNullableItem); + return this; + } + + /** + * Get arrayStringNullable + * @return arrayStringNullable + */ + @javax.annotation.Nullable + + public List getArrayStringNullable() { + return arrayStringNullable; + } + + public void setArrayStringNullable(@javax.annotation.Nullable List arrayStringNullable) { + this.arrayStringNullable = arrayStringNullable; + } + + + public DefaultValue arrayStringExtensionNullable(@javax.annotation.Nullable List arrayStringExtensionNullable) { + this.arrayStringExtensionNullable = arrayStringExtensionNullable; + return this; + } + + public DefaultValue addArrayStringExtensionNullableItem(String arrayStringExtensionNullableItem) { + if (this.arrayStringExtensionNullable == null) { + this.arrayStringExtensionNullable = new ArrayList<>(); + } + this.arrayStringExtensionNullable.add(arrayStringExtensionNullableItem); + return this; + } + + /** + * Get arrayStringExtensionNullable + * @return arrayStringExtensionNullable + */ + @javax.annotation.Nullable + + public List getArrayStringExtensionNullable() { + return arrayStringExtensionNullable; + } + + public void setArrayStringExtensionNullable(@javax.annotation.Nullable List arrayStringExtensionNullable) { + this.arrayStringExtensionNullable = arrayStringExtensionNullable; + } + + + public DefaultValue stringNullable(@javax.annotation.Nullable String stringNullable) { + this.stringNullable = stringNullable; + return this; + } + + /** + * Get stringNullable + * @return stringNullable + */ + @javax.annotation.Nullable + + public String getStringNullable() { + return stringNullable; + } + + public void setStringNullable(@javax.annotation.Nullable String stringNullable) { + this.stringNullable = stringNullable; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DefaultValue instance itself + */ + public DefaultValue putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DefaultValue defaultValue = (DefaultValue) o; + return Objects.equals(this.arrayStringEnumRefDefault, defaultValue.arrayStringEnumRefDefault) && + Objects.equals(this.arrayStringEnumDefault, defaultValue.arrayStringEnumDefault) && + Objects.equals(this.arrayStringDefault, defaultValue.arrayStringDefault) && + Objects.equals(this.arrayIntegerDefault, defaultValue.arrayIntegerDefault) && + Objects.equals(this.arrayString, defaultValue.arrayString) && + Objects.equals(this.arrayStringNullable, defaultValue.arrayStringNullable) && + Objects.equals(this.arrayStringExtensionNullable, defaultValue.arrayStringExtensionNullable) && + Objects.equals(this.stringNullable, defaultValue.stringNullable)&& + Objects.equals(this.additionalProperties, defaultValue.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(arrayStringEnumRefDefault, arrayStringEnumDefault, arrayStringDefault, arrayIntegerDefault, arrayString, arrayStringNullable, arrayStringExtensionNullable, stringNullable, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefaultValue {\n"); + sb.append(" arrayStringEnumRefDefault: ").append(toIndentedString(arrayStringEnumRefDefault)).append("\n"); + sb.append(" arrayStringEnumDefault: ").append(toIndentedString(arrayStringEnumDefault)).append("\n"); + sb.append(" arrayStringDefault: ").append(toIndentedString(arrayStringDefault)).append("\n"); + sb.append(" arrayIntegerDefault: ").append(toIndentedString(arrayIntegerDefault)).append("\n"); + sb.append(" arrayString: ").append(toIndentedString(arrayString)).append("\n"); + sb.append(" arrayStringNullable: ").append(toIndentedString(arrayStringNullable)).append("\n"); + sb.append(" arrayStringExtensionNullable: ").append(toIndentedString(arrayStringExtensionNullable)).append("\n"); + sb.append(" stringNullable: ").append(toIndentedString(stringNullable)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("array_string_enum_ref_default", "array_string_enum_default", "array_string_default", "array_integer_default", "array_string", "array_string_nullable", "array_string_extension_nullable", "string_nullable")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DefaultValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefaultValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in DefaultValue is not found in the empty JSON string", DefaultValue.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("array_string_enum_ref_default") != null && !jsonObj.get("array_string_enum_ref_default").isJsonNull() && !jsonObj.get("array_string_enum_ref_default").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_string_enum_ref_default` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_enum_ref_default").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_string_enum_default") != null && !jsonObj.get("array_string_enum_default").isJsonNull() && !jsonObj.get("array_string_enum_default").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_string_enum_default` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_enum_default").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_string_default") != null && !jsonObj.get("array_string_default").isJsonNull() && !jsonObj.get("array_string_default").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_string_default` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_default").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_integer_default") != null && !jsonObj.get("array_integer_default").isJsonNull() && !jsonObj.get("array_integer_default").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_integer_default` to be an array in the JSON string but got `%s`", jsonObj.get("array_integer_default").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_string") != null && !jsonObj.get("array_string").isJsonNull() && !jsonObj.get("array_string").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_string` to be an array in the JSON string but got `%s`", jsonObj.get("array_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_string_nullable") != null && !jsonObj.get("array_string_nullable").isJsonNull() && !jsonObj.get("array_string_nullable").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_string_nullable` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_nullable").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_string_extension_nullable") != null && !jsonObj.get("array_string_extension_nullable").isJsonNull() && !jsonObj.get("array_string_extension_nullable").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_string_extension_nullable` to be an array in the JSON string but got `%s`", jsonObj.get("array_string_extension_nullable").toString())); + } + if ((jsonObj.get("string_nullable") != null && !jsonObj.get("string_nullable").isJsonNull()) && !jsonObj.get("string_nullable").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `string_nullable` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_nullable").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefaultValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefaultValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DefaultValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DefaultValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public DefaultValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DefaultValue instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DefaultValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefaultValue + * @throws IOException if the JSON string is invalid with respect to DefaultValue + */ + public static DefaultValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefaultValue.class); + } + + /** + * Convert an instance of DefaultValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java new file mode 100644 index 000000000000..0f8351db73e4 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java @@ -0,0 +1,338 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NumberPropertiesOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NumberPropertiesOnly { + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) + @javax.annotation.Nullable + private BigDecimal number; + + public static final String SERIALIZED_NAME_FLOAT = "float"; + @SerializedName(SERIALIZED_NAME_FLOAT) + @javax.annotation.Nullable + private Float _float; + + public static final String SERIALIZED_NAME_DOUBLE = "double"; + @SerializedName(SERIALIZED_NAME_DOUBLE) + @javax.annotation.Nullable + private Double _double; + + public NumberPropertiesOnly() { + } + + public NumberPropertiesOnly number(@javax.annotation.Nullable BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * @return number + */ + @javax.annotation.Nullable + + public BigDecimal getNumber() { + return number; + } + + public void setNumber(@javax.annotation.Nullable BigDecimal number) { + this.number = number; + } + + + public NumberPropertiesOnly _float(@javax.annotation.Nullable Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * @return _float + */ + @javax.annotation.Nullable + + public Float getFloat() { + return _float; + } + + public void setFloat(@javax.annotation.Nullable Float _float) { + this._float = _float; + } + + + public NumberPropertiesOnly _double(@javax.annotation.Nullable Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 0.8 + * maximum: 50.2 + * @return _double + */ + @javax.annotation.Nullable + + public Double getDouble() { + return _double; + } + + public void setDouble(@javax.annotation.Nullable Double _double) { + this._double = _double; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NumberPropertiesOnly instance itself + */ + public NumberPropertiesOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberPropertiesOnly numberPropertiesOnly = (NumberPropertiesOnly) o; + return Objects.equals(this.number, numberPropertiesOnly.number) && + Objects.equals(this._float, numberPropertiesOnly._float) && + Objects.equals(this._double, numberPropertiesOnly._double)&& + Objects.equals(this.additionalProperties, numberPropertiesOnly.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(number, _float, _double, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberPropertiesOnly {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("number", "float", "double")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NumberPropertiesOnly + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NumberPropertiesOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NumberPropertiesOnly is not found in the empty JSON string", NumberPropertiesOnly.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NumberPropertiesOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NumberPropertiesOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NumberPropertiesOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NumberPropertiesOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NumberPropertiesOnly read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NumberPropertiesOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NumberPropertiesOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of NumberPropertiesOnly + * @throws IOException if the JSON string is invalid with respect to NumberPropertiesOnly + */ + public static NumberPropertiesOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NumberPropertiesOnly.class); + } + + /** + * Convert an instance of NumberPropertiesOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..322b1a1fb99e --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,532 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pet { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable 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 + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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.name, pet.name) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status)&& + Objects.equals(this.additionalProperties, pet.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, category, photoUrls, tags, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name", "category", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Pet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Pet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Pet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Pet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Pet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Pet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Pet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Pet given an JSON string + * + * @param jsonString JSON string + * @return An instance of Pet + * @throws IOException if the JSON string is invalid with respect to Pet + */ + public static Pet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Pet.class); + } + + /** + * Convert an instance of Pet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Query.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Query.java new file mode 100644 index 000000000000..d4e8f1070a40 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Query.java @@ -0,0 +1,306 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Query + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Query { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + /** + * Gets or Sets outcomes + */ + @JsonAdapter(OutcomesEnum.Adapter.class) + public enum OutcomesEnum { + SUCCESS("SUCCESS"), + + FAILURE("FAILURE"), + + SKIPPED("SKIPPED"); + + private String value; + + OutcomesEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OutcomesEnum fromValue(String value) { + for (OutcomesEnum b : OutcomesEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OutcomesEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OutcomesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OutcomesEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OutcomesEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_OUTCOMES = "outcomes"; + @SerializedName(SERIALIZED_NAME_OUTCOMES) + @javax.annotation.Nullable + private List outcomes = new ArrayList<>(Arrays.asList(OutcomesEnum.SUCCESS, OutcomesEnum.FAILURE)); + + public Query() { + } + + public Query id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Query + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Query outcomes(@javax.annotation.Nullable List outcomes) { + this.outcomes = outcomes; + return this; + } + + public Query addOutcomesItem(OutcomesEnum outcomesItem) { + if (this.outcomes == null) { + this.outcomes = new ArrayList<>(Arrays.asList(OutcomesEnum.SUCCESS, OutcomesEnum.FAILURE)); + } + this.outcomes.add(outcomesItem); + return this; + } + + /** + * Get outcomes + * @return outcomes + */ + @javax.annotation.Nullable + + public List getOutcomes() { + return outcomes; + } + + public void setOutcomes(@javax.annotation.Nullable List outcomes) { + this.outcomes = outcomes; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Query instance itself + */ + public Query putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Query query = (Query) o; + return Objects.equals(this.id, query.id) && + Objects.equals(this.outcomes, query.outcomes)&& + Objects.equals(this.additionalProperties, query.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, outcomes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Query {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" outcomes: ").append(toIndentedString(outcomes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "outcomes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Query + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Query.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Query is not found in the empty JSON string", Query.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("outcomes") != null && !jsonObj.get("outcomes").isJsonNull() && !jsonObj.get("outcomes").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `outcomes` to be an array in the JSON string but got `%s`", jsonObj.get("outcomes").toString())); + } + } + + + /** + * Create an instance of Query given an JSON string + * + * @param jsonString JSON string + * @return An instance of Query + * @throws IOException if the JSON string is invalid with respect to Query + */ + public static Query fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Query.class); + } + + /** + * Convert an instance of Query to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/StringEnumRef.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/StringEnumRef.java new file mode 100644 index 000000000000..c786ac6c8423 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/StringEnumRef.java @@ -0,0 +1,80 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets StringEnumRef + */ +@JsonAdapter(StringEnumRef.Adapter.class) +public enum StringEnumRef { + + SUCCESS("success"), + + FAILURE("failure"), + + UNCLASSIFIED("unclassified"); + + private String value; + + StringEnumRef(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StringEnumRef fromValue(String value) { + for (StringEnumRef b : StringEnumRef.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StringEnumRef enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StringEnumRef read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StringEnumRef.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StringEnumRef.fromValue(value); + } +} + diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..54335f38f48d --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,311 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Tag + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Tag { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Tag + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Tag.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Tag' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Tag value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Tag read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Tag given an JSON string + * + * @param jsonString JSON string + * @return An instance of Tag + * @throws IOException if the JSON string is invalid with respect to Tag + */ + public static Tag fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Tag.class); + } + + /** + * Convert an instance of Tag to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java new file mode 100644 index 000000000000..3465a851a6ff --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java @@ -0,0 +1,284 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TestFormObjectMultipartRequestMarker + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class TestFormObjectMultipartRequestMarker { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public TestFormObjectMultipartRequestMarker() { + } + + public TestFormObjectMultipartRequestMarker name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TestFormObjectMultipartRequestMarker instance itself + */ + public TestFormObjectMultipartRequestMarker putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestFormObjectMultipartRequestMarker testFormObjectMultipartRequestMarker = (TestFormObjectMultipartRequestMarker) o; + return Objects.equals(this.name, testFormObjectMultipartRequestMarker.name)&& + Objects.equals(this.additionalProperties, testFormObjectMultipartRequestMarker.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestFormObjectMultipartRequestMarker {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TestFormObjectMultipartRequestMarker + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TestFormObjectMultipartRequestMarker.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TestFormObjectMultipartRequestMarker is not found in the empty JSON string", TestFormObjectMultipartRequestMarker.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TestFormObjectMultipartRequestMarker.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TestFormObjectMultipartRequestMarker' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TestFormObjectMultipartRequestMarker.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TestFormObjectMultipartRequestMarker value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TestFormObjectMultipartRequestMarker read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TestFormObjectMultipartRequestMarker instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TestFormObjectMultipartRequestMarker given an JSON string + * + * @param jsonString JSON string + * @return An instance of TestFormObjectMultipartRequestMarker + * @throws IOException if the JSON string is invalid with respect to TestFormObjectMultipartRequestMarker + */ + public static TestFormObjectMultipartRequestMarker fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TestFormObjectMultipartRequestMarker.class); + } + + /** + * Convert an instance of TestFormObjectMultipartRequestMarker to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java new file mode 100644 index 000000000000..1ff0062bc133 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java @@ -0,0 +1,371 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter { + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private String size; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + @javax.annotation.Nullable + private String color; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() { + } + + public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter size(@javax.annotation.Nullable String size) { + this.size = size; + return this; + } + + /** + * Get size + * @return size + */ + @javax.annotation.Nullable + + public String getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable String size) { + this.size = size; + } + + + public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter color(@javax.annotation.Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @javax.annotation.Nullable + + public String getColor() { + return color; + } + + public void setColor(@javax.annotation.Nullable String color) { + this.color = color; + } + + + public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter instance itself + */ + public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter = (TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) o; + return Objects.equals(this.size, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.size) && + Objects.equals(this.color, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.color) && + Objects.equals(this.id, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.id) && + Objects.equals(this.name, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.name)&& + Objects.equals(this.additionalProperties, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(size, color, id, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter {\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("size", "color", "id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter is not found in the empty JSON string", TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("size") != null && !jsonObj.get("size").isJsonNull()) && !jsonObj.get("size").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `size` to be a primitive type in the JSON string but got `%s`", jsonObj.get("size").toString())); + } + if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + * @throws IOException if the JSON string is invalid with respect to TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + */ + public static TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.class); + } + + /** + * Convert an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java new file mode 100644 index 000000000000..39433329c8e2 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java @@ -0,0 +1,296 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nullable + private List values = new ArrayList<>(); + + public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() { + } + + public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter values(@javax.annotation.Nullable List values) { + this.values = values; + return this; + } + + public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter addValuesItem(String valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * Get values + * @return values + */ + @javax.annotation.Nullable + + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nullable List values) { + this.values = values; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter instance itself + */ + public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter testQueryStyleFormExplodeTrueArrayStringQueryObjectParameter = (TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) o; + return Objects.equals(this.values, testQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.values)&& + Objects.equals(this.additionalProperties, testQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(values, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("values")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter is not found in the empty JSON string", TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + * @throws IOException if the JSON string is invalid with respect to TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + */ + public static TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.class); + } + + /** + * Convert an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/AuthApiTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/AuthApiTest.java new file mode 100644 index 000000000000..30f2ae34d88c --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/AuthApiTest.java @@ -0,0 +1,59 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AuthApi + */ +@Disabled +public class AuthApiTest { + + private final AuthApi api = new AuthApi(); + + /** + * To test HTTP basic authentication + * + * To test HTTP basic authentication + * + * @throws ApiException if the Api call fails + */ + @Test + public void testAuthHttpBasicTest() throws ApiException { + String response = api.testAuthHttpBasic(); + // TODO: test validations + } + + /** + * To test HTTP bearer authentication + * + * To test HTTP bearer authentication + * + * @throws ApiException if the Api call fails + */ + @Test + public void testAuthHttpBearerTest() throws ApiException { + String response = api.testAuthHttpBearer(); + // TODO: test validations + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/BodyApiTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/BodyApiTest.java new file mode 100644 index 000000000000..bb6329045fe7 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/BodyApiTest.java @@ -0,0 +1,176 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.StringEnumRef; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for BodyApi + */ +@Disabled +public class BodyApiTest { + + private final BodyApi api = new BodyApi(); + + /** + * Test binary (gif) response body + * + * Test binary (gif) response body + * + * @throws ApiException if the Api call fails + */ + @Test + public void testBinaryGifTest() throws ApiException { + File response = api.testBinaryGif(); + // TODO: test validations + } + + /** + * Test body parameter(s) + * + * Test body parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyApplicationOctetstreamBinaryTest() throws ApiException { + File body = null; + String response = api.testBodyApplicationOctetstreamBinary(body); + // TODO: test validations + } + + /** + * Test array of binary in multipart mime + * + * Test array of binary in multipart mime + * + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyMultipartFormdataArrayOfBinaryTest() throws ApiException { + List files = null; + String response = api.testBodyMultipartFormdataArrayOfBinary(files); + // TODO: test validations + } + + /** + * Test single binary in multipart mime + * + * Test single binary in multipart mime + * + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyMultipartFormdataSingleBinaryTest() throws ApiException { + File myFile = null; + String response = api.testBodyMultipartFormdataSingleBinary(myFile); + // TODO: test validations + } + + /** + * Test body parameter(s) + * + * Test body parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEchoBodyAllOfPetTest() throws ApiException { + Pet pet = null; + Pet response = api.testEchoBodyAllOfPet(pet); + // TODO: test validations + } + + /** + * Test free form object + * + * Test free form object + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEchoBodyFreeFormObjectResponseStringTest() throws ApiException { + Object body = null; + String response = api.testEchoBodyFreeFormObjectResponseString(body); + // TODO: test validations + } + + /** + * Test body parameter(s) + * + * Test body parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEchoBodyPetTest() throws ApiException { + Pet pet = null; + Pet response = api.testEchoBodyPet(pet); + // TODO: test validations + } + + /** + * Test empty response body + * + * Test empty response body + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEchoBodyPetResponseStringTest() throws ApiException { + Pet pet = null; + String response = api.testEchoBodyPetResponseString(pet); + // TODO: test validations + } + + /** + * Test string enum response body + * + * Test string enum response body + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEchoBodyStringEnumTest() throws ApiException { + String body = null; + StringEnumRef response = api.testEchoBodyStringEnum(body); + // TODO: test validations + } + + /** + * Test empty json (request body) + * + * Test empty json (request body) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEchoBodyTagResponseStringTest() throws ApiException { + Tag tag = null; + String response = api.testEchoBodyTagResponseString(tag); + // TODO: test validations + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/FormApiTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/FormApiTest.java new file mode 100644 index 000000000000..d8c00e452186 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/FormApiTest.java @@ -0,0 +1,83 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.TestFormObjectMultipartRequestMarker; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FormApi + */ +@Disabled +public class FormApiTest { + + private final FormApi api = new FormApi(); + + /** + * Test form parameter(s) + * + * Test form parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testFormIntegerBooleanStringTest() throws ApiException { + Integer integerForm = null; + Boolean booleanForm = null; + String stringForm = null; + String response = api.testFormIntegerBooleanString(integerForm, booleanForm, stringForm); + // TODO: test validations + } + + /** + * Test form parameter(s) for multipart schema + * + * Test form parameter(s) for multipart schema + * + * @throws ApiException if the Api call fails + */ + @Test + public void testFormObjectMultipartTest() throws ApiException { + TestFormObjectMultipartRequestMarker marker = null; + String response = api.testFormObjectMultipart(marker); + // TODO: test validations + } + + /** + * Test form parameter(s) for oneOf schema + * + * Test form parameter(s) for oneOf schema + * + * @throws ApiException if the Api call fails + */ + @Test + public void testFormOneofTest() throws ApiException { + String form1 = null; + Integer form2 = null; + String form3 = null; + Boolean form4 = null; + Long id = null; + String name = null; + String response = api.testFormOneof(form1, form2, form3, form4, id, name); + // TODO: test validations + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/HeaderApiTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/HeaderApiTest.java new file mode 100644 index 000000000000..ecff2132d112 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/HeaderApiTest.java @@ -0,0 +1,52 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.StringEnumRef; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for HeaderApi + */ +@Disabled +public class HeaderApiTest { + + private final HeaderApi api = new HeaderApi(); + + /** + * Test header parameter(s) + * + * Test header parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testHeaderIntegerBooleanStringEnumsTest() throws ApiException { + Integer integerHeader = null; + Boolean booleanHeader = null; + String stringHeader = null; + String enumNonrefStringHeader = null; + StringEnumRef enumRefStringHeader = null; + String response = api.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader); + // TODO: test validations + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/PathApiTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/PathApiTest.java new file mode 100644 index 000000000000..96e5ff98794a --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/PathApiTest.java @@ -0,0 +1,51 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.StringEnumRef; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PathApi + */ +@Disabled +public class PathApiTest { + + private final PathApi api = new PathApi(); + + /** + * Test path parameter(s) + * + * Test path parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathTest() throws ApiException { + String pathString = null; + Integer pathInteger = null; + String enumNonrefStringPath = null; + StringEnumRef enumRefStringPath = null; + String response = api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath); + // TODO: test validations + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/QueryApiTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/QueryApiTest.java new file mode 100644 index 000000000000..0c1a8757bd3e --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/api/QueryApiTest.java @@ -0,0 +1,200 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.DataQuery; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.StringEnumRef; +import org.openapitools.client.model.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter; +import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for QueryApi + */ +@Disabled +public class QueryApiTest { + + private final QueryApi api = new QueryApi(); + + /** + * Test query parameter(s) + * + * Test query parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEnumRefStringTest() throws ApiException { + String enumNonrefStringQuery = null; + StringEnumRef enumRefStringQuery = null; + String response = api.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery); + // TODO: test validations + } + + /** + * Test query parameter(s) + * + * Test query parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryDatetimeDateStringTest() throws ApiException { + OffsetDateTime datetimeQuery = null; + LocalDate dateQuery = null; + String stringQuery = null; + String response = api.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery); + // TODO: test validations + } + + /** + * Test query parameter(s) + * + * Test query parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryIntegerBooleanStringTest() throws ApiException { + Integer integerQuery = null; + Boolean booleanQuery = null; + String stringQuery = null; + String response = api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery); + // TODO: test validations + } + + /** + * Test query parameter(s) + * + * Test query parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryStyleDeepObjectExplodeTrueObjectTest() throws ApiException { + Pet queryObject = null; + String response = api.testQueryStyleDeepObjectExplodeTrueObject(queryObject); + // TODO: test validations + } + + /** + * Test query parameter(s) + * + * Test query parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryStyleDeepObjectExplodeTrueObjectAllOfTest() throws ApiException { + TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject = null; + String response = api.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject); + // TODO: test validations + } + + /** + * Test query parameter(s) + * + * Test query parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryStyleFormExplodeFalseArrayIntegerTest() throws ApiException { + List queryObject = null; + String response = api.testQueryStyleFormExplodeFalseArrayInteger(queryObject); + // TODO: test validations + } + + /** + * Test query parameter(s) + * + * Test query parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryStyleFormExplodeFalseArrayStringTest() throws ApiException { + List queryObject = null; + String response = api.testQueryStyleFormExplodeFalseArrayString(queryObject); + // TODO: test validations + } + + /** + * Test query parameter(s) + * + * Test query parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryStyleFormExplodeTrueArrayStringTest() throws ApiException { + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = null; + String response = api.testQueryStyleFormExplodeTrueArrayString(queryObject); + // TODO: test validations + } + + /** + * Test query parameter(s) + * + * Test query parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryStyleFormExplodeTrueObjectTest() throws ApiException { + Pet queryObject = null; + String response = api.testQueryStyleFormExplodeTrueObject(queryObject); + // TODO: test validations + } + + /** + * Test query parameter(s) + * + * Test query parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryStyleFormExplodeTrueObjectAllOfTest() throws ApiException { + DataQuery queryObject = null; + String response = api.testQueryStyleFormExplodeTrueObjectAllOf(queryObject); + // TODO: test validations + } + + /** + * Test query parameter(s) + * + * Test query parameter(s) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryStyleJsonSerializationObjectTest() throws ApiException { + Pet jsonSerializedObjectRefStringQuery = null; + List jsonSerializedObjectArrayRefStringQuery = null; + String response = api.testQueryStyleJsonSerializationObject(jsonSerializedObjectRefStringQuery, jsonSerializedObjectArrayRefStringQuery); + // TODO: test validations + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/BirdTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/BirdTest.java new file mode 100644 index 000000000000..6fefee961fbc --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/BirdTest.java @@ -0,0 +1,55 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Bird + */ +public class BirdTest { + private final Bird model = new Bird(); + + /** + * Model tests for Bird + */ + @Test + public void testBird() { + // TODO: test Bird + } + + /** + * Test the property 'size' + */ + @Test + public void sizeTest() { + // TODO: test size + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..af84de36d1b3 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,55 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/DataQueryTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/DataQueryTest.java new file mode 100644 index 000000000000..40ab0c3498c2 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/DataQueryTest.java @@ -0,0 +1,84 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Query; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DataQuery + */ +public class DataQueryTest { + private final DataQuery model = new DataQuery(); + + /** + * Model tests for DataQuery + */ + @Test + public void testDataQuery() { + // TODO: test DataQuery + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'outcomes' + */ + @Test + public void outcomesTest() { + // TODO: test outcomes + } + + /** + * Test the property 'suffix' + */ + @Test + public void suffixTest() { + // TODO: test suffix + } + + /** + * Test the property 'text' + */ + @Test + public void textTest() { + // TODO: test text + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/DefaultValueTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/DefaultValueTest.java new file mode 100644 index 000000000000..7c6ee09e00c1 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/DefaultValueTest.java @@ -0,0 +1,108 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.StringEnumRef; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DefaultValue + */ +public class DefaultValueTest { + private final DefaultValue model = new DefaultValue(); + + /** + * Model tests for DefaultValue + */ + @Test + public void testDefaultValue() { + // TODO: test DefaultValue + } + + /** + * Test the property 'arrayStringEnumRefDefault' + */ + @Test + public void arrayStringEnumRefDefaultTest() { + // TODO: test arrayStringEnumRefDefault + } + + /** + * Test the property 'arrayStringEnumDefault' + */ + @Test + public void arrayStringEnumDefaultTest() { + // TODO: test arrayStringEnumDefault + } + + /** + * Test the property 'arrayStringDefault' + */ + @Test + public void arrayStringDefaultTest() { + // TODO: test arrayStringDefault + } + + /** + * Test the property 'arrayIntegerDefault' + */ + @Test + public void arrayIntegerDefaultTest() { + // TODO: test arrayIntegerDefault + } + + /** + * Test the property 'arrayString' + */ + @Test + public void arrayStringTest() { + // TODO: test arrayString + } + + /** + * Test the property 'arrayStringNullable' + */ + @Test + public void arrayStringNullableTest() { + // TODO: test arrayStringNullable + } + + /** + * Test the property 'arrayStringExtensionNullable' + */ + @Test + public void arrayStringExtensionNullableTest() { + // TODO: test arrayStringExtensionNullable + } + + /** + * Test the property 'stringNullable' + */ + @Test + public void stringNullableTest() { + // TODO: test stringNullable + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java new file mode 100644 index 000000000000..bf19ea602619 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/NumberPropertiesOnlyTest.java @@ -0,0 +1,64 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NumberPropertiesOnly + */ +public class NumberPropertiesOnlyTest { + private final NumberPropertiesOnly model = new NumberPropertiesOnly(); + + /** + * Model tests for NumberPropertiesOnly + */ + @Test + public void testNumberPropertiesOnly() { + // TODO: test NumberPropertiesOnly + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property '_float' + */ + @Test + public void _floatTest() { + // TODO: test _float + } + + /** + * Test the property '_double' + */ + @Test + public void _doubleTest() { + // TODO: test _double + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..56d51705502e --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,92 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/QueryTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/QueryTest.java new file mode 100644 index 000000000000..bb5f94192c34 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/QueryTest.java @@ -0,0 +1,58 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Query + */ +public class QueryTest { + private final Query model = new Query(); + + /** + * Model tests for Query + */ + @Test + public void testQuery() { + // TODO: test Query + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'outcomes' + */ + @Test + public void outcomesTest() { + // TODO: test outcomes + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/StringEnumRefTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/StringEnumRefTest.java new file mode 100644 index 000000000000..179fe3981c20 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/StringEnumRefTest.java @@ -0,0 +1,32 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for StringEnumRef + */ +public class StringEnumRefTest { + /** + * Model tests for StringEnumRef + */ + @Test + public void testStringEnumRef() { + // TODO: test StringEnumRef + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..7f0c5df44f96 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,55 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java new file mode 100644 index 000000000000..977878c14d59 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java @@ -0,0 +1,47 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TestFormObjectMultipartRequestMarker + */ +public class TestFormObjectMultipartRequestMarkerTest { + private final TestFormObjectMultipartRequestMarker model = new TestFormObjectMultipartRequestMarker(); + + /** + * Model tests for TestFormObjectMultipartRequestMarker + */ + @Test + public void testTestFormObjectMultipartRequestMarker() { + // TODO: test TestFormObjectMultipartRequestMarker + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java new file mode 100644 index 000000000000..4c1990fda009 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java @@ -0,0 +1,71 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + */ +public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest { + private final TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter model = new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(); + + /** + * Model tests for TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + */ + @Test + public void testTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() { + // TODO: test TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + } + + /** + * Test the property 'size' + */ + @Test + public void sizeTest() { + // TODO: test size + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java new file mode 100644 index 000000000000..d99f4d76fa28 --- /dev/null +++ b/samples/client/echo_api/java/okhttp/src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java @@ -0,0 +1,50 @@ +/* + * Echo Server API + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + */ +public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest { + private final TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter model = new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(); + + /** + * Model tests for TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + */ + @Test + public void testTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() { + // TODO: test TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + } + + /** + * Test the property 'values' + */ + @Test + public void valuesTest() { + // TODO: test values + } + +} diff --git a/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/model/OneOf1.java b/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/model/OneOf1.java index 9b1b01ba42dc..94401a60a884 100644 --- a/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/model/OneOf1.java +++ b/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/model/OneOf1.java @@ -79,6 +79,50 @@ public void setMessage1(@javax.annotation.Nullable String message1) { this.message1 = message1; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OneOf1 instance itself + */ + public OneOf1 putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -90,12 +134,13 @@ public boolean equals(Object o) { return false; } OneOf1 oneOf1 = (OneOf1) o; - return Objects.equals(this.message1, oneOf1.message1); + return Objects.equals(this.message1, oneOf1.message1)&& + Objects.equals(this.additionalProperties, oneOf1.additionalProperties); } @Override public int hashCode() { - return Objects.hash(message1); + return Objects.hash(message1, additionalProperties); } @Override @@ -103,6 +148,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class OneOf1 {\n"); sb.append(" message1: ").append(toIndentedString(message1)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -139,14 +185,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in OneOf1 is not found in the empty JSON string", OneOf1.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!OneOf1.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `OneOf1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("message1") != null && !jsonObj.get("message1").isJsonNull()) && !jsonObj.get("message1").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message1` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message1").toString())); @@ -168,6 +206,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, OneOf1 value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -175,7 +235,28 @@ public void write(JsonWriter out, OneOf1 value) throws IOException { public OneOf1 read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OneOf1 instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SomeObj.java b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SomeObj.java index cc128d25c878..590cd2a9af3a 100644 --- a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SomeObj.java +++ b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SomeObj.java @@ -225,6 +225,50 @@ public void setType(@javax.annotation.Nullable String type) { this.type = type; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SomeObj instance itself + */ + public SomeObj putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -240,12 +284,13 @@ public boolean equals(Object o) { Objects.equals(this.id, someObj.id) && Objects.equals(this.name, someObj.name) && Objects.equals(this.active, someObj.active) && - Objects.equals(this.type, someObj.type); + Objects.equals(this.type, someObj.type)&& + Objects.equals(this.additionalProperties, someObj.additionalProperties); } @Override public int hashCode() { - return Objects.hash($type, id, name, active, type); + return Objects.hash($type, id, name, active, type, additionalProperties); } @Override @@ -257,6 +302,7 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" active: ").append(toIndentedString(active)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -293,14 +339,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SomeObj is not found in the empty JSON string", SomeObj.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SomeObj.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `SomeObj` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("$_type") != null && !jsonObj.get("$_type").isJsonNull()) && !jsonObj.get("$_type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `$_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("$_type").toString())); @@ -332,6 +370,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SomeObj value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -339,7 +399,28 @@ public void write(JsonWriter out, SomeObj value) throws IOException { public SomeObj read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SomeObj instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/others/java/okhttp-oneOf-array/.github/workflows/maven.yml b/samples/client/others/java/okhttp-oneOf-array/.github/workflows/maven.yml new file mode 100644 index 000000000000..eedad4943b7e --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build oneOf with array inside + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/others/java/okhttp-oneOf-array/.gitignore b/samples/client/others/java/okhttp-oneOf-array/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/.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/client/others/java/okhttp-oneOf-array/.openapi-generator-ignore b/samples/client/others/java/okhttp-oneOf-array/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/.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/client/others/java/okhttp-oneOf-array/.openapi-generator/FILES b/samples/client/others/java/okhttp-oneOf-array/.openapi-generator/FILES new file mode 100644 index 000000000000..63017fb66a0f --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/.openapi-generator/FILES @@ -0,0 +1,43 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/DefaultApi.md +docs/MyExampleGet200Response.md +docs/OneOf1.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/DefaultApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/MyExampleGet200Response.java +src/main/java/org/openapitools/client/model/OneOf1.java +src/test/java/org/openapitools/client/api/DefaultApiTest.java +src/test/java/org/openapitools/client/model/MyExampleGet200ResponseTest.java +src/test/java/org/openapitools/client/model/OneOf1Test.java diff --git a/samples/client/others/java/okhttp-oneOf-array/.openapi-generator/VERSION b/samples/client/others/java/okhttp-oneOf-array/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/others/java/okhttp-oneOf-array/.travis.yml b/samples/client/others/java/okhttp-oneOf-array/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/.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/client/others/java/okhttp-oneOf-array/README.md b/samples/client/others/java/okhttp-oneOf-array/README.md new file mode 100644 index 000000000000..d560b1a80c1d --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/README.md @@ -0,0 +1,138 @@ +# openapi-java-client + +oneOf with array inside +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + openapi-java-client + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'openapi-java-client' jar has been published to maven central. + mavenLocal() // Needed if the 'openapi-java-client' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:openapi-java-client:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/openapi-java-client-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + MyExampleGet200Response result = apiInstance.myExampleGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#myExampleGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**myExampleGet**](docs/DefaultApi.md#myExampleGet) | **GET** /myExample | + + +## Documentation for Models + + - [MyExampleGet200Response](docs/MyExampleGet200Response.md) + - [OneOf1](docs/OneOf1.md) + + + +## Documentation for Authorization + +Endpoints do not require authorization. + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/others/java/okhttp-oneOf-array/api/openapi.yaml b/samples/client/others/java/okhttp-oneOf-array/api/openapi.yaml new file mode 100644 index 000000000000..1685979bda65 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/api/openapi.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.3 +info: + title: oneOf with array inside + version: 1.0.0 +servers: +- url: / +paths: + /myExample: + get: + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/_myExample_get_200_response" + description: Response + x-accepts: + - application/json +components: + schemas: + OneOf1: + example: + message1: message1 + properties: + message1: + type: string + type: object + _myExample_get_200_response: + oneOf: + - items: + $ref: "#/components/schemas/OneOf1" + type: array + - $ref: "#/components/schemas/OneOf1" + diff --git a/samples/client/others/java/okhttp-oneOf-array/build.gradle b/samples/client/others/java/okhttp-oneOf-array/build.gradle new file mode 100644 index 000000000000..51015d437594 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/build.gradle @@ -0,0 +1,65 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'openapi-java-client' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + bean_validation_version = "2.0.2" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + compileOnly "jakarta.validation:jakarta.validation-api:$bean_validation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/others/java/okhttp-oneOf-array/build.sbt b/samples/client/others/java/okhttp-oneOf-array/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/others/java/okhttp-oneOf-array/docs/DefaultApi.md b/samples/client/others/java/okhttp-oneOf-array/docs/DefaultApi.md new file mode 100644 index 000000000000..295eeb3a7cfb --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/docs/DefaultApi.md @@ -0,0 +1,65 @@ +# DefaultApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**myExampleGet**](DefaultApi.md#myExampleGet) | **GET** /myExample | | + + + +# **myExampleGet** +> MyExampleGet200Response myExampleGet() + + + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + MyExampleGet200Response result = apiInstance.myExampleGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#myExampleGet"); + 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 + +[**MyExampleGet200Response**](MyExampleGet200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Response | - | + diff --git a/samples/client/others/java/okhttp-oneOf-array/docs/MyExampleGet200Response.md b/samples/client/others/java/okhttp-oneOf-array/docs/MyExampleGet200Response.md new file mode 100644 index 000000000000..4c078788ed8d --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/docs/MyExampleGet200Response.md @@ -0,0 +1,13 @@ + + +# MyExampleGet200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**message1** | **String** | | [optional] | + + + diff --git a/samples/client/others/java/okhttp-oneOf-array/docs/OneOf1.md b/samples/client/others/java/okhttp-oneOf-array/docs/OneOf1.md new file mode 100644 index 000000000000..cb9b4cc0cd3f --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/docs/OneOf1.md @@ -0,0 +1,13 @@ + + +# OneOf1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**message1** | **String** | | [optional] | + + + diff --git a/samples/client/others/java/okhttp-oneOf-array/git_push.sh b/samples/client/others/java/okhttp-oneOf-array/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/others/java/okhttp-oneOf-array/gradle.properties b/samples/client/others/java/okhttp-oneOf-array/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/others/java/okhttp-oneOf-array/gradle/wrapper/gradle-wrapper.jar b/samples/client/others/java/okhttp-oneOf-array/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/others/java/okhttp-oneOf-array/gradlew.bat b/samples/client/others/java/okhttp-oneOf-array/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/others/java/okhttp-oneOf-array/pom.xml b/samples/client/others/java/okhttp-oneOf-array/pom.xml new file mode 100644 index 000000000000..a46963222138 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/pom.xml @@ -0,0 +1,287 @@ + + 4.0.0 + org.openapitools + openapi-java-client + jar + openapi-java-client + 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 + http://unlicense.org + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + 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-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.10.1 + 1.3.5 + 2.0.2 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/others/java/okhttp-oneOf-array/settings.gradle b/samples/client/others/java/okhttp-oneOf-array/settings.gradle new file mode 100644 index 000000000000..369ba54a9e06 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "openapi-java-client" \ No newline at end of file diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/AndroidManifest.xml b/samples/client/others/java/okhttp-oneOf-array/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..69aaeb678b7f --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..e32d5c8fa39e --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1631 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://localhost"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://localhost) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiException.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..2378fe28ee09 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..379916694e4e --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Configuration.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..7c6465977ef1 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/JSON.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..1b8109f1af28 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,441 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.MyExampleGet200Response.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.OneOf1.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Pair.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..92939e1d6b2c --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..ec06de9658f3 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..7a6d7f78da25 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..e1725f7e308c --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..cdf697b171ee --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..22718e035fbd --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..1fc3a9fb0fbd --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,197 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +import org.openapitools.client.model.MyExampleGet200Response; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DefaultApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for myExampleGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Response -
+ */ + public okhttp3.Call myExampleGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/myExample"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call myExampleGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return myExampleGetCall(_callback); + + } + + /** + * + * + * @return MyExampleGet200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Response -
+ */ + public MyExampleGet200Response myExampleGet() throws ApiException { + ApiResponse localVarResp = myExampleGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * + * @return ApiResponse<MyExampleGet200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Response -
+ */ + public ApiResponse myExampleGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = myExampleGetValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Response -
+ */ + public okhttp3.Call myExampleGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = myExampleGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..95009b88da79 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..19b41c1e2ad9 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..895207adf05f --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..8b6cef17746c --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,62 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..7fffad995826 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,142 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/MyExampleGet200Response.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/MyExampleGet200Response.java new file mode 100644 index 000000000000..b65e6c7bf388 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/MyExampleGet200Response.java @@ -0,0 +1,273 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; +import org.openapitools.client.model.OneOf1; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class MyExampleGet200Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(MyExampleGet200Response.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MyExampleGet200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize List<@Valid OneOf1> + try { + // validate the JSON object to see if any exception is thrown + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List<@Valid OneOf1> failed with `%s`.", e.getMessage())); + } + + // deserialize OneOf1 + try { + // validate the JSON object to see if any exception is thrown + OneOf1.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for OneOf1 failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for MyExampleGet200Response: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MyExampleGet200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MyExampleGet200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final Type typeInstanceListOneOf1 = new TypeToken>(){}.getType(); + final TypeAdapter> adapterListOneOf1 = (TypeAdapter>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance)); + final TypeAdapter adapterOneOf1 = gson.getDelegateAdapter(this, TypeToken.get(OneOf1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MyExampleGet200Response value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `List<@Valid OneOf1>` + if (value.getActualInstance() instanceof List) { + List list = (List) value.getActualInstance(); + if (!list.isEmpty() && list.get(0) instanceof OneOf1) { + JsonArray array = adapterListOneOf1.toJsonTree((List<@Valid OneOf1>)value.getActualInstance()).getAsJsonArray(); + elementAdapter.write(out, array); + return; + } + } + + // check if the actual instance is of the type `OneOf1` + if (value.getActualInstance() instanceof OneOf1) { + JsonElement element = adapterOneOf1.toJsonTree((OneOf1)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: List<@Valid OneOf1>, OneOf1"); + } + + @Override + public MyExampleGet200Response read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize List<@Valid OneOf1> + try { + // validate the JSON object to see if any exception is thrown + actualAdapter = adapterListOneOf1; + match++; + log.log(Level.FINER, "Input data matches schema 'List<@Valid OneOf1>'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List<@Valid OneOf1> failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'List<@Valid OneOf1>'", e); + } + + // deserialize OneOf1 + try { + // validate the JSON object to see if any exception is thrown + OneOf1.validateJsonElement(jsonElement); + actualAdapter = adapterOneOf1; + match++; + log.log(Level.FINER, "Input data matches schema 'OneOf1'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for OneOf1 failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'OneOf1'", e); + } + + if (match == 1) { + MyExampleGet200Response ret = new MyExampleGet200Response(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for MyExampleGet200Response: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public MyExampleGet200Response() { + super("oneOf", Boolean.FALSE); + } + + public MyExampleGet200Response(List<@Valid OneOf1> o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public MyExampleGet200Response(OneOf1 o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List<@Valid OneOf1>", List<@Valid OneOf1>.class); + schemas.put("OneOf1", OneOf1.class); + } + + @Override + public Map> getSchemas() { + return MyExampleGet200Response.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * List<@Valid OneOf1>, OneOf1 + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List<@Valid OneOf1>.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(OneOf1.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List<@Valid OneOf1>, OneOf1"); + } + + /** + * Get the actual instance, which can be the following: + * List<@Valid OneOf1>, OneOf1 + * + * @return The actual instance (List<@Valid OneOf1>, OneOf1) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List<@Valid OneOf1>`. If the actual instance is not `List<@Valid OneOf1>`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List<@Valid OneOf1>` + * @throws ClassCastException if the instance is not `List<@Valid OneOf1>` + */ + public List<@Valid OneOf1> getList<@Valid OneOf1>() throws ClassCastException { + return (List<@Valid OneOf1>)super.getActualInstance(); + } + + /** + * Get the actual instance of `OneOf1`. If the actual instance is not `OneOf1`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `OneOf1` + * @throws ClassCastException if the instance is not `OneOf1` + */ + public OneOf1 getOneOf1() throws ClassCastException { + return (OneOf1)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/OneOf1.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/OneOf1.java new file mode 100644 index 000000000000..1bd952ab2576 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/OneOf1.java @@ -0,0 +1,287 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OneOf1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OneOf1 { + public static final String SERIALIZED_NAME_MESSAGE1 = "message1"; + @SerializedName(SERIALIZED_NAME_MESSAGE1) + @javax.annotation.Nullable + private String message1; + + public OneOf1() { + } + + public OneOf1 message1(@javax.annotation.Nullable String message1) { + this.message1 = message1; + return this; + } + + /** + * Get message1 + * @return message1 + */ + @javax.annotation.Nullable + + + public String getMessage1() { + return message1; + } + + public void setMessage1(@javax.annotation.Nullable String message1) { + this.message1 = message1; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OneOf1 instance itself + */ + public OneOf1 putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OneOf1 oneOf1 = (OneOf1) o; + return Objects.equals(this.message1, oneOf1.message1)&& + Objects.equals(this.additionalProperties, oneOf1.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(message1, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OneOf1 {\n"); + sb.append(" message1: ").append(toIndentedString(message1)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("message1")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OneOf1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OneOf1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in OneOf1 is not found in the empty JSON string", OneOf1.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("message1") != null && !jsonObj.get("message1").isJsonNull()) && !jsonObj.get("message1").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message1` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message1").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OneOf1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OneOf1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OneOf1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OneOf1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OneOf1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OneOf1 instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OneOf1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of OneOf1 + * @throws IOException if the JSON string is invalid with respect to OneOf1 + */ + public static OneOf1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OneOf1.class); + } + + /** + * Convert an instance of OneOf1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/others/java/okhttp-oneOf-array/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/others/java/okhttp-oneOf-array/src/test/java/org/openapitools/client/api/DefaultApiTest.java new file mode 100644 index 000000000000..188cc1a0258b --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -0,0 +1,46 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.MyExampleGet200Response; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * API tests for DefaultApi + */ +@Disabled +public class DefaultApiTest { + + private final DefaultApi api = new DefaultApi(); + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void myExampleGetTest() throws ApiException { + MyExampleGet200Response response = api.myExampleGet(); + // TODO: test validations + } + +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/test/java/org/openapitools/client/model/MyExampleGet200ResponseTest.java b/samples/client/others/java/okhttp-oneOf-array/src/test/java/org/openapitools/client/model/MyExampleGet200ResponseTest.java new file mode 100644 index 000000000000..2f1bbf9538ee --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/test/java/org/openapitools/client/model/MyExampleGet200ResponseTest.java @@ -0,0 +1,49 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; +import org.openapitools.client.model.OneOf1; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MyExampleGet200Response + */ +public class MyExampleGet200ResponseTest { + private final MyExampleGet200Response model = new MyExampleGet200Response(); + + /** + * Model tests for MyExampleGet200Response + */ + @Test + public void testMyExampleGet200Response() { + // TODO: test MyExampleGet200Response + } + + /** + * Test the property 'message1' + */ + @Test + public void message1Test() { + // TODO: test message1 + } + +} diff --git a/samples/client/others/java/okhttp-oneOf-array/src/test/java/org/openapitools/client/model/OneOf1Test.java b/samples/client/others/java/okhttp-oneOf-array/src/test/java/org/openapitools/client/model/OneOf1Test.java new file mode 100644 index 000000000000..02fd6364f1a1 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf-array/src/test/java/org/openapitools/client/model/OneOf1Test.java @@ -0,0 +1,47 @@ +/* + * oneOf with array inside + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OneOf1 + */ +public class OneOf1Test { + private final OneOf1 model = new OneOf1(); + + /** + * Model tests for OneOf1 + */ + @Test + public void testOneOf1() { + // TODO: test OneOf1 + } + + /** + * Test the property 'message1' + */ + @Test + public void message1Test() { + // TODO: test message1 + } + +} diff --git a/samples/client/others/java/okhttp-oneOf/.github/workflows/maven.yml b/samples/client/others/java/okhttp-oneOf/.github/workflows/maven.yml new file mode 100644 index 000000000000..08a45f321d1d --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build oneOf two primitives + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/others/java/okhttp-oneOf/.gitignore b/samples/client/others/java/okhttp-oneOf/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/.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/client/others/java/okhttp-oneOf/.openapi-generator-ignore b/samples/client/others/java/okhttp-oneOf/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/.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/client/others/java/okhttp-oneOf/.openapi-generator/FILES b/samples/client/others/java/okhttp-oneOf/.openapi-generator/FILES new file mode 100644 index 000000000000..c8c7620d5886 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/.openapi-generator/FILES @@ -0,0 +1,40 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/DefaultApi.md +docs/MyExamplePostRequest.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/DefaultApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/MyExamplePostRequest.java +src/test/java/org/openapitools/client/api/DefaultApiTest.java +src/test/java/org/openapitools/client/model/MyExamplePostRequestTest.java diff --git a/samples/client/others/java/okhttp-oneOf/.openapi-generator/VERSION b/samples/client/others/java/okhttp-oneOf/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/others/java/okhttp-oneOf/.travis.yml b/samples/client/others/java/okhttp-oneOf/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/.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/client/others/java/okhttp-oneOf/README.md b/samples/client/others/java/okhttp-oneOf/README.md new file mode 100644 index 000000000000..33a90e1a2503 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/README.md @@ -0,0 +1,137 @@ +# openapi-java-client + +oneOf two primitives +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + openapi-java-client + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'openapi-java-client' jar has been published to maven central. + mavenLocal() // Needed if the 'openapi-java-client' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:openapi-java-client:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/openapi-java-client-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + MyExamplePostRequest myExamplePostRequest = new MyExamplePostRequest(); // MyExamplePostRequest | + try { + apiInstance.myExamplePost(myExamplePostRequest); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#myExamplePost"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**myExamplePost**](docs/DefaultApi.md#myExamplePost) | **POST** /myExample | + + +## Documentation for Models + + - [MyExamplePostRequest](docs/MyExamplePostRequest.md) + + + +## Documentation for Authorization + +Endpoints do not require authorization. + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/others/java/okhttp-oneOf/api/openapi.yaml b/samples/client/others/java/okhttp-oneOf/api/openapi.yaml new file mode 100644 index 000000000000..f6392860613a --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/api/openapi.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.3 +info: + description: "oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450" + title: oneOf two primitives + version: 1.0.0 +servers: +- url: / +paths: + /myExample: + post: + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/_myExample_post_request" + responses: + "200": + description: OK + x-content-type: application/json + x-accepts: + - application/json +components: + schemas: + _myExample_post_request: + oneOf: + - format: ipv4 + type: string + - format: ipv6 + type: string + diff --git a/samples/client/others/java/okhttp-oneOf/build.gradle b/samples/client/others/java/okhttp-oneOf/build.gradle new file mode 100644 index 000000000000..7184e3bd1b48 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/build.gradle @@ -0,0 +1,63 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'openapi-java-client' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/others/java/okhttp-oneOf/build.sbt b/samples/client/others/java/okhttp-oneOf/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/others/java/okhttp-oneOf/docs/DefaultApi.md b/samples/client/others/java/okhttp-oneOf/docs/DefaultApi.md new file mode 100644 index 000000000000..e536ad85876c --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/docs/DefaultApi.md @@ -0,0 +1,68 @@ +# DefaultApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**myExamplePost**](DefaultApi.md#myExamplePost) | **POST** /myExample | | + + + +# **myExamplePost** +> myExamplePost(myExamplePostRequest) + + + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + MyExamplePostRequest myExamplePostRequest = new MyExamplePostRequest(); // MyExamplePostRequest | + try { + apiInstance.myExamplePost(myExamplePostRequest); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#myExamplePost"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **myExamplePostRequest** | [**MyExamplePostRequest**](MyExamplePostRequest.md)| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + diff --git a/samples/client/others/java/okhttp-oneOf/docs/MyExamplePostRequest.md b/samples/client/others/java/okhttp-oneOf/docs/MyExamplePostRequest.md new file mode 100644 index 000000000000..0912191d18be --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/docs/MyExamplePostRequest.md @@ -0,0 +1,12 @@ + + +# MyExamplePostRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/others/java/okhttp-oneOf/git_push.sh b/samples/client/others/java/okhttp-oneOf/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/others/java/okhttp-oneOf/gradle.properties b/samples/client/others/java/okhttp-oneOf/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/others/java/okhttp-oneOf/gradle/wrapper/gradle-wrapper.jar b/samples/client/others/java/okhttp-oneOf/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/others/java/okhttp-oneOf/gradlew.bat b/samples/client/others/java/okhttp-oneOf/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/others/java/okhttp-oneOf/pom.xml b/samples/client/others/java/okhttp-oneOf/pom.xml new file mode 100644 index 000000000000..9765cad08b88 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/pom.xml @@ -0,0 +1,279 @@ + + 4.0.0 + org.openapitools + openapi-java-client + jar + openapi-java-client + 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 + http://unlicense.org + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + 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-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.10.1 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/others/java/okhttp-oneOf/settings.gradle b/samples/client/others/java/okhttp-oneOf/settings.gradle new file mode 100644 index 000000000000..369ba54a9e06 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "openapi-java-client" \ No newline at end of file diff --git a/samples/client/others/java/okhttp-oneOf/src/main/AndroidManifest.xml b/samples/client/others/java/okhttp-oneOf/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..d80e18a02d7f --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..1786d2948e8e --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1631 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://localhost"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://localhost) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiException.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..d33a2b82f52a --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..251f85ee0c2a --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Configuration.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..22e4cc65546f --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/JSON.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..42fb10bec699 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,440 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.MyExamplePostRequest.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Pair.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..5d400085c8c4 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..7f4f2fc244de --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..b8a228071b86 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..314240400732 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..5679fe99a1b5 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..b398ff061495 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..b2cbfd07b9eb --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,193 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.MyExamplePostRequest; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DefaultApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for myExamplePost + * @param myExamplePostRequest (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call myExamplePostCall(@javax.annotation.Nullable MyExamplePostRequest myExamplePostRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = myExamplePostRequest; + + // create path and map variables + String localVarPath = "/myExample"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call myExamplePostValidateBeforeCall(@javax.annotation.Nullable MyExamplePostRequest myExamplePostRequest, final ApiCallback _callback) throws ApiException { + return myExamplePostCall(myExamplePostRequest, _callback); + + } + + /** + * + * + * @param myExamplePostRequest (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void myExamplePost(@javax.annotation.Nullable MyExamplePostRequest myExamplePostRequest) throws ApiException { + myExamplePostWithHttpInfo(myExamplePostRequest); + } + + /** + * + * + * @param myExamplePostRequest (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse myExamplePostWithHttpInfo(@javax.annotation.Nullable MyExamplePostRequest myExamplePostRequest) throws ApiException { + okhttp3.Call localVarCall = myExamplePostValidateBeforeCall(myExamplePostRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param myExamplePostRequest (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call myExamplePostAsync(@javax.annotation.Nullable MyExamplePostRequest myExamplePostRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = myExamplePostValidateBeforeCall(myExamplePostRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..80ce7f2d60fa --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..30e0b4696c2e --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..0c2622e74956 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..ccd81d89cc1f --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,62 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..9abe3834dd71 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,142 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java new file mode 100644 index 000000000000..70bc1ad51ca8 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java @@ -0,0 +1,212 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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 com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class MyExamplePostRequest extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(MyExamplePostRequest.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MyExamplePostRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for MyExamplePostRequest: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MyExamplePostRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MyExamplePostRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MyExamplePostRequest value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: String"); + } + + @Override + public MyExamplePostRequest read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterString; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + if (match == 1) { + MyExamplePostRequest ret = new MyExamplePostRequest(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for MyExamplePostRequest: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public MyExamplePostRequest() { + super("oneOf", Boolean.FALSE); + } + + public MyExamplePostRequest(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return MyExamplePostRequest.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be String"); + } + + /** + * Get the actual instance, which can be the following: + * String + * + * @return The actual instance (String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/others/java/okhttp-oneOf/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/others/java/okhttp-oneOf/src/test/java/org/openapitools/client/api/DefaultApiTest.java new file mode 100644 index 000000000000..5b11dea07b55 --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -0,0 +1,44 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.MyExamplePostRequest; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for DefaultApi + */ +@Disabled +public class DefaultApiTest { + + private final DefaultApi api = new DefaultApi(); + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void myExamplePostTest() throws ApiException { + MyExamplePostRequest myExamplePostRequest = null; + api.myExamplePost(myExamplePostRequest); + // TODO: test validations + } + +} diff --git a/samples/client/others/java/okhttp-oneOf/src/test/java/org/openapitools/client/model/MyExamplePostRequestTest.java b/samples/client/others/java/okhttp-oneOf/src/test/java/org/openapitools/client/model/MyExamplePostRequestTest.java new file mode 100644 index 000000000000..fe1f03c3e62c --- /dev/null +++ b/samples/client/others/java/okhttp-oneOf/src/test/java/org/openapitools/client/model/MyExamplePostRequestTest.java @@ -0,0 +1,33 @@ +/* + * oneOf two primitives + * oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + * + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MyExamplePostRequest + */ +public class MyExamplePostRequestTest { + private final MyExamplePostRequest model = new MyExamplePostRequest(); + + /** + * Model tests for MyExamplePostRequest + */ + @Test + public void testMyExamplePostRequest() { + // TODO: test MyExamplePostRequest + } + +} diff --git a/samples/client/others/java/okhttp-streaming/.github/workflows/maven.yml b/samples/client/others/java/okhttp-streaming/.github/workflows/maven.yml new file mode 100644 index 000000000000..e43bb4aa0336 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build ping some object + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/others/java/okhttp-streaming/.gitignore b/samples/client/others/java/okhttp-streaming/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/.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/client/others/java/okhttp-streaming/.openapi-generator-ignore b/samples/client/others/java/okhttp-streaming/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/.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/client/others/java/okhttp-streaming/.openapi-generator/FILES b/samples/client/others/java/okhttp-streaming/.openapi-generator/FILES new file mode 100644 index 000000000000..cf544ffa67a5 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/.openapi-generator/FILES @@ -0,0 +1,43 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/PingApi.md +docs/SimpleOneOf.md +docs/SomeObj.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/PingApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/SimpleOneOf.java +src/main/java/org/openapitools/client/model/SomeObj.java +src/test/java/org/openapitools/client/api/PingApiTest.java +src/test/java/org/openapitools/client/model/SimpleOneOfTest.java +src/test/java/org/openapitools/client/model/SomeObjTest.java diff --git a/samples/client/others/java/okhttp-streaming/.openapi-generator/VERSION b/samples/client/others/java/okhttp-streaming/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/others/java/okhttp-streaming/.travis.yml b/samples/client/others/java/okhttp-streaming/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/.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/client/others/java/okhttp-streaming/README.md b/samples/client/others/java/okhttp-streaming/README.md new file mode 100644 index 000000000000..7c095605e022 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/README.md @@ -0,0 +1,145 @@ +# petstore-okhttp + +ping some object +- API version: 1.0 + - Generator version: 7.24.0-SNAPSHOT + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-okhttp + 1.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-okhttp' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp:1.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/petstore-okhttp-1.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PingApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:8082"); + + PingApi apiInstance = new PingApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + SomeObj result = apiInstance.getPing(petId) + .name(name) + .status(status) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PingApi#getPing"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:8082* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PingApi* | [**getPing**](docs/PingApi.md#getPing) | **GET** /ping | +*PingApi* | [**postPing**](docs/PingApi.md#postPing) | **POST** /ping | + + +## Documentation for Models + + - [SimpleOneOf](docs/SimpleOneOf.md) + - [SomeObj](docs/SomeObj.md) + + + +## Documentation for Authorization + +Endpoints do not require authorization. + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/others/java/okhttp-streaming/api/openapi.yaml b/samples/client/others/java/okhttp-streaming/api/openapi.yaml new file mode 100644 index 000000000000..9b0525ecdbc6 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/api/openapi.yaml @@ -0,0 +1,98 @@ +openapi: 3.0.1 +info: + title: ping some object + version: "1.0" +servers: +- url: http://localhost:8082/ +paths: + /ping: + get: + operationId: getPing + parameters: + - description: ID of pet that needs to be updated + explode: true + in: query + name: petId + required: true + schema: + format: int64 + type: integer + style: form + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/getPing_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/SomeObj" + description: OK + tags: + - ping + x-streaming: true + x-group-parameters: true + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + post: + operationId: postPing + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SomeObj" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/SomeObj" + description: OK + tags: + - ping + x-streaming: true + x-content-type: application/json + x-accepts: + - application/json +components: + schemas: + SomeObj: + example: + $_type: SomeObjIdentifier + id: 0 + name: name + active: true + type: type + properties: + $_type: + default: SomeObjIdentifier + enum: + - SomeObjIdentifier + type: string + id: + format: int64 + type: integer + name: + type: string + active: + type: boolean + type: + type: string + type: object + SimpleOneOf: + oneOf: + - type: string + - type: integer + getPing_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + diff --git a/samples/client/others/java/okhttp-streaming/build.gradle b/samples/client/others/java/okhttp-streaming/build.gradle new file mode 100644 index 000000000000..c9d847d4ae03 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/build.gradle @@ -0,0 +1,63 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-okhttp' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/others/java/okhttp-streaming/build.sbt b/samples/client/others/java/okhttp-streaming/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/others/java/okhttp-streaming/docs/PingApi.md b/samples/client/others/java/okhttp-streaming/docs/PingApi.md new file mode 100644 index 000000000000..7c6f79304db7 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/docs/PingApi.md @@ -0,0 +1,137 @@ +# PingApi + +All URIs are relative to *http://localhost:8082* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getPing**](PingApi.md#getPing) | **GET** /ping | | +| [**postPing**](PingApi.md#postPing) | **POST** /ping | | + + + +# **getPing** +> SomeObj getPing(petId).name(name).status(status).execute(); + + + +### 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.PingApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:8082"); + + PingApi apiInstance = new PingApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + SomeObj result = apiInstance.getPing(petId) + .name(name) + .status(status) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PingApi#getPing"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +[**SomeObj**](SomeObj.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +# **postPing** +> SomeObj postPing(someObj) + + + +### 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.PingApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost:8082"); + + PingApi apiInstance = new PingApi(defaultClient); + SomeObj someObj = new SomeObj(); // SomeObj | + try { + SomeObj result = apiInstance.postPing(someObj); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PingApi#postPing"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **someObj** | [**SomeObj**](SomeObj.md)| | [optional] | + +### Return type + +[**SomeObj**](SomeObj.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + diff --git a/samples/client/others/java/okhttp-streaming/docs/SimpleOneOf.md b/samples/client/others/java/okhttp-streaming/docs/SimpleOneOf.md new file mode 100644 index 000000000000..aa7149fde93a --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/docs/SimpleOneOf.md @@ -0,0 +1,16 @@ + + +# SimpleOneOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + +## Implemented Interfaces + +* Serializable + + diff --git a/samples/client/others/java/okhttp-streaming/docs/SomeObj.md b/samples/client/others/java/okhttp-streaming/docs/SomeObj.md new file mode 100644 index 000000000000..70bf3335f7be --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/docs/SomeObj.md @@ -0,0 +1,29 @@ + + +# SomeObj + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**$type** | [**TypeEnum**](#TypeEnum) | | [optional] | +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | +|**active** | **Boolean** | | [optional] | +|**type** | **String** | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| SOMEOBJIDENTIFIER | "SomeObjIdentifier" | + + +## Implemented Interfaces + +* Serializable + + diff --git a/samples/client/others/java/okhttp-streaming/git_push.sh b/samples/client/others/java/okhttp-streaming/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/others/java/okhttp-streaming/gradle.properties b/samples/client/others/java/okhttp-streaming/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/others/java/okhttp-streaming/gradle/wrapper/gradle-wrapper.jar b/samples/client/others/java/okhttp-streaming/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/others/java/okhttp-streaming/gradlew.bat b/samples/client/others/java/okhttp-streaming/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/others/java/okhttp-streaming/pom.xml b/samples/client/others/java/okhttp-streaming/pom.xml new file mode 100644 index 000000000000..c6ee93fcaf66 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/pom.xml @@ -0,0 +1,279 @@ + + 4.0.0 + org.openapitools + petstore-okhttp + jar + petstore-okhttp + 1.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 + http://unlicense.org + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + 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-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.10.1 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/others/java/okhttp-streaming/settings.gradle b/samples/client/others/java/okhttp-streaming/settings.gradle new file mode 100644 index 000000000000..3c778001cf97 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-okhttp" \ No newline at end of file diff --git a/samples/client/others/java/okhttp-streaming/src/main/AndroidManifest.xml b/samples/client/others/java/okhttp-streaming/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..3fd42f329781 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..4df806e3e0b4 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1654 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://localhost:8082"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://localhost:8082", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://localhost:8082) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + *

Execute stream.

+ * + * @param call a {@link okhttp3.Call} object + * @param returnType a {@link java.lang.reflect.Type} object + * @return a {@link java.io.InputStream} object + * @throws org.openapitools.client.ApiException if any. + */ + public InputStream executeStream(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + if (!response.isSuccessful()) { + throw new ApiException(response.code(), response.message(), response.headers().toMultimap(), null); + } + if (response.body() == null) { + return null; + } + return response.body().byteStream(); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiException.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..61272b770b71 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..386fc57c4384 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Configuration.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..620825a03a63 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/JSON.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..c78f0bed6edf --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,441 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.SimpleOneOf.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.SomeObj.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Pair.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..1e7c6513059f --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..a71275081f96 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..66dedb7a60d5 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..574af8480e31 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..cc4ad5662cad --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..d26541fb68f8 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/api/PingApi.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/api/PingApi.java new file mode 100644 index 000000000000..93d8524f7ae3 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/api/PingApi.java @@ -0,0 +1,396 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.SomeObj; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.io.InputStream; + +public class PingApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PingApi() { + this(Configuration.getDefaultApiClient()); + } + + public PingApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call getPingCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/ping"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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); + } + + if (petId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("petId", petId)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPingValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPing(Async)"); + } + + return getPingCall(petId, name, status, _callback); + + } + + + private InputStream getPingWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + okhttp3.Call localVarCall = getPingValidateBeforeCall(petId, name, status, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.executeStream(localVarCall, localVarReturnType); + } + + private okhttp3.Call getPingAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPingValidateBeforeCall(petId, name, status, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIgetPingRequest { + @javax.annotation.Nonnull + private final Long petId; + @javax.annotation.Nullable + private String name; + @javax.annotation.Nullable + private String status; + + private APIgetPingRequest(@javax.annotation.Nonnull Long petId) { + this.petId = petId; + } + + /** + * Set name + * @param name Updated name of the pet (optional) + * @return APIgetPingRequest + */ + public APIgetPingRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Set status + * @param status Updated status of the pet (optional) + * @return APIgetPingRequest + */ + public APIgetPingRequest status(@javax.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Build call for getPing + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getPingCall(petId, name, status, _callback); + } + + /** + * Execute getPing request + * @return SomeObj + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public InputStream execute() throws ApiException { + return getPingWithHttpInfo(petId, name, status); + } + + /** + * Execute getPing request with HTTP info returned + * @return ApiResponse<SomeObj> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public InputStream executeWithHttpInfo() throws ApiException { + return getPingWithHttpInfo(petId, name, status); + } + + /** + * Execute getPing request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getPingAsync(petId, name, status, _callback); + } + } + + /** + * + * + * @param petId ID of pet that needs to be updated (required) + * @return APIgetPingRequest + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public APIgetPingRequest getPing(@javax.annotation.Nonnull Long petId) { + return new APIgetPingRequest(petId); + } + /** + * Build call for postPing + * @param someObj (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call postPingCall(@javax.annotation.Nullable SomeObj someObj, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = someObj; + + // create path and map variables + String localVarPath = "/ping"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postPingValidateBeforeCall(@javax.annotation.Nullable SomeObj someObj, final ApiCallback _callback) throws ApiException { + return postPingCall(someObj, _callback); + + } + + /** + * + * + * @param someObj (optional) + * @return SomeObj + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public InputStream postPing(@javax.annotation.Nullable SomeObj someObj) throws ApiException { + InputStream localVarResp = postPingWithHttpInfo(someObj); + return localVarResp; + } + + /** + * + * + * @param someObj (optional) + * @return ApiResponse<SomeObj> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public InputStream postPingWithHttpInfo(@javax.annotation.Nullable SomeObj someObj) throws ApiException { + okhttp3.Call localVarCall = postPingValidateBeforeCall(someObj, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.executeStream(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param someObj (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call postPingAsync(@javax.annotation.Nullable SomeObj someObj, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postPingValidateBeforeCall(someObj, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..5e9365e8496a --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..293103ff5b18 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..a6721964ac96 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..3b18484db67f --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,62 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..0731563893df --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,142 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java new file mode 100644 index 000000000000..8c99dd367449 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java @@ -0,0 +1,270 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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.io.Serializable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class SimpleOneOf extends AbstractOpenApiSchema implements Serializable { + private static final Logger log = Logger.getLogger(SimpleOneOf.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SimpleOneOf + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + } + + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for SimpleOneOf: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SimpleOneOf.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SimpleOneOf' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final TypeAdapter adapterInteger = gson.getDelegateAdapter(this, TypeToken.get(Integer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SimpleOneOf value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + // check if the actual instance is of the type `Integer` + if (value.getActualInstance() instanceof Integer) { + JsonPrimitive primitive = adapterInteger.toJsonTree((Integer)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Integer, String"); + } + + @Override + public SimpleOneOf read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterString; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterInteger; + match++; + log.log(Level.FINER, "Input data matches schema 'Integer'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + if (match == 1) { + SimpleOneOf ret = new SimpleOneOf(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for SimpleOneOf: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public SimpleOneOf() { + super("oneOf", Boolean.FALSE); + } + + public SimpleOneOf(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public SimpleOneOf(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return SimpleOneOf.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Integer, String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, String"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, String + * + * @return The actual instance (Integer, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SomeObj.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SomeObj.java new file mode 100644 index 000000000000..7bfd57c0c641 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SomeObj.java @@ -0,0 +1,455 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.io.Serializable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SomeObj + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class SomeObj implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * Gets or Sets $type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + SOMEOBJIDENTIFIER("SomeObjIdentifier"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_$_TYPE = "$_type"; + @SerializedName(SERIALIZED_NAME_$_TYPE) + @javax.annotation.Nullable + private TypeEnum $type = TypeEnum.SOMEOBJIDENTIFIER; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ACTIVE = "active"; + @SerializedName(SERIALIZED_NAME_ACTIVE) + @javax.annotation.Nullable + private Boolean active; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public SomeObj() { + } + + public SomeObj $type(@javax.annotation.Nullable TypeEnum $type) { + this.$type = $type; + return this; + } + + /** + * Get $type + * @return $type + */ + @javax.annotation.Nullable + + public TypeEnum get$Type() { + return $type; + } + + public void set$Type(@javax.annotation.Nullable TypeEnum $type) { + this.$type = $type; + } + + + public SomeObj id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public SomeObj name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public SomeObj active(@javax.annotation.Nullable Boolean active) { + this.active = active; + return this; + } + + /** + * Get active + * @return active + */ + @javax.annotation.Nullable + + public Boolean getActive() { + return active; + } + + public void setActive(@javax.annotation.Nullable Boolean active) { + this.active = active; + } + + + public SomeObj type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SomeObj instance itself + */ + public SomeObj putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SomeObj someObj = (SomeObj) o; + return Objects.equals(this.$type, someObj.$type) && + Objects.equals(this.id, someObj.id) && + Objects.equals(this.name, someObj.name) && + Objects.equals(this.active, someObj.active) && + Objects.equals(this.type, someObj.type)&& + Objects.equals(this.additionalProperties, someObj.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash($type, id, name, active, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SomeObj {\n"); + sb.append(" $type: ").append(toIndentedString($type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" active: ").append(toIndentedString(active)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("$_type", "id", "name", "active", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SomeObj + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SomeObj.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SomeObj is not found in the empty JSON string", SomeObj.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("$_type") != null && !jsonObj.get("$_type").isJsonNull()) && !jsonObj.get("$_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `$_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("$_type").toString())); + } + // validate the optional field `$_type` + if (jsonObj.get("$_type") != null && !jsonObj.get("$_type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("$_type")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SomeObj.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SomeObj' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SomeObj.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SomeObj value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SomeObj read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SomeObj instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SomeObj given an JSON string + * + * @param jsonString JSON string + * @return An instance of SomeObj + * @throws IOException if the JSON string is invalid with respect to SomeObj + */ + public static SomeObj fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SomeObj.class); + } + + /** + * Convert an instance of SomeObj to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/others/java/okhttp-streaming/src/test/java/org/openapitools/client/api/PingApiTest.java b/samples/client/others/java/okhttp-streaming/src/test/java/org/openapitools/client/api/PingApiTest.java new file mode 100644 index 000000000000..7a1a957481fb --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/test/java/org/openapitools/client/api/PingApiTest.java @@ -0,0 +1,60 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.SomeObj; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.io.InputStream; + +/** + * API tests for PingApi + */ +@Disabled +public class PingApiTest { + + private final PingApi api = new PingApi(); + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void getPingTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + InputStream response = api.getPing(petId) + .name(name) + .status(status) + .execute(); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void postPingTest() throws ApiException { + SomeObj someObj = null; + InputStream response = api.postPing(someObj); + // TODO: test validations + } + +} diff --git a/samples/client/others/java/okhttp-streaming/src/test/java/org/openapitools/client/model/SimpleOneOfTest.java b/samples/client/others/java/okhttp-streaming/src/test/java/org/openapitools/client/model/SimpleOneOfTest.java new file mode 100644 index 000000000000..b1d2d8042a4f --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/test/java/org/openapitools/client/model/SimpleOneOfTest.java @@ -0,0 +1,33 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SimpleOneOf + */ +public class SimpleOneOfTest { + private final SimpleOneOf model = new SimpleOneOf(); + + /** + * Model tests for SimpleOneOf + */ + @Test + public void testSimpleOneOf() { + // TODO: test SimpleOneOf + } + +} diff --git a/samples/client/others/java/okhttp-streaming/src/test/java/org/openapitools/client/model/SomeObjTest.java b/samples/client/others/java/okhttp-streaming/src/test/java/org/openapitools/client/model/SomeObjTest.java new file mode 100644 index 000000000000..3eaa0b4ada41 --- /dev/null +++ b/samples/client/others/java/okhttp-streaming/src/test/java/org/openapitools/client/model/SomeObjTest.java @@ -0,0 +1,79 @@ +/* + * ping some object + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SomeObj + */ +public class SomeObjTest { + private final SomeObj model = new SomeObj(); + + /** + * Model tests for SomeObj + */ + @Test + public void testSomeObj() { + // TODO: test SomeObj + } + + /** + * Test the property '$type' + */ + @Test + public void $typeTest() { + // TODO: test $type + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'active' + */ + @Test + public void activeTest() { + // TODO: test active + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.gitignore b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.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/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator-ignore b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.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/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/FILES new file mode 100644 index 000000000000..40f8656e27ea --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/FILES @@ -0,0 +1,42 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/FakeApi.md +docs/PetApi.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/FakeApi.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.travis.yml b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.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/client/petstore/java/okhttp-3.1-duplicated-operationid/README.md b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/README.md new file mode 100644 index 000000000000..798d4c01fde7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/README.md @@ -0,0 +1,154 @@ +# petstore-okhttp-31-do + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-okhttp-31-do + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-okhttp-31-do' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp-31-do' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp-31-do:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/petstore-okhttp-31-do-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + Object result = apiInstance.getPetById0(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getPetById0"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*FakeApi* | [**getPetById0**](docs/FakeApi.md#getPetById0) | **GET** /fake/duplicated/operationId | +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID + + +## Documentation for Models + + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/api/openapi.yaml b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/api/openapi.yaml new file mode 100644 index 000000000000..d0c825c5621a --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/api/openapi.yaml @@ -0,0 +1,92 @@ +openapi: 3.1.0 +info: + description: "This is a sample server Petstore server. For this sample, you can\ + \ use the api key `special-key` to test the authorization filters." + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet/{petId}: + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/myObject" + application/json: + schema: + $ref: "#/components/schemas/myObject" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + /fake/duplicated/operationId: + get: + operationId: getPetById_0 + responses: + "200": + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/myObject" + nullable: true + description: "" + tags: + - fake + x-accepts: + - application/json +components: + schemas: + myObject: + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/build.gradle b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/build.gradle new file mode 100644 index 000000000000..3c48e9a13b6e --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/build.gradle @@ -0,0 +1,64 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-okhttp-31-do' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/build.sbt b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/docs/FakeApi.md b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/docs/FakeApi.md new file mode 100644 index 000000000000..95148e6c7690 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/docs/FakeApi.md @@ -0,0 +1,65 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getPetById0**](FakeApi.md#getPetById0) | **GET** /fake/duplicated/operationId | | + + + +# **getPetById0** +> Object getPetById0() + + + +### 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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + Object result = apiInstance.getPetById0(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getPetById0"); + 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 + +**Object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | | - | + diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/docs/PetApi.md b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/docs/PetApi.md new file mode 100644 index 000000000000..4c465bc4413c --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/docs/PetApi.md @@ -0,0 +1,80 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | + + + +# **getPetById** +> Object getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Object result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +**Object** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/git_push.sh b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp-3.1-duplicated-operationid/gradle.properties b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/gradlew.bat b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/pom.xml b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/pom.xml new file mode 100644 index 000000000000..df79dd76bdae --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/pom.xml @@ -0,0 +1,284 @@ + + 4.0.0 + org.openapitools + petstore-okhttp-31-do + jar + petstore-okhttp-31-do + 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-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.10.1 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/settings.gradle b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/settings.gradle new file mode 100644 index 000000000000..c9319917eca5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-okhttp-31-do" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..e818a511443e --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..deb938b73b46 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1727 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://petstore.swagger.io/v2"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = ""; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io/v2) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..bbe1b2c8ee33 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..189537deb549 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..ba56d6cab13d --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..2adf8f8d7fae --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,439 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..8b84ab37c82a --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..673ffc4cbb7b --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..10eeda6a297e --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..ae47d8bdb452 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..1b09cdb8d75c --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..a4859da9a700 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 000000000000..c6d43e21f680 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,194 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getPetById0 + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public okhttp3.Call getPetById0Call(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/duplicated/operationId"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetById0ValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getPetById0Call(_callback); + + } + + /** + * + * + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public Object getPetById0() throws ApiException { + ApiResponse localVarResp = getPetById0WithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public ApiResponse getPetById0WithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getPetById0ValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public okhttp3.Call getPetById0Async(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetById0ValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..48381229dd43 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,213 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PetApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getPetById + * @param petId ID of pet to return (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + return getPetByIdCall(petId, _callback); + + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Object getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + ApiResponse localVarResp = getPetByIdWithHttpInfo(petId); + return localVarResp.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find pet by ID (asynchronously) + * Returns a single pet + * @param petId ID of pet to return (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdAsync(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..334ae1f6fd40 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..07839e9966cf --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..85d6556f1f68 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..f728b306c358 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..0b5e71fe6212 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,43 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..0de7ae9fc491 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..57db3963e4f6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..75a1d304801f --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..bdd0ae91976f --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,142 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 000000000000..d5a95d6a6f26 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,42 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +@Disabled +public class FakeApiTest { + + private final FakeApi api = new FakeApi(); + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void getPetById0Test() throws ApiException { + Object response = api.getPetById0(); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..c8afa2ba5317 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Object response = api.getPetById(petId); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp-3.1/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp-3.1/.gitignore b/samples/client/petstore/java/okhttp-3.1/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/.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/client/petstore/java/okhttp-3.1/.openapi-generator-ignore b/samples/client/petstore/java/okhttp-3.1/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/.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/client/petstore/java/okhttp-3.1/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-3.1/.openapi-generator/FILES new file mode 100644 index 000000000000..d3b41a232a08 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/.openapi-generator/FILES @@ -0,0 +1,127 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/AllOfSimpleModel.md +docs/Animal.md +docs/AnyTypeTest.md +docs/ArrayOfSameRef.md +docs/Cat.md +docs/Category.md +docs/CircularReference1.md +docs/CircularReference2.md +docs/CircularReference3.md +docs/CodesEnum.md +docs/DefaultApi.md +docs/Dog.md +docs/FakeApi.md +docs/FakeWebhooksSourcesDeletedPostRequest.md +docs/FakeWebhooksSourcesDeletedPostRequestEvent.md +docs/ModelApiResponse.md +docs/OneOfStringOrInt.md +docs/Order.md +docs/Pet.md +docs/PetApi.md +docs/PetWithTypesObjectNullAndRef.md +docs/RefRefToPathLevelParameterOneofRefToOneofParameter.md +docs/RefToRefParameterAnyofRefToAnyofParameter.md +docs/SelfReferenceAdditionalProperties.md +docs/SelfReferenceAnyOf.md +docs/SelfReferenceOneOf.md +docs/SimpleModelWithArrayProperty.md +docs/StoreApi.md +docs/StringOrInt.md +docs/Tag.md +docs/User.md +docs/UserApi.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/DefaultApi.java +src/main/java/org/openapitools/client/api/FakeApi.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/AllOfSimpleModel.java +src/main/java/org/openapitools/client/model/Animal.java +src/main/java/org/openapitools/client/model/AnyTypeTest.java +src/main/java/org/openapitools/client/model/ArrayOfSameRef.java +src/main/java/org/openapitools/client/model/Cat.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/CircularReference1.java +src/main/java/org/openapitools/client/model/CircularReference2.java +src/main/java/org/openapitools/client/model/CircularReference3.java +src/main/java/org/openapitools/client/model/CodesEnum.java +src/main/java/org/openapitools/client/model/Dog.java +src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequest.java +src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEvent.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/OneOfStringOrInt.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/PetWithTypesObjectNullAndRef.java +src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java +src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java +src/main/java/org/openapitools/client/model/SelfReferenceAdditionalProperties.java +src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java +src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java +src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java +src/main/java/org/openapitools/client/model/StringOrInt.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/User.java +src/test/java/org/openapitools/client/api/DefaultApiTest.java +src/test/java/org/openapitools/client/api/FakeApiTest.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/model/CircularReference2Test.java +src/test/java/org/openapitools/client/model/CircularReference3Test.java +src/test/java/org/openapitools/client/model/CodesEnumTest.java +src/test/java/org/openapitools/client/model/DogTest.java +src/test/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEventTest.java +src/test/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/OneOfStringOrIntTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/PetWithTypesObjectNullAndRefTest.java +src/test/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameterTest.java +src/test/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameterTest.java +src/test/java/org/openapitools/client/model/SelfReferenceAdditionalPropertiesTest.java +src/test/java/org/openapitools/client/model/SelfReferenceAnyOfTest.java +src/test/java/org/openapitools/client/model/SelfReferenceOneOfTest.java +src/test/java/org/openapitools/client/model/SimpleModelWithArrayPropertyTest.java +src/test/java/org/openapitools/client/model/StringOrIntTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/okhttp-3.1/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-3.1/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-3.1/.travis.yml b/samples/client/petstore/java/okhttp-3.1/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/.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/client/petstore/java/okhttp-3.1/README.md b/samples/client/petstore/java/okhttp-3.1/README.md new file mode 100644 index 000000000000..1adc63426c9d --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/README.md @@ -0,0 +1,211 @@ +# petstore-okhttp-31 + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-okhttp-31 + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-okhttp-31' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp-31' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp-31:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/petstore-okhttp-31-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + Object result = apiInstance.fakeInlineSchemaAnyofPath1Get(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeInlineSchemaAnyofPath1Get"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*FakeApi* | [**fakeInlineSchemaAnyofPath1Get**](docs/FakeApi.md#fakeInlineSchemaAnyofPath1Get) | **GET** /fake/inline/schema/anyof/path1 | +*FakeApi* | [**fakeInlineSchemaAnyofPath2Get**](docs/FakeApi.md#fakeInlineSchemaAnyofPath2Get) | **GET** /fake/inline/schema/anyof/path2 | +*FakeApi* | [**fakeInlineSchemaAnyofPath3Get**](docs/FakeApi.md#fakeInlineSchemaAnyofPath3Get) | **GET** /fake/inline/schema/anyof/path3 | +*FakeApi* | [**op1**](docs/FakeApi.md#op1) | **POST** /fake/api/changeowner | op1 +*FakeApi* | [**op2**](docs/FakeApi.md#op2) | **POST** /fake/api/changename | op2 +*FakeApi* | [**op3**](docs/FakeApi.md#op3) | **POST** /fake/api/query/enum | op3 +*FakeApi* | [**refToRefParameter**](docs/FakeApi.md#refToRefParameter) | **GET** /ref/ref_to_parameter | +*FakeApi* | [**refToRefParameterAnyof**](docs/FakeApi.md#refToRefParameterAnyof) | **GET** /ref/ref_to_operation_level_parameter_oneof | +*FakeApi* | [**refToRefParameterOneof**](docs/FakeApi.md#refToRefParameterOneof) | **GET** /ref/ref_to_path_level_parameter_oneof | +*FakeApi* | [**responseNoRef**](docs/FakeApi.md#responseNoRef) | **GET** /no_ref | +*FakeApi* | [**responseRefToNoRef**](docs/FakeApi.md#responseRefToNoRef) | **GET** /ref/no_ref | +*FakeApi* | [**responseRefToRef**](docs/FakeApi.md#responseRefToRef) | **GET** /ref/ref | +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [AllOfSimpleModel](docs/AllOfSimpleModel.md) + - [Animal](docs/Animal.md) + - [AnyTypeTest](docs/AnyTypeTest.md) + - [ArrayOfSameRef](docs/ArrayOfSameRef.md) + - [Cat](docs/Cat.md) + - [Category](docs/Category.md) + - [CircularReference1](docs/CircularReference1.md) + - [CircularReference2](docs/CircularReference2.md) + - [CircularReference3](docs/CircularReference3.md) + - [CodesEnum](docs/CodesEnum.md) + - [Dog](docs/Dog.md) + - [FakeWebhooksSourcesDeletedPostRequest](docs/FakeWebhooksSourcesDeletedPostRequest.md) + - [FakeWebhooksSourcesDeletedPostRequestEvent](docs/FakeWebhooksSourcesDeletedPostRequestEvent.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [OneOfStringOrInt](docs/OneOfStringOrInt.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [PetWithTypesObjectNullAndRef](docs/PetWithTypesObjectNullAndRef.md) + - [RefRefToPathLevelParameterOneofRefToOneofParameter](docs/RefRefToPathLevelParameterOneofRefToOneofParameter.md) + - [RefToRefParameterAnyofRefToAnyofParameter](docs/RefToRefParameterAnyofRefToAnyofParameter.md) + - [SelfReferenceAdditionalProperties](docs/SelfReferenceAdditionalProperties.md) + - [SelfReferenceAnyOf](docs/SelfReferenceAnyOf.md) + - [SelfReferenceOneOf](docs/SelfReferenceOneOf.md) + - [SimpleModelWithArrayProperty](docs/SimpleModelWithArrayProperty.md) + - [StringOrInt](docs/StringOrInt.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp-3.1/api/openapi.yaml b/samples/client/petstore/java/okhttp-3.1/api/openapi.yaml new file mode 100644 index 000000000000..3c2a8895c3be --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/api/openapi.yaml @@ -0,0 +1,1269 @@ +openapi: 3.1.0 +info: + description: "This is a sample server Petstore server. For this sample, you can\ + \ use the api key `special-key` to test the authorization filters." + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + put: + description: "" + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + default: null + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + default: null + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + default: null + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + default: null + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + default: null + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + default: null + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: orderId + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /no_ref: + get: + operationId: response_no_ref + responses: + "200": + content: + text/plain: + schema: + type: string + description: required to pass validation + tags: + - fake + x-accepts: + - text/plain + /ref/no_ref: + get: + operationId: response_ref_to_no_ref + responses: + "200": + $ref: "#/components/responses/no_ref" + tags: + - fake + x-accepts: + - text/plain + /ref/ref: + get: + operationId: response_ref_to_ref + responses: + "200": + $ref: "#/components/responses/ref" + tags: + - fake + x-accepts: + - text/plain + /ref/ref_to_parameter: + get: + operationId: ref_to_ref_parameter + parameters: + - $ref: "#/components/parameters/ref_to_uuid" + responses: + "200": + $ref: "#/components/responses/ref" + tags: + - fake + x-accepts: + - text/plain + parameters: + - $ref: "#/components/parameters/ref_to_uuid" + /ref/ref_to_path_level_parameter_oneof: + get: + description: to test $ref to path level parameters + operationId: ref_to_ref_parameter_oneof + parameters: + - $ref: "#/components/parameters/ref_to_oneof" + responses: + "200": + description: Successful Response + tags: + - fake + x-accepts: + - application/json + parameters: + - $ref: "#/components/parameters/ref_to_oneof" + /ref/ref_to_operation_level_parameter_oneof: + get: + description: to test $ref to operation level parameters + operationId: ref_to_ref_parameter_anyof + parameters: + - $ref: "#/components/parameters/ref_to_anyof" + responses: + "200": + description: Successful Response + tags: + - fake + x-accepts: + - application/json + /fake/api/changeowner: + post: + operationId: op1 + parameters: [] + responses: + "201": + content: + application/json: + schema: {} + description: Successful Response + "422": + content: + application/json: + schema: + $ref: "#/components/schemas/HTTPValidationError" + description: Validation Error + summary: op1 + tags: + - fake + x-accepts: + - application/json + /fake/api/changename: + post: + operationId: op2 + parameters: [] + responses: + "201": + content: + application/json: + schema: {} + description: Successful Response + "422": + content: + application/json: + schema: + $ref: "#/components/schemas/HTTPValidationError" + description: Validation Error + summary: op2 + tags: + - fake + x-accepts: + - application/json + /fake/api/query/enum: + post: + operationId: op3 + parameters: + - description: query enum test + explode: true + in: query + name: query_enum + required: true + schema: + items: + $ref: "#/components/schemas/CodesEnum" + type: array + default: null + style: form + responses: + "200": + description: Successful Response + summary: op3 + tags: + - fake + x-accepts: + - application/json + /fake/inline/schema/anyof/path1: + get: + responses: + "200": + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/myObject" + nullable: true + description: "" + tags: + - fake + x-accepts: + - application/json + /fake/inline/schema/anyof/path2: + get: + responses: + "200": + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/myObject" + nullable: true + description: "" + tags: + - fake + x-accepts: + - application/json + /fake/inline/schema/anyof/path3: + get: + responses: + "200": + content: + application/json: + schema: + items: + allOf: + - $ref: "#/components/schemas/myObject" + nullable: true + nullable: true + type: array + default: null + description: "" + tags: + - fake + x-accepts: + - application/json +components: + parameters: + ref_to_uuid: + description: to test ref to parameter (uuid) + explode: false + in: header + name: ref_to_uuid + required: true + schema: + example: 61864654-6e6b-4152-a62f-795fdd606bc2 + format: uuid + type: string + style: simple + ref_to_oneof: + description: to test ref to parameter (oneof) + explode: false + in: header + name: ref_to_oneof + required: true + schema: + $ref: "#/components/schemas/_ref_ref_to_path_level_parameter_oneof_ref_to_oneof_parameter" + style: simple + ref_to_anyof: + description: to test ref to parameter (anyof) + explode: false + in: header + name: ref_to_anyof + required: true + schema: + $ref: "#/components/schemas/ref_to_ref_parameter_anyof_ref_to_anyof_parameter" + style: simple + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/User" + type: array + default: null + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + responses: + no_ref: + content: + text/plain: + schema: + type: string + description: required to pass validation + ref: + content: + text/plain: + schema: + $ref: "#/components/schemas/simple_text" + description: required to pass validation + schemas: + Order: + description: An order for a pets from the pet store + example: + id: 0 + petId: 6 + quantity: 1 + shipDate: 2000-01-23T04:56:07.000+00:00 + status: placed + complete: false + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + xml: + name: Order + Category: + description: A category for a pet + example: + id: 6 + name: name + properties: + id: + format: int64 + type: integer + name: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + title: Pet category + xml: + name: Category + User: + description: A User who is purchasing from the pet store + example: + id: 0 + username: username + firstName: firstName + lastName: lastName + email: email + password: password + phone: phone + userStatus: 6 + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + xml: + name: User + Tag: + description: A tag for a pet + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + xml: + name: Tag + Pet: + description: A pet for sale in the pet store + example: + id: 0 + category: + id: 6 + name: name + name: doggie + photoUrls: + - photoUrls + - photoUrls + tags: + - id: 1 + name: name + - id: 1 + name: name + status: available + properties: + id: + format: int64 + type: integer + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + default: null + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + default: null + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + xml: + name: Pet + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + StringOrInt: + anyOf: + - type: string + - format: int32 + type: integer + description: string or int + OneOfStringOrInt: + description: string or int (onefOf) + oneOf: + - type: string + - type: integer + Dog: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + breed: + type: string + Cat: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + declawed: + type: boolean + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + simple_text: + type: string + any_type_test: + properties: + any_type_property: {} + array_prop: + description: test array in 3.1 spec + items: + type: string + type: array + default: null + ref_array_prefix_items: + description: | + An item that was added to the queue. + items: {} + maxItems: 5 + minItems: 3 + type: array + default: null + HTTPValidationError: + properties: {} + title: HTTPValidationError + type: object + ArrayPrefixItems: + description: | + An item that was added to the queue. + items: {} + maxItems: 5 + minItems: 3 + type: array + default: null + circular_reference_1: + properties: + prop1: + $ref: "#/components/schemas/circular_reference_2" + circular_reference_2: + properties: + prop1: + $ref: "#/components/schemas/circular_reference_3" + circular_reference_3: + properties: + prop1: + $ref: "#/components/schemas/circular_reference_1" + array_of_same_ref: + properties: + arrayFooOne: + items: + $ref: "#/components/schemas/Tag" + type: array + default: null + arrayFooTwo: + items: + $ref: "#/components/schemas/Tag" + type: array + default: null + arrayFooThree: + items: + $ref: "#/components/schemas/Tag" + type: array + default: null + CodesEnum: + enum: + - Code 1 + - Code 2 + - Code 3 + type: string + SimpleModelWithArrayProperty: + properties: + arrayOfStrings: + items: + type: string + type: array + default: null + required: + - arrayOfStrings + AllOfSimpleModel: + allOf: + - $ref: "#/components/schemas/SimpleModelWithArrayProperty" + myObject: + type: object + SelfReference: + items: {} + type: array + default: null + SelfReferenceOneOf: + oneOf: + - type: string + - type: boolean + SelfReferenceAnyOf: + anyOf: + - type: string + - type: boolean + SelfReferenceAdditionalProperties: + additionalProperties: {} + properties: + dummy: + type: string + PetWithTypesObjectNullAndRef: + properties: + first_property: + $ref: "#/components/schemas/Pet" + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + _ref_ref_to_path_level_parameter_oneof_ref_to_oneof_parameter: + oneOf: + - type: string + - type: integer + ref_to_ref_parameter_anyof_ref_to_anyof_parameter: + oneOf: + - type: string + - items: + type: string + type: array + default: null + _fake_webhooks_sources_deleted_post_request_event: + properties: + event_id: + type: string + required: + - event_id + _fake_webhooks_sources_deleted_post_request: + description: inline schema in webhooks + properties: + event_timestamp: + format: date-time + type: string + event_type: + type: string + event: + $ref: "#/components/schemas/_fake_webhooks_sources_deleted_post_request_event" + required: + - event + - event_timestamp + - event_type + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + diff --git a/samples/client/petstore/java/okhttp-3.1/build.gradle b/samples/client/petstore/java/okhttp-3.1/build.gradle new file mode 100644 index 000000000000..4f336109b92d --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/build.gradle @@ -0,0 +1,64 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-okhttp-31' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/build.sbt b/samples/client/petstore/java/okhttp-3.1/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp-3.1/docs/AllOfSimpleModel.md b/samples/client/petstore/java/okhttp-3.1/docs/AllOfSimpleModel.md new file mode 100644 index 000000000000..de96aa498bd8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/AllOfSimpleModel.md @@ -0,0 +1,13 @@ + + +# AllOfSimpleModel + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayOfStrings** | **List<String>** | | | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/Animal.md b/samples/client/petstore/java/okhttp-3.1/docs/Animal.md new file mode 100644 index 000000000000..d9b32f14c88a --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/Animal.md @@ -0,0 +1,14 @@ + + +# Animal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | +|**color** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/AnyTypeTest.md b/samples/client/petstore/java/okhttp-3.1/docs/AnyTypeTest.md new file mode 100644 index 000000000000..a96a098853db --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/AnyTypeTest.md @@ -0,0 +1,15 @@ + + +# AnyTypeTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**anyTypeProperty** | **Object** | | [optional] | +|**arrayProp** | **List<String>** | test array in 3.1 spec | [optional] | +|**refArrayPrefixItems** | **List<Object>** | An item that was added to the queue. | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/ArrayOfSameRef.md b/samples/client/petstore/java/okhttp-3.1/docs/ArrayOfSameRef.md new file mode 100644 index 000000000000..d4be6b198544 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/ArrayOfSameRef.md @@ -0,0 +1,15 @@ + + +# ArrayOfSameRef + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayFooOne** | [**List<Tag>**](Tag.md) | | [optional] | +|**arrayFooTwo** | [**List<Tag>**](Tag.md) | | [optional] | +|**arrayFooThree** | [**List<Tag>**](Tag.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/Cat.md b/samples/client/petstore/java/okhttp-3.1/docs/Cat.md new file mode 100644 index 000000000000..390dd519c8ce --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/Cat.md @@ -0,0 +1,13 @@ + + +# Cat + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**declawed** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/Category.md b/samples/client/petstore/java/okhttp-3.1/docs/Category.md new file mode 100644 index 000000000000..a7fc939d252e --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/Category.md @@ -0,0 +1,15 @@ + + +# Category + +A category for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/CircularReference1.md b/samples/client/petstore/java/okhttp-3.1/docs/CircularReference1.md new file mode 100644 index 000000000000..57d2e5f35dfc --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/CircularReference1.md @@ -0,0 +1,13 @@ + + +# CircularReference1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**prop1** | [**CircularReference2**](CircularReference2.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/CircularReference2.md b/samples/client/petstore/java/okhttp-3.1/docs/CircularReference2.md new file mode 100644 index 000000000000..08b2cb49b296 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/CircularReference2.md @@ -0,0 +1,13 @@ + + +# CircularReference2 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**prop1** | [**CircularReference3**](CircularReference3.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/CircularReference3.md b/samples/client/petstore/java/okhttp-3.1/docs/CircularReference3.md new file mode 100644 index 000000000000..d34ffab11bcd --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/CircularReference3.md @@ -0,0 +1,13 @@ + + +# CircularReference3 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**prop1** | [**CircularReference1**](CircularReference1.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/CodesEnum.md b/samples/client/petstore/java/okhttp-3.1/docs/CodesEnum.md new file mode 100644 index 000000000000..15fb076ca72b --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/CodesEnum.md @@ -0,0 +1,15 @@ + + +# CodesEnum + +## Enum + + +* `CODE_1` (value: `"Code 1"`) + +* `CODE_2` (value: `"Code 2"`) + +* `CODE_3` (value: `"Code 3"`) + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/DefaultApi.md b/samples/client/petstore/java/okhttp-3.1/docs/DefaultApi.md new file mode 100644 index 000000000000..2e5dfcb2de5c --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/DefaultApi.md @@ -0,0 +1,69 @@ +# DefaultApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fakeWebhooksSourcesDeletedPost**](DefaultApi.md#fakeWebhooksSourcesDeletedPost) | **POST** /fake/webhooks/sources/deleted | | + + + +# **fakeWebhooksSourcesDeletedPost** +> fakeWebhooksSourcesDeletedPost(fakeWebhooksSourcesDeletedPostRequest) + + + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + FakeWebhooksSourcesDeletedPostRequest fakeWebhooksSourcesDeletedPostRequest = new FakeWebhooksSourcesDeletedPostRequest(); // FakeWebhooksSourcesDeletedPostRequest | + try { + apiInstance.fakeWebhooksSourcesDeletedPost(fakeWebhooksSourcesDeletedPostRequest); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fakeWebhooksSourcesDeletedPost"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **fakeWebhooksSourcesDeletedPostRequest** | [**FakeWebhooksSourcesDeletedPostRequest**](FakeWebhooksSourcesDeletedPostRequest.md)| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/Dog.md b/samples/client/petstore/java/okhttp-3.1/docs/Dog.md new file mode 100644 index 000000000000..972c981c0d05 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/Dog.md @@ -0,0 +1,13 @@ + + +# Dog + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/FakeApi.md b/samples/client/petstore/java/okhttp-3.1/docs/FakeApi.md new file mode 100644 index 000000000000..684e019ef94d --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/FakeApi.md @@ -0,0 +1,711 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fakeInlineSchemaAnyofPath1Get**](FakeApi.md#fakeInlineSchemaAnyofPath1Get) | **GET** /fake/inline/schema/anyof/path1 | | +| [**fakeInlineSchemaAnyofPath2Get**](FakeApi.md#fakeInlineSchemaAnyofPath2Get) | **GET** /fake/inline/schema/anyof/path2 | | +| [**fakeInlineSchemaAnyofPath3Get**](FakeApi.md#fakeInlineSchemaAnyofPath3Get) | **GET** /fake/inline/schema/anyof/path3 | | +| [**op1**](FakeApi.md#op1) | **POST** /fake/api/changeowner | op1 | +| [**op2**](FakeApi.md#op2) | **POST** /fake/api/changename | op2 | +| [**op3**](FakeApi.md#op3) | **POST** /fake/api/query/enum | op3 | +| [**refToRefParameter**](FakeApi.md#refToRefParameter) | **GET** /ref/ref_to_parameter | | +| [**refToRefParameterAnyof**](FakeApi.md#refToRefParameterAnyof) | **GET** /ref/ref_to_operation_level_parameter_oneof | | +| [**refToRefParameterOneof**](FakeApi.md#refToRefParameterOneof) | **GET** /ref/ref_to_path_level_parameter_oneof | | +| [**responseNoRef**](FakeApi.md#responseNoRef) | **GET** /no_ref | | +| [**responseRefToNoRef**](FakeApi.md#responseRefToNoRef) | **GET** /ref/no_ref | | +| [**responseRefToRef**](FakeApi.md#responseRefToRef) | **GET** /ref/ref | | + + + +# **fakeInlineSchemaAnyofPath1Get** +> Object fakeInlineSchemaAnyofPath1Get() + + + +### 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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + Object result = apiInstance.fakeInlineSchemaAnyofPath1Get(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeInlineSchemaAnyofPath1Get"); + 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 + +**Object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | | - | + + +# **fakeInlineSchemaAnyofPath2Get** +> Object fakeInlineSchemaAnyofPath2Get() + + + +### 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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + Object result = apiInstance.fakeInlineSchemaAnyofPath2Get(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeInlineSchemaAnyofPath2Get"); + 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 + +**Object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | | - | + + +# **fakeInlineSchemaAnyofPath3Get** +> List<Object> fakeInlineSchemaAnyofPath3Get() + + + +### 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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + List result = apiInstance.fakeInlineSchemaAnyofPath3Get(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeInlineSchemaAnyofPath3Get"); + 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<Object>** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | | - | + + +# **op1** +> Object op1() + +op1 + +### 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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + Object result = apiInstance.op1(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#op1"); + 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 + +**Object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Successful Response | - | +| **422** | Validation Error | - | + + +# **op2** +> Object op2() + +op2 + +### 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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + Object result = apiInstance.op2(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#op2"); + 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 + +**Object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Successful Response | - | +| **422** | Validation Error | - | + + +# **op3** +> op3(queryEnum) + +op3 + +### 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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + List queryEnum = Arrays.asList(); // List | query enum test + try { + apiInstance.op3(queryEnum); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#op3"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **queryEnum** | [**List<CodesEnum>**](CodesEnum.md)| query enum test | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful Response | - | + + +# **refToRefParameter** +> String refToRefParameter(refToUuid) + + + +### 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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + UUID refToUuid = UUID.fromString("61864654-6e6b-4152-a62f-795fdd606bc2"); // UUID | to test ref to parameter (uuid) + try { + String result = apiInstance.refToRefParameter(refToUuid); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#refToRefParameter"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **refToUuid** | **UUID**| to test ref to parameter (uuid) | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | required to pass validation | - | + + +# **refToRefParameterAnyof** +> refToRefParameterAnyof(refToAnyof) + + + +to test $ref to operation level parameters + +### 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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + RefToRefParameterAnyofRefToAnyofParameter refToAnyof = new RefToRefParameterAnyofRefToAnyofParameter(); // RefToRefParameterAnyofRefToAnyofParameter | to test ref to parameter (anyof) + try { + apiInstance.refToRefParameterAnyof(refToAnyof); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#refToRefParameterAnyof"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **refToAnyof** | [**RefToRefParameterAnyofRefToAnyofParameter**](.md)| to test ref to parameter (anyof) | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful Response | - | + + +# **refToRefParameterOneof** +> refToRefParameterOneof(refToOneof) + + + +to test $ref to path level parameters + +### 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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + RefRefToPathLevelParameterOneofRefToOneofParameter refToOneof = new RefRefToPathLevelParameterOneofRefToOneofParameter(); // RefRefToPathLevelParameterOneofRefToOneofParameter | to test ref to parameter (oneof) + try { + apiInstance.refToRefParameterOneof(refToOneof); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#refToRefParameterOneof"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **refToOneof** | [**RefRefToPathLevelParameterOneofRefToOneofParameter**](.md)| to test ref to parameter (oneof) | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful Response | - | + + +# **responseNoRef** +> String responseNoRef() + + + +### 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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + String result = apiInstance.responseNoRef(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#responseNoRef"); + 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 + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | required to pass validation | - | + + +# **responseRefToNoRef** +> String responseRefToNoRef() + + + +### 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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + String result = apiInstance.responseRefToNoRef(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#responseRefToNoRef"); + 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 + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | required to pass validation | - | + + +# **responseRefToRef** +> String responseRefToRef() + + + +### 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/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + String result = apiInstance.responseRefToRef(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#responseRefToRef"); + 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 + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | required to pass validation | - | + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/FakeWebhooksSourcesDeletedPostRequest.md b/samples/client/petstore/java/okhttp-3.1/docs/FakeWebhooksSourcesDeletedPostRequest.md new file mode 100644 index 000000000000..0ab71acc4683 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/FakeWebhooksSourcesDeletedPostRequest.md @@ -0,0 +1,16 @@ + + +# FakeWebhooksSourcesDeletedPostRequest + +inline schema in webhooks + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventTimestamp** | **OffsetDateTime** | | | +|**eventType** | **String** | | | +|**event** | [**FakeWebhooksSourcesDeletedPostRequestEvent**](FakeWebhooksSourcesDeletedPostRequestEvent.md) | | | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/FakeWebhooksSourcesDeletedPostRequestEvent.md b/samples/client/petstore/java/okhttp-3.1/docs/FakeWebhooksSourcesDeletedPostRequestEvent.md new file mode 100644 index 000000000000..c1ae950abda2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/FakeWebhooksSourcesDeletedPostRequestEvent.md @@ -0,0 +1,13 @@ + + +# FakeWebhooksSourcesDeletedPostRequestEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventId** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-3.1/docs/ModelApiResponse.md new file mode 100644 index 000000000000..cd7e3c400be6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/ModelApiResponse.md @@ -0,0 +1,16 @@ + + +# ModelApiResponse + +Describes the result of uploading an image resource + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/OneOfStringOrInt.md b/samples/client/petstore/java/okhttp-3.1/docs/OneOfStringOrInt.md new file mode 100644 index 000000000000..f8bd666c0fe0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/OneOfStringOrInt.md @@ -0,0 +1,13 @@ + + +# OneOfStringOrInt + +string or int (onefOf) + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/Order.md b/samples/client/petstore/java/okhttp-3.1/docs/Order.md new file mode 100644 index 000000000000..0c33059b8b6a --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/Order.md @@ -0,0 +1,29 @@ + + +# Order + +An order for a pets from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/Pet.md b/samples/client/petstore/java/okhttp-3.1/docs/Pet.md new file mode 100644 index 000000000000..8bb363301232 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/Pet.md @@ -0,0 +1,29 @@ + + +# Pet + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/PetApi.md b/samples/client/petstore/java/okhttp-3.1/docs/PetApi.md new file mode 100644 index 000000000000..f395ba3f6f16 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/PetApi.md @@ -0,0 +1,570 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | + + + +# **addPet** +> Pet addPet(pet) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +# **updatePet** +> Pet updatePet(pet) + +Update an existing pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.updatePet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/PetWithTypesObjectNullAndRef.md b/samples/client/petstore/java/okhttp-3.1/docs/PetWithTypesObjectNullAndRef.md new file mode 100644 index 000000000000..618d36cc0b19 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/PetWithTypesObjectNullAndRef.md @@ -0,0 +1,13 @@ + + +# PetWithTypesObjectNullAndRef + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**firstProperty** | [**Pet**](Pet.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/RefRefToPathLevelParameterOneofRefToOneofParameter.md b/samples/client/petstore/java/okhttp-3.1/docs/RefRefToPathLevelParameterOneofRefToOneofParameter.md new file mode 100644 index 000000000000..1d06eb272969 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/RefRefToPathLevelParameterOneofRefToOneofParameter.md @@ -0,0 +1,12 @@ + + +# RefRefToPathLevelParameterOneofRefToOneofParameter + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/RefToRefParameterAnyofRefToAnyofParameter.md b/samples/client/petstore/java/okhttp-3.1/docs/RefToRefParameterAnyofRefToAnyofParameter.md new file mode 100644 index 000000000000..c204a306bfaa --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/RefToRefParameterAnyofRefToAnyofParameter.md @@ -0,0 +1,12 @@ + + +# RefToRefParameterAnyofRefToAnyofParameter + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/SelfReferenceAdditionalProperties.md b/samples/client/petstore/java/okhttp-3.1/docs/SelfReferenceAdditionalProperties.md new file mode 100644 index 000000000000..310e589185c1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/SelfReferenceAdditionalProperties.md @@ -0,0 +1,13 @@ + + +# SelfReferenceAdditionalProperties + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dummy** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/SelfReferenceAnyOf.md b/samples/client/petstore/java/okhttp-3.1/docs/SelfReferenceAnyOf.md new file mode 100644 index 000000000000..9a7831510eb9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/SelfReferenceAnyOf.md @@ -0,0 +1,12 @@ + + +# SelfReferenceAnyOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/SelfReferenceOneOf.md b/samples/client/petstore/java/okhttp-3.1/docs/SelfReferenceOneOf.md new file mode 100644 index 000000000000..37de9abb5d4a --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/SelfReferenceOneOf.md @@ -0,0 +1,12 @@ + + +# SelfReferenceOneOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/SimpleModelWithArrayProperty.md b/samples/client/petstore/java/okhttp-3.1/docs/SimpleModelWithArrayProperty.md new file mode 100644 index 000000000000..17737af5ceb2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/SimpleModelWithArrayProperty.md @@ -0,0 +1,13 @@ + + +# SimpleModelWithArrayProperty + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayOfStrings** | **List<String>** | | | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/StoreApi.md b/samples/client/petstore/java/okhttp-3.1/docs/StoreApi.md new file mode 100644 index 000000000000..af54298ffc2e --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/StoreApi.md @@ -0,0 +1,266 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + 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 + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + + + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/StringOrInt.md b/samples/client/petstore/java/okhttp-3.1/docs/StringOrInt.md new file mode 100644 index 000000000000..5a3bda343bb0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/StringOrInt.md @@ -0,0 +1,13 @@ + + +# StringOrInt + +string or int + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/Tag.md b/samples/client/petstore/java/okhttp-3.1/docs/Tag.md new file mode 100644 index 000000000000..abfde4afb501 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/Tag.md @@ -0,0 +1,15 @@ + + +# Tag + +A tag for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/User.md b/samples/client/petstore/java/okhttp-3.1/docs/User.md new file mode 100644 index 000000000000..426845227bd3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/User.md @@ -0,0 +1,21 @@ + + +# User + +A User who is purchasing from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-3.1/docs/UserApi.md b/samples/client/petstore/java/okhttp-3.1/docs/UserApi.md new file mode 100644 index 000000000000..4c338a42137a --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/docs/UserApi.md @@ -0,0 +1,553 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | + + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + 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 + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/okhttp-3.1/git_push.sh b/samples/client/petstore/java/okhttp-3.1/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp-3.1/gradle.properties b/samples/client/petstore/java/okhttp-3.1/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-3.1/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-3.1/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-3.1/gradlew.bat b/samples/client/petstore/java/okhttp-3.1/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp-3.1/pom.xml b/samples/client/petstore/java/okhttp-3.1/pom.xml new file mode 100644 index 000000000000..9184d2ce57ea --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/pom.xml @@ -0,0 +1,284 @@ + + 4.0.0 + org.openapitools + petstore-okhttp-31 + jar + petstore-okhttp-31 + 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-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.10.1 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp-3.1/settings.gradle b/samples/client/petstore/java/okhttp-3.1/settings.gradle new file mode 100644 index 000000000000..601fbf494550 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-okhttp-31" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-3.1/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..e818a511443e --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..deb938b73b46 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1727 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://petstore.swagger.io/v2"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = ""; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io/v2) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..bbe1b2c8ee33 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..189537deb549 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..ba56d6cab13d --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..426e9c77213f --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,493 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Animal.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Cat", org.openapitools.client.model.Cat.class); + classByDiscriminatorValue.put("Dog", org.openapitools.client.model.Dog.class); + classByDiscriminatorValue.put("Animal", org.openapitools.client.model.Animal.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Cat.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Cat", org.openapitools.client.model.Cat.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Dog.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Dog", org.openapitools.client.model.Dog.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfSimpleModel.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AnyTypeTest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayOfSameRef.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Cat.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Category.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.CircularReference1.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.CircularReference2.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.CircularReference3.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Dog.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FakeWebhooksSourcesDeletedPostRequest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FakeWebhooksSourcesDeletedPostRequestEvent.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelApiResponse.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.OneOfStringOrInt.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Order.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Pet.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.PetWithTypesObjectNullAndRef.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.RefRefToPathLevelParameterOneofRefToOneofParameter.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.RefToRefParameterAnyofRefToAnyofParameter.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.SelfReferenceAdditionalProperties.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.SelfReferenceAnyOf.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.SelfReferenceOneOf.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.SimpleModelWithArrayProperty.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.StringOrInt.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Tag.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.User.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..8b84ab37c82a --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..673ffc4cbb7b --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..10eeda6a297e --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..ae47d8bdb452 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..1b09cdb8d75c --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..a4859da9a700 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..a45ee7ec94f7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,197 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.FakeWebhooksSourcesDeletedPostRequest; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DefaultApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for fakeWebhooksSourcesDeletedPost + * @param fakeWebhooksSourcesDeletedPostRequest (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call fakeWebhooksSourcesDeletedPostCall(@javax.annotation.Nullable FakeWebhooksSourcesDeletedPostRequest fakeWebhooksSourcesDeletedPostRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = fakeWebhooksSourcesDeletedPostRequest; + + // create path and map variables + String localVarPath = "/fake/webhooks/sources/deleted"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeWebhooksSourcesDeletedPostValidateBeforeCall(@javax.annotation.Nullable FakeWebhooksSourcesDeletedPostRequest fakeWebhooksSourcesDeletedPostRequest, final ApiCallback _callback) throws ApiException { + return fakeWebhooksSourcesDeletedPostCall(fakeWebhooksSourcesDeletedPostRequest, _callback); + + } + + /** + * + * + * @param fakeWebhooksSourcesDeletedPostRequest (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public void fakeWebhooksSourcesDeletedPost(@javax.annotation.Nullable FakeWebhooksSourcesDeletedPostRequest fakeWebhooksSourcesDeletedPostRequest) throws ApiException { + fakeWebhooksSourcesDeletedPostWithHttpInfo(fakeWebhooksSourcesDeletedPostRequest); + } + + /** + * + * + * @param fakeWebhooksSourcesDeletedPostRequest (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public ApiResponse fakeWebhooksSourcesDeletedPostWithHttpInfo(@javax.annotation.Nullable FakeWebhooksSourcesDeletedPostRequest fakeWebhooksSourcesDeletedPostRequest) throws ApiException { + okhttp3.Call localVarCall = fakeWebhooksSourcesDeletedPostValidateBeforeCall(fakeWebhooksSourcesDeletedPostRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param fakeWebhooksSourcesDeletedPostRequest (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call fakeWebhooksSourcesDeletedPostAsync(@javax.annotation.Nullable FakeWebhooksSourcesDeletedPostRequest fakeWebhooksSourcesDeletedPostRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeWebhooksSourcesDeletedPostValidateBeforeCall(fakeWebhooksSourcesDeletedPostRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 000000000000..0460d7f824a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,1549 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.CodesEnum; +import org.openapitools.client.model.RefRefToPathLevelParameterOneofRefToOneofParameter; +import org.openapitools.client.model.RefToRefParameterAnyofRefToAnyofParameter; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for fakeInlineSchemaAnyofPath1Get + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public okhttp3.Call fakeInlineSchemaAnyofPath1GetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/inline/schema/anyof/path1"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeInlineSchemaAnyofPath1GetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeInlineSchemaAnyofPath1GetCall(_callback); + + } + + /** + * + * + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public Object fakeInlineSchemaAnyofPath1Get() throws ApiException { + ApiResponse localVarResp = fakeInlineSchemaAnyofPath1GetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public ApiResponse fakeInlineSchemaAnyofPath1GetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeInlineSchemaAnyofPath1GetValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public okhttp3.Call fakeInlineSchemaAnyofPath1GetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeInlineSchemaAnyofPath1GetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeInlineSchemaAnyofPath2Get + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public okhttp3.Call fakeInlineSchemaAnyofPath2GetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/inline/schema/anyof/path2"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeInlineSchemaAnyofPath2GetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeInlineSchemaAnyofPath2GetCall(_callback); + + } + + /** + * + * + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public Object fakeInlineSchemaAnyofPath2Get() throws ApiException { + ApiResponse localVarResp = fakeInlineSchemaAnyofPath2GetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public ApiResponse fakeInlineSchemaAnyofPath2GetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeInlineSchemaAnyofPath2GetValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public okhttp3.Call fakeInlineSchemaAnyofPath2GetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeInlineSchemaAnyofPath2GetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeInlineSchemaAnyofPath3Get + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public okhttp3.Call fakeInlineSchemaAnyofPath3GetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/inline/schema/anyof/path3"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeInlineSchemaAnyofPath3GetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeInlineSchemaAnyofPath3GetCall(_callback); + + } + + /** + * + * + * @return List<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public List fakeInlineSchemaAnyofPath3Get() throws ApiException { + ApiResponse> localVarResp = fakeInlineSchemaAnyofPath3GetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * + * @return ApiResponse<List<Object>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public ApiResponse> fakeInlineSchemaAnyofPath3GetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeInlineSchemaAnyofPath3GetValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 -
+ */ + public okhttp3.Call fakeInlineSchemaAnyofPath3GetAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeInlineSchemaAnyofPath3GetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for op1 + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Successful Response -
422 Validation Error -
+ */ + public okhttp3.Call op1Call(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/api/changeowner"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call op1ValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return op1Call(_callback); + + } + + /** + * op1 + * + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Successful Response -
422 Validation Error -
+ */ + public Object op1() throws ApiException { + ApiResponse localVarResp = op1WithHttpInfo(); + return localVarResp.getData(); + } + + /** + * op1 + * + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Successful Response -
422 Validation Error -
+ */ + public ApiResponse op1WithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = op1ValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * op1 (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Successful Response -
422 Validation Error -
+ */ + public okhttp3.Call op1Async(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = op1ValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for op2 + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Successful Response -
422 Validation Error -
+ */ + public okhttp3.Call op2Call(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/api/changename"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call op2ValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return op2Call(_callback); + + } + + /** + * op2 + * + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Successful Response -
422 Validation Error -
+ */ + public Object op2() throws ApiException { + ApiResponse localVarResp = op2WithHttpInfo(); + return localVarResp.getData(); + } + + /** + * op2 + * + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Successful Response -
422 Validation Error -
+ */ + public ApiResponse op2WithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = op2ValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * op2 (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 Successful Response -
422 Validation Error -
+ */ + public okhttp3.Call op2Async(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = op2ValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for op3 + * @param queryEnum query enum test (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call op3Call(@javax.annotation.Nonnull List queryEnum, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/api/query/enum"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (queryEnum != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "query_enum", queryEnum)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call op3ValidateBeforeCall(@javax.annotation.Nonnull List queryEnum, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'queryEnum' is set + if (queryEnum == null) { + throw new ApiException("Missing the required parameter 'queryEnum' when calling op3(Async)"); + } + + return op3Call(queryEnum, _callback); + + } + + /** + * op3 + * + * @param queryEnum query enum test (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
+ */ + public void op3(@javax.annotation.Nonnull List queryEnum) throws ApiException { + op3WithHttpInfo(queryEnum); + } + + /** + * op3 + * + * @param queryEnum query enum test (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse op3WithHttpInfo(@javax.annotation.Nonnull List queryEnum) throws ApiException { + okhttp3.Call localVarCall = op3ValidateBeforeCall(queryEnum, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * op3 (asynchronously) + * + * @param queryEnum query enum test (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call op3Async(@javax.annotation.Nonnull List queryEnum, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = op3ValidateBeforeCall(queryEnum, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for refToRefParameter + * @param refToUuid to test ref to parameter (uuid) (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public okhttp3.Call refToRefParameterCall(@javax.annotation.Nonnull UUID refToUuid, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/ref/ref_to_parameter"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (refToUuid != null) { + localVarHeaderParams.put("ref_to_uuid", localVarApiClient.parameterToString(refToUuid)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call refToRefParameterValidateBeforeCall(@javax.annotation.Nonnull UUID refToUuid, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'refToUuid' is set + if (refToUuid == null) { + throw new ApiException("Missing the required parameter 'refToUuid' when calling refToRefParameter(Async)"); + } + + return refToRefParameterCall(refToUuid, _callback); + + } + + /** + * + * + * @param refToUuid to test ref to parameter (uuid) (required) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public String refToRefParameter(@javax.annotation.Nonnull UUID refToUuid) throws ApiException { + ApiResponse localVarResp = refToRefParameterWithHttpInfo(refToUuid); + return localVarResp.getData(); + } + + /** + * + * + * @param refToUuid to test ref to parameter (uuid) (required) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public ApiResponse refToRefParameterWithHttpInfo(@javax.annotation.Nonnull UUID refToUuid) throws ApiException { + okhttp3.Call localVarCall = refToRefParameterValidateBeforeCall(refToUuid, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param refToUuid to test ref to parameter (uuid) (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public okhttp3.Call refToRefParameterAsync(@javax.annotation.Nonnull UUID refToUuid, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = refToRefParameterValidateBeforeCall(refToUuid, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for refToRefParameterAnyof + * @param refToAnyof to test ref to parameter (anyof) (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call refToRefParameterAnyofCall(@javax.annotation.Nonnull RefToRefParameterAnyofRefToAnyofParameter refToAnyof, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/ref/ref_to_operation_level_parameter_oneof"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (refToAnyof != null) { + localVarHeaderParams.put("ref_to_anyof", localVarApiClient.parameterToString(refToAnyof)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call refToRefParameterAnyofValidateBeforeCall(@javax.annotation.Nonnull RefToRefParameterAnyofRefToAnyofParameter refToAnyof, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'refToAnyof' is set + if (refToAnyof == null) { + throw new ApiException("Missing the required parameter 'refToAnyof' when calling refToRefParameterAnyof(Async)"); + } + + return refToRefParameterAnyofCall(refToAnyof, _callback); + + } + + /** + * + * to test $ref to operation level parameters + * @param refToAnyof to test ref to parameter (anyof) (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
+ */ + public void refToRefParameterAnyof(@javax.annotation.Nonnull RefToRefParameterAnyofRefToAnyofParameter refToAnyof) throws ApiException { + refToRefParameterAnyofWithHttpInfo(refToAnyof); + } + + /** + * + * to test $ref to operation level parameters + * @param refToAnyof to test ref to parameter (anyof) (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse refToRefParameterAnyofWithHttpInfo(@javax.annotation.Nonnull RefToRefParameterAnyofRefToAnyofParameter refToAnyof) throws ApiException { + okhttp3.Call localVarCall = refToRefParameterAnyofValidateBeforeCall(refToAnyof, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * to test $ref to operation level parameters + * @param refToAnyof to test ref to parameter (anyof) (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call refToRefParameterAnyofAsync(@javax.annotation.Nonnull RefToRefParameterAnyofRefToAnyofParameter refToAnyof, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = refToRefParameterAnyofValidateBeforeCall(refToAnyof, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for refToRefParameterOneof + * @param refToOneof to test ref to parameter (oneof) (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call refToRefParameterOneofCall(@javax.annotation.Nonnull RefRefToPathLevelParameterOneofRefToOneofParameter refToOneof, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/ref/ref_to_path_level_parameter_oneof"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (refToOneof != null) { + localVarHeaderParams.put("ref_to_oneof", localVarApiClient.parameterToString(refToOneof)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call refToRefParameterOneofValidateBeforeCall(@javax.annotation.Nonnull RefRefToPathLevelParameterOneofRefToOneofParameter refToOneof, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'refToOneof' is set + if (refToOneof == null) { + throw new ApiException("Missing the required parameter 'refToOneof' when calling refToRefParameterOneof(Async)"); + } + + return refToRefParameterOneofCall(refToOneof, _callback); + + } + + /** + * + * to test $ref to path level parameters + * @param refToOneof to test ref to parameter (oneof) (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
+ */ + public void refToRefParameterOneof(@javax.annotation.Nonnull RefRefToPathLevelParameterOneofRefToOneofParameter refToOneof) throws ApiException { + refToRefParameterOneofWithHttpInfo(refToOneof); + } + + /** + * + * to test $ref to path level parameters + * @param refToOneof to test ref to parameter (oneof) (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
+ */ + public ApiResponse refToRefParameterOneofWithHttpInfo(@javax.annotation.Nonnull RefRefToPathLevelParameterOneofRefToOneofParameter refToOneof) throws ApiException { + okhttp3.Call localVarCall = refToRefParameterOneofValidateBeforeCall(refToOneof, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * to test $ref to path level parameters + * @param refToOneof to test ref to parameter (oneof) (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successful Response -
+ */ + public okhttp3.Call refToRefParameterOneofAsync(@javax.annotation.Nonnull RefRefToPathLevelParameterOneofRefToOneofParameter refToOneof, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = refToRefParameterOneofValidateBeforeCall(refToOneof, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for responseNoRef + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public okhttp3.Call responseNoRefCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/no_ref"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call responseNoRefValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return responseNoRefCall(_callback); + + } + + /** + * + * + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public String responseNoRef() throws ApiException { + ApiResponse localVarResp = responseNoRefWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public ApiResponse responseNoRefWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = responseNoRefValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public okhttp3.Call responseNoRefAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = responseNoRefValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for responseRefToNoRef + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public okhttp3.Call responseRefToNoRefCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/ref/no_ref"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call responseRefToNoRefValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return responseRefToNoRefCall(_callback); + + } + + /** + * + * + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public String responseRefToNoRef() throws ApiException { + ApiResponse localVarResp = responseRefToNoRefWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public ApiResponse responseRefToNoRefWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = responseRefToNoRefValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public okhttp3.Call responseRefToNoRefAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = responseRefToNoRefValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for responseRefToRef + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public okhttp3.Call responseRefToRefCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/ref/ref"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call responseRefToRefValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return responseRefToRefCall(_callback); + + } + + /** + * + * + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public String responseRefToRef() throws ApiException { + ApiResponse localVarResp = responseRefToRefWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public ApiResponse responseRefToRefWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = responseRefToRefValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 required to pass validation -
+ */ + public okhttp3.Call responseRefToRefAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = responseRefToRefValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..d9ea607ffd54 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1201 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PetApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addPet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call addPetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addPetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling addPet(Async)"); + } + + return addPetCall(pet, _callback); + + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public Pet addPet(@javax.annotation.Nonnull Pet pet) throws ApiException { + ApiResponse localVarResp = addPetWithHttpInfo(pet); + return localVarResp.getData(); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Add a new pet to the store (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call addPetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deletePet + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePetValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); + } + + return deletePetCall(petId, apiKey, _callback); + + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deletes a pet (asynchronously) + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for findPetsByStatus + * @param status Status values that need to be considered for filter (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "status", status)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByStatusValidateBeforeCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + + return findPetsByStatusCall(status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + ApiResponse> localVarResp = findPetsByStatusWithHttpInfo(status); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by status (asynchronously) + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusAsync(@javax.annotation.Nonnull List status, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for findPetsByTags + * @param tags Tags to filter by (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByTagsValidateBeforeCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); + } + + return findPetsByTagsCall(tags, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { + ApiResponse> localVarResp = findPetsByTagsWithHttpInfo(tags); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by tags (asynchronously) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsAsync(@javax.annotation.Nonnull List tags, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPetById + * @param petId ID of pet to return (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + return getPetByIdCall(petId, _callback); + + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + ApiResponse localVarResp = getPetByIdWithHttpInfo(petId); + return localVarResp.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find pet by ID (asynchronously) + * Returns a single pet + * @param petId ID of pet to return (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdAsync(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public okhttp3.Call updatePetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling updatePet(Async)"); + } + + return updatePetCall(pet, _callback); + + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public Pet updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException { + ApiResponse localVarResp = updatePetWithHttpInfo(pet); + return localVarResp.getData(); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update an existing pet (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public okhttp3.Call updatePetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePetWithForm + * @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) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetWithFormValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); + } + + return updatePetWithFormCall(petId, name, status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updates a pet in the store with form data (asynchronously) + * + * @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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for uploadFile + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); + } + + return uploadFileCall(petId, additionalMetadata, _file, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = uploadFileWithHttpInfo(petId, additionalMetadata, _file); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (asynchronously) + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..ff1582272715 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,593 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Order; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class StoreApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteOrder + * @param orderId ID of the order that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{orderId}" + .replace("{" + "orderId" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOrderValidateBeforeCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); + } + + return deleteOrderCall(orderId, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete purchase order by ID (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderAsync(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getInventory + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getInventoryCall(_callback); + + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Map getInventory() throws ApiException { + ApiResponse> localVarResp = getInventoryWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Returns pet inventories by status (asynchronously) + * Returns a map of status codes to quantities + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderById + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{orderId}" + .replace("{" + "orderId" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderByIdValidateBeforeCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); + } + + return getOrderByIdCall(orderId, _callback); + + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + ApiResponse localVarResp = getOrderByIdWithHttpInfo(orderId); + return localVarResp.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find purchase order by ID (asynchronously) + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdAsync(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for placeOrder + * @param order order placed for purchasing the pet (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = order; + + // create path and map variables + String localVarPath = "/store/order"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException("Missing the required parameter 'order' when calling placeOrder(Async)"); + } + + return placeOrderCall(order, _callback); + + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { + ApiResponse localVarResp = placeOrderWithHttpInfo(order); + return localVarResp.getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Place an order for a pet (asynchronously) + * + * @param order order placed for purchasing the pet (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderAsync(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..0eb18f7e8ef7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,1105 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UserApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createUser + * @param user Created user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUserValidateBeforeCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUser(Async)"); + } + + return createUserCall(user, _callback); + + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create user (asynchronously) + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserAsync(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithArrayInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithArrayInput(Async)"); + } + + return createUsersWithArrayInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithListInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithList"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithListInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithListInput(Async)"); + } + + return createUsersWithListInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteUser + * @param username The name that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteUserValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); + } + + return deleteUserCall(username, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete user (asynchronously) + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getUserByName + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByNameValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); + } + + return getUserByNameCall(username, _callback); + + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + ApiResponse localVarResp = getUserByNameWithHttpInfo(username); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get user by user name (asynchronously) + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for loginUser + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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 okhttp3.Call loginUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (username != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); + } + + if (password != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("password", password)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call loginUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); + } + + return loginUserCall(username, password, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + ApiResponse localVarResp = loginUserWithHttpInfo(username, password); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Logs user into the system (asynchronously) + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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 okhttp3.Call loginUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for logoutUser + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return logoutUserCall(_callback); + + } + + /** + * Logs out current logged in user session + * + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Logs out current logged in user session (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateUser + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling updateUser(Async)"); + } + + return updateUserCall(username, user, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updated user (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..334ae1f6fd40 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..07839e9966cf --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..85d6556f1f68 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..f728b306c358 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..0b5e71fe6212 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,43 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..0de7ae9fc491 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..57db3963e4f6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..75a1d304801f --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..bdd0ae91976f --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,142 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AllOfSimpleModel.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AllOfSimpleModel.java new file mode 100644 index 000000000000..e5e302aa0671 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AllOfSimpleModel.java @@ -0,0 +1,305 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfSimpleModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfSimpleModel { + public static final String SERIALIZED_NAME_ARRAY_OF_STRINGS = "arrayOfStrings"; + @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRINGS) + @javax.annotation.Nonnull + private List arrayOfStrings = new ArrayList<>(); + + public AllOfSimpleModel() { + } + + public AllOfSimpleModel arrayOfStrings(@javax.annotation.Nonnull List arrayOfStrings) { + this.arrayOfStrings = arrayOfStrings; + return this; + } + + public AllOfSimpleModel addArrayOfStringsItem(String arrayOfStringsItem) { + if (this.arrayOfStrings == null) { + this.arrayOfStrings = new ArrayList<>(); + } + this.arrayOfStrings.add(arrayOfStringsItem); + return this; + } + + /** + * Get arrayOfStrings + * @return arrayOfStrings + */ + @javax.annotation.Nonnull + + public List getArrayOfStrings() { + return arrayOfStrings; + } + + public void setArrayOfStrings(@javax.annotation.Nonnull List arrayOfStrings) { + this.arrayOfStrings = arrayOfStrings; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfSimpleModel instance itself + */ + public AllOfSimpleModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfSimpleModel allOfSimpleModel = (AllOfSimpleModel) o; + return Objects.equals(this.arrayOfStrings, allOfSimpleModel.arrayOfStrings)&& + Objects.equals(this.additionalProperties, allOfSimpleModel.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfStrings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfSimpleModel {\n"); + sb.append(" arrayOfStrings: ").append(toIndentedString(arrayOfStrings)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("arrayOfStrings")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("arrayOfStrings")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllOfSimpleModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllOfSimpleModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AllOfSimpleModel is not found in the empty JSON string", AllOfSimpleModel.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllOfSimpleModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("arrayOfStrings") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("arrayOfStrings").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `arrayOfStrings` to be an array in the JSON string but got `%s`", jsonObj.get("arrayOfStrings").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllOfSimpleModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllOfSimpleModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllOfSimpleModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllOfSimpleModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AllOfSimpleModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AllOfSimpleModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllOfSimpleModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllOfSimpleModel + * @throws IOException if the JSON string is invalid with respect to AllOfSimpleModel + */ + public static AllOfSimpleModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllOfSimpleModel.class); + } + + /** + * Convert an instance of AllOfSimpleModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 000000000000..6d8843ed3434 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Animal.java @@ -0,0 +1,249 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Animal + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Animal { + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @SerializedName(SERIALIZED_NAME_CLASS_NAME) + @javax.annotation.Nonnull + protected String className; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + @javax.annotation.Nullable + private String color = "red"; + + public Animal() { + this.className = this.getClass().getSimpleName(); + } + + public Animal className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + + public String getClassName() { + return className; + } + + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + + public Animal color(@javax.annotation.Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @javax.annotation.Nullable + + public String getColor() { + return color; + } + + public void setColor(@javax.annotation.Nullable String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Animal instance itself + */ + public Animal putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, animal.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(className, color, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Animal + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Animal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Animal is not found in the empty JSON string", Animal.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("className").getAsString(); + switch (discriminatorValue) { + case "Cat": + Cat.validateJsonElement(jsonElement); + break; + case "Dog": + Dog.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The value of the `className` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Animal given an JSON string + * + * @param jsonString JSON string + * @return An instance of Animal + * @throws IOException if the JSON string is invalid with respect to Animal + */ + public static Animal fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Animal.class); + } + + /** + * Convert an instance of Animal to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AnyTypeTest.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AnyTypeTest.java new file mode 100644 index 000000000000..93c3e174e71d --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AnyTypeTest.java @@ -0,0 +1,374 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AnyTypeTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AnyTypeTest { + public static final String SERIALIZED_NAME_ANY_TYPE_PROPERTY = "any_type_property"; + @SerializedName(SERIALIZED_NAME_ANY_TYPE_PROPERTY) + @javax.annotation.Nullable + private Object anyTypeProperty = null; + + public static final String SERIALIZED_NAME_ARRAY_PROP = "array_prop"; + @SerializedName(SERIALIZED_NAME_ARRAY_PROP) + @javax.annotation.Nullable + private List arrayProp = new ArrayList<>(); + + public static final String SERIALIZED_NAME_REF_ARRAY_PREFIX_ITEMS = "ref_array_prefix_items"; + @SerializedName(SERIALIZED_NAME_REF_ARRAY_PREFIX_ITEMS) + @javax.annotation.Nullable + private List refArrayPrefixItems = new ArrayList<>(); + + public AnyTypeTest() { + } + + public AnyTypeTest anyTypeProperty(@javax.annotation.Nullable Object anyTypeProperty) { + this.anyTypeProperty = anyTypeProperty; + return this; + } + + /** + * Get anyTypeProperty + * @return anyTypeProperty + */ + @javax.annotation.Nullable + + public Object getAnyTypeProperty() { + return anyTypeProperty; + } + + public void setAnyTypeProperty(@javax.annotation.Nullable Object anyTypeProperty) { + this.anyTypeProperty = anyTypeProperty; + } + + + public AnyTypeTest arrayProp(@javax.annotation.Nullable List arrayProp) { + this.arrayProp = arrayProp; + return this; + } + + public AnyTypeTest addArrayPropItem(String arrayPropItem) { + if (this.arrayProp == null) { + this.arrayProp = new ArrayList<>(); + } + this.arrayProp.add(arrayPropItem); + return this; + } + + /** + * test array in 3.1 spec + * @return arrayProp + */ + @javax.annotation.Nullable + + public List getArrayProp() { + return arrayProp; + } + + public void setArrayProp(@javax.annotation.Nullable List arrayProp) { + this.arrayProp = arrayProp; + } + + + public AnyTypeTest refArrayPrefixItems(@javax.annotation.Nullable List refArrayPrefixItems) { + this.refArrayPrefixItems = refArrayPrefixItems; + return this; + } + + public AnyTypeTest addRefArrayPrefixItemsItem(Object refArrayPrefixItemsItem) { + if (this.refArrayPrefixItems == null) { + this.refArrayPrefixItems = new ArrayList<>(); + } + this.refArrayPrefixItems.add(refArrayPrefixItemsItem); + return this; + } + + /** + * An item that was added to the queue. + * @return refArrayPrefixItems + */ + @javax.annotation.Nullable + + public List getRefArrayPrefixItems() { + return refArrayPrefixItems; + } + + public void setRefArrayPrefixItems(@javax.annotation.Nullable List refArrayPrefixItems) { + this.refArrayPrefixItems = refArrayPrefixItems; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AnyTypeTest instance itself + */ + public AnyTypeTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnyTypeTest anyTypeTest = (AnyTypeTest) o; + return Objects.equals(this.anyTypeProperty, anyTypeTest.anyTypeProperty) && + Objects.equals(this.arrayProp, anyTypeTest.arrayProp) && + Objects.equals(this.refArrayPrefixItems, anyTypeTest.refArrayPrefixItems)&& + Objects.equals(this.additionalProperties, anyTypeTest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(anyTypeProperty, arrayProp, refArrayPrefixItems, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnyTypeTest {\n"); + sb.append(" anyTypeProperty: ").append(toIndentedString(anyTypeProperty)).append("\n"); + sb.append(" arrayProp: ").append(toIndentedString(arrayProp)).append("\n"); + sb.append(" refArrayPrefixItems: ").append(toIndentedString(refArrayPrefixItems)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("any_type_property", "array_prop", "ref_array_prefix_items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AnyTypeTest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnyTypeTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AnyTypeTest is not found in the empty JSON string", AnyTypeTest.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("array_prop") != null && !jsonObj.get("array_prop").isJsonNull() && !jsonObj.get("array_prop").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_prop` to be an array in the JSON string but got `%s`", jsonObj.get("array_prop").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("ref_array_prefix_items") != null && !jsonObj.get("ref_array_prefix_items").isJsonNull() && !jsonObj.get("ref_array_prefix_items").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `ref_array_prefix_items` to be an array in the JSON string but got `%s`", jsonObj.get("ref_array_prefix_items").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnyTypeTest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnyTypeTest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnyTypeTest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnyTypeTest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AnyTypeTest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AnyTypeTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AnyTypeTest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnyTypeTest + * @throws IOException if the JSON string is invalid with respect to AnyTypeTest + */ + public static AnyTypeTest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnyTypeTest.class); + } + + /** + * Convert an instance of AnyTypeTest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ArrayOfSameRef.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ArrayOfSameRef.java new file mode 100644 index 000000000000..dc3a12928cc2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ArrayOfSameRef.java @@ -0,0 +1,405 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfSameRef + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOfSameRef { + public static final String SERIALIZED_NAME_ARRAY_FOO_ONE = "arrayFooOne"; + @SerializedName(SERIALIZED_NAME_ARRAY_FOO_ONE) + @javax.annotation.Nullable + private List arrayFooOne = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ARRAY_FOO_TWO = "arrayFooTwo"; + @SerializedName(SERIALIZED_NAME_ARRAY_FOO_TWO) + @javax.annotation.Nullable + private List arrayFooTwo = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ARRAY_FOO_THREE = "arrayFooThree"; + @SerializedName(SERIALIZED_NAME_ARRAY_FOO_THREE) + @javax.annotation.Nullable + private List arrayFooThree = new ArrayList<>(); + + public ArrayOfSameRef() { + } + + public ArrayOfSameRef arrayFooOne(@javax.annotation.Nullable List arrayFooOne) { + this.arrayFooOne = arrayFooOne; + return this; + } + + public ArrayOfSameRef addArrayFooOneItem(Tag arrayFooOneItem) { + if (this.arrayFooOne == null) { + this.arrayFooOne = new ArrayList<>(); + } + this.arrayFooOne.add(arrayFooOneItem); + return this; + } + + /** + * Get arrayFooOne + * @return arrayFooOne + */ + @javax.annotation.Nullable + + public List getArrayFooOne() { + return arrayFooOne; + } + + public void setArrayFooOne(@javax.annotation.Nullable List arrayFooOne) { + this.arrayFooOne = arrayFooOne; + } + + + public ArrayOfSameRef arrayFooTwo(@javax.annotation.Nullable List arrayFooTwo) { + this.arrayFooTwo = arrayFooTwo; + return this; + } + + public ArrayOfSameRef addArrayFooTwoItem(Tag arrayFooTwoItem) { + if (this.arrayFooTwo == null) { + this.arrayFooTwo = new ArrayList<>(); + } + this.arrayFooTwo.add(arrayFooTwoItem); + return this; + } + + /** + * Get arrayFooTwo + * @return arrayFooTwo + */ + @javax.annotation.Nullable + + public List getArrayFooTwo() { + return arrayFooTwo; + } + + public void setArrayFooTwo(@javax.annotation.Nullable List arrayFooTwo) { + this.arrayFooTwo = arrayFooTwo; + } + + + public ArrayOfSameRef arrayFooThree(@javax.annotation.Nullable List arrayFooThree) { + this.arrayFooThree = arrayFooThree; + return this; + } + + public ArrayOfSameRef addArrayFooThreeItem(Tag arrayFooThreeItem) { + if (this.arrayFooThree == null) { + this.arrayFooThree = new ArrayList<>(); + } + this.arrayFooThree.add(arrayFooThreeItem); + return this; + } + + /** + * Get arrayFooThree + * @return arrayFooThree + */ + @javax.annotation.Nullable + + public List getArrayFooThree() { + return arrayFooThree; + } + + public void setArrayFooThree(@javax.annotation.Nullable List arrayFooThree) { + this.arrayFooThree = arrayFooThree; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfSameRef instance itself + */ + public ArrayOfSameRef putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfSameRef arrayOfSameRef = (ArrayOfSameRef) o; + return Objects.equals(this.arrayFooOne, arrayOfSameRef.arrayFooOne) && + Objects.equals(this.arrayFooTwo, arrayOfSameRef.arrayFooTwo) && + Objects.equals(this.arrayFooThree, arrayOfSameRef.arrayFooThree)&& + Objects.equals(this.additionalProperties, arrayOfSameRef.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(arrayFooOne, arrayFooTwo, arrayFooThree, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfSameRef {\n"); + sb.append(" arrayFooOne: ").append(toIndentedString(arrayFooOne)).append("\n"); + sb.append(" arrayFooTwo: ").append(toIndentedString(arrayFooTwo)).append("\n"); + sb.append(" arrayFooThree: ").append(toIndentedString(arrayFooThree)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("arrayFooOne", "arrayFooTwo", "arrayFooThree")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayOfSameRef + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayOfSameRef.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayOfSameRef is not found in the empty JSON string", ArrayOfSameRef.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("arrayFooOne") != null && !jsonObj.get("arrayFooOne").isJsonNull()) { + JsonArray jsonArrayarrayFooOne = jsonObj.getAsJsonArray("arrayFooOne"); + if (jsonArrayarrayFooOne != null) { + // ensure the json data is an array + if (!jsonObj.get("arrayFooOne").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `arrayFooOne` to be an array in the JSON string but got `%s`", jsonObj.get("arrayFooOne").toString())); + } + + // validate the optional field `arrayFooOne` (array) + for (int i = 0; i < jsonArrayarrayFooOne.size(); i++) { + Tag.validateJsonElement(jsonArrayarrayFooOne.get(i)); + }; + } + } + if (jsonObj.get("arrayFooTwo") != null && !jsonObj.get("arrayFooTwo").isJsonNull()) { + JsonArray jsonArrayarrayFooTwo = jsonObj.getAsJsonArray("arrayFooTwo"); + if (jsonArrayarrayFooTwo != null) { + // ensure the json data is an array + if (!jsonObj.get("arrayFooTwo").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `arrayFooTwo` to be an array in the JSON string but got `%s`", jsonObj.get("arrayFooTwo").toString())); + } + + // validate the optional field `arrayFooTwo` (array) + for (int i = 0; i < jsonArrayarrayFooTwo.size(); i++) { + Tag.validateJsonElement(jsonArrayarrayFooTwo.get(i)); + }; + } + } + if (jsonObj.get("arrayFooThree") != null && !jsonObj.get("arrayFooThree").isJsonNull()) { + JsonArray jsonArrayarrayFooThree = jsonObj.getAsJsonArray("arrayFooThree"); + if (jsonArrayarrayFooThree != null) { + // ensure the json data is an array + if (!jsonObj.get("arrayFooThree").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `arrayFooThree` to be an array in the JSON string but got `%s`", jsonObj.get("arrayFooThree").toString())); + } + + // validate the optional field `arrayFooThree` (array) + for (int i = 0; i < jsonArrayarrayFooThree.size(); i++) { + Tag.validateJsonElement(jsonArrayarrayFooThree.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayOfSameRef.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayOfSameRef' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayOfSameRef.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayOfSameRef value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ArrayOfSameRef read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayOfSameRef instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayOfSameRef given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayOfSameRef + * @throws IOException if the JSON string is invalid with respect to ArrayOfSameRef + */ + public static ArrayOfSameRef fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayOfSameRef.class); + } + + /** + * Convert an instance of ArrayOfSameRef to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 000000000000..ea2537618d1f --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,291 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Cat + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Cat extends Animal { + public static final String SERIALIZED_NAME_DECLAWED = "declawed"; + @SerializedName(SERIALIZED_NAME_DECLAWED) + @javax.annotation.Nullable + private Boolean declawed; + + public Cat() { + this.className = this.getClass().getSimpleName(); + } + + public Cat declawed(@javax.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + */ + @javax.annotation.Nullable + + public Boolean getDeclawed() { + return declawed; + } + + public void setDeclawed(@javax.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Cat instance itself + */ + public Cat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, cat.additionalProperties) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode(), additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "declawed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Cat + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Cat.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Cat is not found in the empty JSON string", Cat.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Cat.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Cat.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Cat' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Cat.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Cat value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Cat read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Cat instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Cat given an JSON string + * + * @param jsonString JSON string + * @return An instance of Cat + * @throws IOException if the JSON string is invalid with respect to Cat + */ + public static Cat fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Cat.class); + } + + /** + * Convert an instance of Cat to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..1332de3a1697 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,311 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A category for a pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Category { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, category.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Category + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Category.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Category' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Category.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Category value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Category read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Category given an JSON string + * + * @param jsonString JSON string + * @return An instance of Category + * @throws IOException if the JSON string is invalid with respect to Category + */ + public static Category fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Category.class); + } + + /** + * Convert an instance of Category to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference1.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference1.java new file mode 100644 index 000000000000..da15af42d2e1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference1.java @@ -0,0 +1,286 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.CircularReference2; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CircularReference1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class CircularReference1 { + public static final String SERIALIZED_NAME_PROP1 = "prop1"; + @SerializedName(SERIALIZED_NAME_PROP1) + @javax.annotation.Nullable + private CircularReference2 prop1; + + public CircularReference1() { + } + + public CircularReference1 prop1(@javax.annotation.Nullable CircularReference2 prop1) { + this.prop1 = prop1; + return this; + } + + /** + * Get prop1 + * @return prop1 + */ + @javax.annotation.Nullable + + public CircularReference2 getProp1() { + return prop1; + } + + public void setProp1(@javax.annotation.Nullable CircularReference2 prop1) { + this.prop1 = prop1; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CircularReference1 instance itself + */ + public CircularReference1 putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CircularReference1 circularReference1 = (CircularReference1) o; + return Objects.equals(this.prop1, circularReference1.prop1)&& + Objects.equals(this.additionalProperties, circularReference1.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(prop1, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CircularReference1 {\n"); + sb.append(" prop1: ").append(toIndentedString(prop1)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("prop1")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CircularReference1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CircularReference1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in CircularReference1 is not found in the empty JSON string", CircularReference1.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `prop1` + if (jsonObj.get("prop1") != null && !jsonObj.get("prop1").isJsonNull()) { + CircularReference2.validateJsonElement(jsonObj.get("prop1")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CircularReference1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CircularReference1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CircularReference1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CircularReference1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CircularReference1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CircularReference1 instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CircularReference1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of CircularReference1 + * @throws IOException if the JSON string is invalid with respect to CircularReference1 + */ + public static CircularReference1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CircularReference1.class); + } + + /** + * Convert an instance of CircularReference1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference2.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference2.java new file mode 100644 index 000000000000..b3970881184f --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference2.java @@ -0,0 +1,286 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.CircularReference3; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CircularReference2 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class CircularReference2 { + public static final String SERIALIZED_NAME_PROP1 = "prop1"; + @SerializedName(SERIALIZED_NAME_PROP1) + @javax.annotation.Nullable + private CircularReference3 prop1; + + public CircularReference2() { + } + + public CircularReference2 prop1(@javax.annotation.Nullable CircularReference3 prop1) { + this.prop1 = prop1; + return this; + } + + /** + * Get prop1 + * @return prop1 + */ + @javax.annotation.Nullable + + public CircularReference3 getProp1() { + return prop1; + } + + public void setProp1(@javax.annotation.Nullable CircularReference3 prop1) { + this.prop1 = prop1; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CircularReference2 instance itself + */ + public CircularReference2 putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CircularReference2 circularReference2 = (CircularReference2) o; + return Objects.equals(this.prop1, circularReference2.prop1)&& + Objects.equals(this.additionalProperties, circularReference2.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(prop1, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CircularReference2 {\n"); + sb.append(" prop1: ").append(toIndentedString(prop1)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("prop1")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CircularReference2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CircularReference2.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in CircularReference2 is not found in the empty JSON string", CircularReference2.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `prop1` + if (jsonObj.get("prop1") != null && !jsonObj.get("prop1").isJsonNull()) { + CircularReference3.validateJsonElement(jsonObj.get("prop1")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CircularReference2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CircularReference2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CircularReference2.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CircularReference2 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CircularReference2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CircularReference2 instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CircularReference2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of CircularReference2 + * @throws IOException if the JSON string is invalid with respect to CircularReference2 + */ + public static CircularReference2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CircularReference2.class); + } + + /** + * Convert an instance of CircularReference2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference3.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference3.java new file mode 100644 index 000000000000..1a403d0660e1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference3.java @@ -0,0 +1,286 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.CircularReference1; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * CircularReference3 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class CircularReference3 { + public static final String SERIALIZED_NAME_PROP1 = "prop1"; + @SerializedName(SERIALIZED_NAME_PROP1) + @javax.annotation.Nullable + private CircularReference1 prop1; + + public CircularReference3() { + } + + public CircularReference3 prop1(@javax.annotation.Nullable CircularReference1 prop1) { + this.prop1 = prop1; + return this; + } + + /** + * Get prop1 + * @return prop1 + */ + @javax.annotation.Nullable + + public CircularReference1 getProp1() { + return prop1; + } + + public void setProp1(@javax.annotation.Nullable CircularReference1 prop1) { + this.prop1 = prop1; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CircularReference3 instance itself + */ + public CircularReference3 putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CircularReference3 circularReference3 = (CircularReference3) o; + return Objects.equals(this.prop1, circularReference3.prop1)&& + Objects.equals(this.additionalProperties, circularReference3.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(prop1, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CircularReference3 {\n"); + sb.append(" prop1: ").append(toIndentedString(prop1)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("prop1")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CircularReference3 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CircularReference3.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in CircularReference3 is not found in the empty JSON string", CircularReference3.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `prop1` + if (jsonObj.get("prop1") != null && !jsonObj.get("prop1").isJsonNull()) { + CircularReference1.validateJsonElement(jsonObj.get("prop1")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CircularReference3.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CircularReference3' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CircularReference3.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CircularReference3 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CircularReference3 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CircularReference3 instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CircularReference3 given an JSON string + * + * @param jsonString JSON string + * @return An instance of CircularReference3 + * @throws IOException if the JSON string is invalid with respect to CircularReference3 + */ + public static CircularReference3 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CircularReference3.class); + } + + /** + * Convert an instance of CircularReference3 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CodesEnum.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CodesEnum.java new file mode 100644 index 000000000000..84ac24f392db --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CodesEnum.java @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets CodesEnum + */ +@JsonAdapter(CodesEnum.Adapter.class) +public enum CodesEnum { + + CODE_1("Code 1"), + + CODE_2("Code 2"), + + CODE_3("Code 3"); + + private String value; + + CodesEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CodesEnum fromValue(String value) { + for (CodesEnum b : CodesEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CodesEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CodesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CodesEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CodesEnum.fromValue(value); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 000000000000..47eaca692db0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,291 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Dog + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Dog extends Animal { + public static final String SERIALIZED_NAME_BREED = "breed"; + @SerializedName(SERIALIZED_NAME_BREED) + @javax.annotation.Nullable + private String breed; + + public Dog() { + this.className = this.getClass().getSimpleName(); + } + + public Dog breed(@javax.annotation.Nullable String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + */ + @javax.annotation.Nullable + + public String getBreed() { + return breed; + } + + public void setBreed(@javax.annotation.Nullable String breed) { + this.breed = breed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Dog instance itself + */ + public Dog putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, dog.additionalProperties) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode(), additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "breed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Dog + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Dog.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Dog is not found in the empty JSON string", Dog.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Dog.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Dog.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Dog' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Dog.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Dog value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Dog read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Dog instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Dog given an JSON string + * + * @param jsonString JSON string + * @return An instance of Dog + * @throws IOException if the JSON string is invalid with respect to Dog + */ + public static Dog fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Dog.class); + } + + /** + * Convert an instance of Dog to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequest.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequest.java new file mode 100644 index 000000000000..7fcb95cd550e --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequest.java @@ -0,0 +1,349 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.FakeWebhooksSourcesDeletedPostRequestEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * inline schema in webhooks + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FakeWebhooksSourcesDeletedPostRequest { + public static final String SERIALIZED_NAME_EVENT_TIMESTAMP = "event_timestamp"; + @SerializedName(SERIALIZED_NAME_EVENT_TIMESTAMP) + @javax.annotation.Nonnull + private OffsetDateTime eventTimestamp; + + public static final String SERIALIZED_NAME_EVENT_TYPE = "event_type"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + @javax.annotation.Nonnull + private String eventType; + + public static final String SERIALIZED_NAME_EVENT = "event"; + @SerializedName(SERIALIZED_NAME_EVENT) + @javax.annotation.Nonnull + private FakeWebhooksSourcesDeletedPostRequestEvent event; + + public FakeWebhooksSourcesDeletedPostRequest() { + } + + public FakeWebhooksSourcesDeletedPostRequest eventTimestamp(@javax.annotation.Nonnull OffsetDateTime eventTimestamp) { + this.eventTimestamp = eventTimestamp; + return this; + } + + /** + * Get eventTimestamp + * @return eventTimestamp + */ + @javax.annotation.Nonnull + + public OffsetDateTime getEventTimestamp() { + return eventTimestamp; + } + + public void setEventTimestamp(@javax.annotation.Nonnull OffsetDateTime eventTimestamp) { + this.eventTimestamp = eventTimestamp; + } + + + public FakeWebhooksSourcesDeletedPostRequest eventType(@javax.annotation.Nonnull String eventType) { + this.eventType = eventType; + return this; + } + + /** + * Get eventType + * @return eventType + */ + @javax.annotation.Nonnull + + public String getEventType() { + return eventType; + } + + public void setEventType(@javax.annotation.Nonnull String eventType) { + this.eventType = eventType; + } + + + public FakeWebhooksSourcesDeletedPostRequest event(@javax.annotation.Nonnull FakeWebhooksSourcesDeletedPostRequestEvent event) { + this.event = event; + return this; + } + + /** + * Get event + * @return event + */ + @javax.annotation.Nonnull + + public FakeWebhooksSourcesDeletedPostRequestEvent getEvent() { + return event; + } + + public void setEvent(@javax.annotation.Nonnull FakeWebhooksSourcesDeletedPostRequestEvent event) { + this.event = event; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FakeWebhooksSourcesDeletedPostRequest instance itself + */ + public FakeWebhooksSourcesDeletedPostRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeWebhooksSourcesDeletedPostRequest fakeWebhooksSourcesDeletedPostRequest = (FakeWebhooksSourcesDeletedPostRequest) o; + return Objects.equals(this.eventTimestamp, fakeWebhooksSourcesDeletedPostRequest.eventTimestamp) && + Objects.equals(this.eventType, fakeWebhooksSourcesDeletedPostRequest.eventType) && + Objects.equals(this.event, fakeWebhooksSourcesDeletedPostRequest.event)&& + Objects.equals(this.additionalProperties, fakeWebhooksSourcesDeletedPostRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(eventTimestamp, eventType, event, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeWebhooksSourcesDeletedPostRequest {\n"); + sb.append(" eventTimestamp: ").append(toIndentedString(eventTimestamp)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("event_timestamp", "event_type", "event")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("event_timestamp", "event_type", "event")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FakeWebhooksSourcesDeletedPostRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FakeWebhooksSourcesDeletedPostRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FakeWebhooksSourcesDeletedPostRequest is not found in the empty JSON string", FakeWebhooksSourcesDeletedPostRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FakeWebhooksSourcesDeletedPostRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("event_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `event_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("event_type").toString())); + } + // validate the required field `event` + FakeWebhooksSourcesDeletedPostRequestEvent.validateJsonElement(jsonObj.get("event")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FakeWebhooksSourcesDeletedPostRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FakeWebhooksSourcesDeletedPostRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FakeWebhooksSourcesDeletedPostRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FakeWebhooksSourcesDeletedPostRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FakeWebhooksSourcesDeletedPostRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FakeWebhooksSourcesDeletedPostRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FakeWebhooksSourcesDeletedPostRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of FakeWebhooksSourcesDeletedPostRequest + * @throws IOException if the JSON string is invalid with respect to FakeWebhooksSourcesDeletedPostRequest + */ + public static FakeWebhooksSourcesDeletedPostRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FakeWebhooksSourcesDeletedPostRequest.class); + } + + /** + * Convert an instance of FakeWebhooksSourcesDeletedPostRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEvent.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEvent.java new file mode 100644 index 000000000000..55c7e9304cf2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEvent.java @@ -0,0 +1,291 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FakeWebhooksSourcesDeletedPostRequestEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FakeWebhooksSourcesDeletedPostRequestEvent { + public static final String SERIALIZED_NAME_EVENT_ID = "event_id"; + @SerializedName(SERIALIZED_NAME_EVENT_ID) + @javax.annotation.Nonnull + private String eventId; + + public FakeWebhooksSourcesDeletedPostRequestEvent() { + } + + public FakeWebhooksSourcesDeletedPostRequestEvent eventId(@javax.annotation.Nonnull String eventId) { + this.eventId = eventId; + return this; + } + + /** + * Get eventId + * @return eventId + */ + @javax.annotation.Nonnull + + public String getEventId() { + return eventId; + } + + public void setEventId(@javax.annotation.Nonnull String eventId) { + this.eventId = eventId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FakeWebhooksSourcesDeletedPostRequestEvent instance itself + */ + public FakeWebhooksSourcesDeletedPostRequestEvent putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeWebhooksSourcesDeletedPostRequestEvent fakeWebhooksSourcesDeletedPostRequestEvent = (FakeWebhooksSourcesDeletedPostRequestEvent) o; + return Objects.equals(this.eventId, fakeWebhooksSourcesDeletedPostRequestEvent.eventId)&& + Objects.equals(this.additionalProperties, fakeWebhooksSourcesDeletedPostRequestEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(eventId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeWebhooksSourcesDeletedPostRequestEvent {\n"); + sb.append(" eventId: ").append(toIndentedString(eventId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("event_id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("event_id")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FakeWebhooksSourcesDeletedPostRequestEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FakeWebhooksSourcesDeletedPostRequestEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FakeWebhooksSourcesDeletedPostRequestEvent is not found in the empty JSON string", FakeWebhooksSourcesDeletedPostRequestEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FakeWebhooksSourcesDeletedPostRequestEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("event_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `event_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("event_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FakeWebhooksSourcesDeletedPostRequestEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FakeWebhooksSourcesDeletedPostRequestEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FakeWebhooksSourcesDeletedPostRequestEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FakeWebhooksSourcesDeletedPostRequestEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FakeWebhooksSourcesDeletedPostRequestEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FakeWebhooksSourcesDeletedPostRequestEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FakeWebhooksSourcesDeletedPostRequestEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of FakeWebhooksSourcesDeletedPostRequestEvent + * @throws IOException if the JSON string is invalid with respect to FakeWebhooksSourcesDeletedPostRequestEvent + */ + public static FakeWebhooksSourcesDeletedPostRequestEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FakeWebhooksSourcesDeletedPostRequestEvent.class); + } + + /** + * Convert an instance of FakeWebhooksSourcesDeletedPostRequestEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..1bc343bd5338 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,341 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Describes the result of uploading an image resource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelApiResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + + public Integer getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, _apiResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("code", "type", "message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelApiResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelApiResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelApiResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelApiResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelApiResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelApiResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelApiResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelApiResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelApiResponse + * @throws IOException if the JSON string is invalid with respect to ModelApiResponse + */ + public static ModelApiResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelApiResponse.class); + } + + /** + * Convert an instance of ModelApiResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/OneOfStringOrInt.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/OneOfStringOrInt.java new file mode 100644 index 000000000000..058580b8da43 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/OneOfStringOrInt.java @@ -0,0 +1,269 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OneOfStringOrInt extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(OneOfStringOrInt.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OneOfStringOrInt + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + } + + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for OneOfStringOrInt: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OneOfStringOrInt.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OneOfStringOrInt' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final TypeAdapter adapterInteger = gson.getDelegateAdapter(this, TypeToken.get(Integer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OneOfStringOrInt value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + // check if the actual instance is of the type `Integer` + if (value.getActualInstance() instanceof Integer) { + JsonPrimitive primitive = adapterInteger.toJsonTree((Integer)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Integer, String"); + } + + @Override + public OneOfStringOrInt read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterString; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterInteger; + match++; + log.log(Level.FINER, "Input data matches schema 'Integer'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + if (match == 1) { + OneOfStringOrInt ret = new OneOfStringOrInt(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for OneOfStringOrInt: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public OneOfStringOrInt() { + super("oneOf", Boolean.FALSE); + } + + public OneOfStringOrInt(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public OneOfStringOrInt(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return OneOfStringOrInt.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Integer, String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, String"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, String + * + * @return The actual instance (Integer, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..db0571d69be1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,478 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * An order for a pets from the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Order { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_PET_ID = "petId"; + @SerializedName(SERIALIZED_NAME_PET_ID) + @javax.annotation.Nullable + private Long petId; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; + @SerializedName(SERIALIZED_NAME_SHIP_DATE) + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_COMPLETE = "complete"; + @SerializedName(SERIALIZED_NAME_COMPLETE) + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + + public Long getPetId() { + return petId; + } + + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + + public OffsetDateTime getShipDate() { + return shipDate; + } + + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + + public Boolean getComplete() { + return complete; + } + + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, order.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "petId", "quantity", "shipDate", "status", "complete")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Order + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Order.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Order' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Order.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Order value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Order read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Order instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Order given an JSON string + * + * @param jsonString JSON string + * @return An instance of Order + * @throws IOException if the JSON string is invalid with respect to Order + */ + public static Order fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Order.class); + } + + /** + * Convert an instance of Order to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..385b0eb2ad13 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,537 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A pet for sale in the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pet { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @Deprecated + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable 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 + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + @Deprecated + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + @Deprecated + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, pet.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Pet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Pet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Pet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Pet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Pet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Pet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Pet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Pet given an JSON string + * + * @param jsonString JSON string + * @return An instance of Pet + * @throws IOException if the JSON string is invalid with respect to Pet + */ + public static Pet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Pet.class); + } + + /** + * Convert an instance of Pet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/PetWithTypesObjectNullAndRef.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/PetWithTypesObjectNullAndRef.java new file mode 100644 index 000000000000..c0a4c611876f --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/PetWithTypesObjectNullAndRef.java @@ -0,0 +1,286 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Pet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetWithTypesObjectNullAndRef + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class PetWithTypesObjectNullAndRef { + public static final String SERIALIZED_NAME_FIRST_PROPERTY = "first_property"; + @SerializedName(SERIALIZED_NAME_FIRST_PROPERTY) + @javax.annotation.Nullable + private Pet firstProperty; + + public PetWithTypesObjectNullAndRef() { + } + + public PetWithTypesObjectNullAndRef firstProperty(@javax.annotation.Nullable Pet firstProperty) { + this.firstProperty = firstProperty; + return this; + } + + /** + * Get firstProperty + * @return firstProperty + */ + @javax.annotation.Nullable + + public Pet getFirstProperty() { + return firstProperty; + } + + public void setFirstProperty(@javax.annotation.Nullable Pet firstProperty) { + this.firstProperty = firstProperty; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetWithTypesObjectNullAndRef instance itself + */ + public PetWithTypesObjectNullAndRef putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PetWithTypesObjectNullAndRef petWithTypesObjectNullAndRef = (PetWithTypesObjectNullAndRef) o; + return Objects.equals(this.firstProperty, petWithTypesObjectNullAndRef.firstProperty)&& + Objects.equals(this.additionalProperties, petWithTypesObjectNullAndRef.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(firstProperty, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetWithTypesObjectNullAndRef {\n"); + sb.append(" firstProperty: ").append(toIndentedString(firstProperty)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("first_property")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PetWithTypesObjectNullAndRef + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PetWithTypesObjectNullAndRef.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in PetWithTypesObjectNullAndRef is not found in the empty JSON string", PetWithTypesObjectNullAndRef.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `first_property` + if (jsonObj.get("first_property") != null && !jsonObj.get("first_property").isJsonNull()) { + Pet.validateJsonElement(jsonObj.get("first_property")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PetWithTypesObjectNullAndRef.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PetWithTypesObjectNullAndRef' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PetWithTypesObjectNullAndRef.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PetWithTypesObjectNullAndRef value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PetWithTypesObjectNullAndRef read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PetWithTypesObjectNullAndRef instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PetWithTypesObjectNullAndRef given an JSON string + * + * @param jsonString JSON string + * @return An instance of PetWithTypesObjectNullAndRef + * @throws IOException if the JSON string is invalid with respect to PetWithTypesObjectNullAndRef + */ + public static PetWithTypesObjectNullAndRef fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PetWithTypesObjectNullAndRef.class); + } + + /** + * Convert an instance of PetWithTypesObjectNullAndRef to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java new file mode 100644 index 000000000000..143a1f91ea7e --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java @@ -0,0 +1,269 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class RefRefToPathLevelParameterOneofRefToOneofParameter extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(RefRefToPathLevelParameterOneofRefToOneofParameter.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefRefToPathLevelParameterOneofRefToOneofParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + } + + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for RefRefToPathLevelParameterOneofRefToOneofParameter: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefRefToPathLevelParameterOneofRefToOneofParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefRefToPathLevelParameterOneofRefToOneofParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final TypeAdapter adapterInteger = gson.getDelegateAdapter(this, TypeToken.get(Integer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefRefToPathLevelParameterOneofRefToOneofParameter value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + // check if the actual instance is of the type `Integer` + if (value.getActualInstance() instanceof Integer) { + JsonPrimitive primitive = adapterInteger.toJsonTree((Integer)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Integer, String"); + } + + @Override + public RefRefToPathLevelParameterOneofRefToOneofParameter read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterString; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterInteger; + match++; + log.log(Level.FINER, "Input data matches schema 'Integer'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + if (match == 1) { + RefRefToPathLevelParameterOneofRefToOneofParameter ret = new RefRefToPathLevelParameterOneofRefToOneofParameter(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for RefRefToPathLevelParameterOneofRefToOneofParameter: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public RefRefToPathLevelParameterOneofRefToOneofParameter() { + super("oneOf", Boolean.FALSE); + } + + public RefRefToPathLevelParameterOneofRefToOneofParameter(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public RefRefToPathLevelParameterOneofRefToOneofParameter(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return RefRefToPathLevelParameterOneofRefToOneofParameter.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Integer, String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, String"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, String + * + * @return The actual instance (Integer, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java new file mode 100644 index 000000000000..550b8b27b33e --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java @@ -0,0 +1,271 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class RefToRefParameterAnyofRefToAnyofParameter extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(RefToRefParameterAnyofRefToAnyofParameter.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefToRefParameterAnyofRefToAnyofParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + } + + // deserialize List + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for RefToRefParameterAnyofRefToAnyofParameter: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefToRefParameterAnyofRefToAnyofParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefToRefParameterAnyofRefToAnyofParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final Type typeInstanceListString = new TypeToken>(){}.getType(); + final TypeAdapter> adapterListString = (TypeAdapter>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefToRefParameterAnyofRefToAnyofParameter value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + // check if the actual instance is of the type `List` + if (value.getActualInstance() instanceof List) { + JsonPrimitive primitive = adapterListString.toJsonTree((List)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: List, String"); + } + + @Override + public RefToRefParameterAnyofRefToAnyofParameter read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterString; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize List + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterListString; + match++; + log.log(Level.FINER, "Input data matches schema 'List'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + if (match == 1) { + RefToRefParameterAnyofRefToAnyofParameter ret = new RefToRefParameterAnyofRefToAnyofParameter(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for RefToRefParameterAnyofRefToAnyofParameter: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public RefToRefParameterAnyofRefToAnyofParameter() { + super("oneOf", Boolean.FALSE); + } + + public RefToRefParameterAnyofRefToAnyofParameter(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public RefToRefParameterAnyofRefToAnyofParameter(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List", List.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return RefToRefParameterAnyofRefToAnyofParameter.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * List, String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List, String"); + } + + /** + * Get the actual instance, which can be the following: + * List, String + * + * @return The actual instance (List, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAdditionalProperties.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAdditionalProperties.java new file mode 100644 index 000000000000..96087c314ad3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAdditionalProperties.java @@ -0,0 +1,284 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SelfReferenceAdditionalProperties + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class SelfReferenceAdditionalProperties { + public static final String SERIALIZED_NAME_DUMMY = "dummy"; + @SerializedName(SERIALIZED_NAME_DUMMY) + @javax.annotation.Nullable + private String dummy; + + public SelfReferenceAdditionalProperties() { + } + + public SelfReferenceAdditionalProperties dummy(@javax.annotation.Nullable String dummy) { + this.dummy = dummy; + return this; + } + + /** + * Get dummy + * @return dummy + */ + @javax.annotation.Nullable + + public String getDummy() { + return dummy; + } + + public void setDummy(@javax.annotation.Nullable String dummy) { + this.dummy = dummy; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SelfReferenceAdditionalProperties instance itself + */ + public SelfReferenceAdditionalProperties putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SelfReferenceAdditionalProperties selfReferenceAdditionalProperties = (SelfReferenceAdditionalProperties) o; + return Objects.equals(this.dummy, selfReferenceAdditionalProperties.dummy)&& + Objects.equals(this.additionalProperties, selfReferenceAdditionalProperties.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(dummy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SelfReferenceAdditionalProperties {\n"); + sb.append(" dummy: ").append(toIndentedString(dummy)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("dummy")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SelfReferenceAdditionalProperties + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SelfReferenceAdditionalProperties.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SelfReferenceAdditionalProperties is not found in the empty JSON string", SelfReferenceAdditionalProperties.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("dummy") != null && !jsonObj.get("dummy").isJsonNull()) && !jsonObj.get("dummy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `dummy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dummy").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SelfReferenceAdditionalProperties.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SelfReferenceAdditionalProperties' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SelfReferenceAdditionalProperties.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SelfReferenceAdditionalProperties value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SelfReferenceAdditionalProperties read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SelfReferenceAdditionalProperties instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SelfReferenceAdditionalProperties given an JSON string + * + * @param jsonString JSON string + * @return An instance of SelfReferenceAdditionalProperties + * @throws IOException if the JSON string is invalid with respect to SelfReferenceAdditionalProperties + */ + public static SelfReferenceAdditionalProperties fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SelfReferenceAdditionalProperties.class); + } + + /** + * Convert an instance of SelfReferenceAdditionalProperties to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java new file mode 100644 index 000000000000..9ab6f5cc6046 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java @@ -0,0 +1,260 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class SelfReferenceAnyOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SelfReferenceAnyOf.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SelfReferenceAnyOf + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + List errorMessages = new ArrayList<>(); + int matches = 0; + + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + } + + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Boolean failed with `%s`.", e.getMessage())); + } + + + if (matches == 0) { + throw new IOException(String.format("Failed deserialization for SelfReferenceAnyOf: no match found. %s", errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SelfReferenceAnyOf.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SelfReferenceAnyOf' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final TypeAdapter adapterBoolean = gson.getDelegateAdapter(this, TypeToken.get(Boolean.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SelfReferenceAnyOf value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + // check if the actual instance is of the type `Boolean` + if (value.getActualInstance() instanceof Boolean) { + JsonPrimitive primitive = adapterBoolean.toJsonTree((Boolean)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: Boolean, String"); + } + + @Override + public SelfReferenceAnyOf read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + SelfReferenceAnyOf ret = new SelfReferenceAnyOf(); + ret.setActualInstance(adapterString.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize Boolean + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + SelfReferenceAnyOf ret = new SelfReferenceAnyOf(); + ret.setActualInstance(adapterBoolean.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Boolean failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Boolean'", e); + } + + + throw new IOException(String.format("Failed deserialization for SelfReferenceAnyOf: no match found. %s", errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public SelfReferenceAnyOf() { + super("anyOf", Boolean.FALSE); + } + + public SelfReferenceAnyOf(Boolean o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SelfReferenceAnyOf(String o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Boolean", Boolean.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return SelfReferenceAnyOf.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Boolean, String + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Boolean.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Boolean, String"); + } + + /** + * Get the actual instance, which can be the following: + * Boolean, String + * + * @return The actual instance (Boolean, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Boolean` + * @throws ClassCastException if the instance is not `Boolean` + */ + public Boolean getBoolean() throws ClassCastException { + return (Boolean)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java new file mode 100644 index 000000000000..d003cac5b38e --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java @@ -0,0 +1,269 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class SelfReferenceOneOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SelfReferenceOneOf.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SelfReferenceOneOf + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + } + + // deserialize Boolean + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Boolean failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for SelfReferenceOneOf: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SelfReferenceOneOf.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SelfReferenceOneOf' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final TypeAdapter adapterBoolean = gson.getDelegateAdapter(this, TypeToken.get(Boolean.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SelfReferenceOneOf value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + // check if the actual instance is of the type `Boolean` + if (value.getActualInstance() instanceof Boolean) { + JsonPrimitive primitive = adapterBoolean.toJsonTree((Boolean)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Boolean, String"); + } + + @Override + public SelfReferenceOneOf read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterString; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize Boolean + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterBoolean; + match++; + log.log(Level.FINER, "Input data matches schema 'Boolean'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Boolean failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Boolean'", e); + } + + if (match == 1) { + SelfReferenceOneOf ret = new SelfReferenceOneOf(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for SelfReferenceOneOf: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public SelfReferenceOneOf() { + super("oneOf", Boolean.FALSE); + } + + public SelfReferenceOneOf(Boolean o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public SelfReferenceOneOf(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Boolean", Boolean.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return SelfReferenceOneOf.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Boolean, String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Boolean.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Boolean, String"); + } + + /** + * Get the actual instance, which can be the following: + * Boolean, String + * + * @return The actual instance (Boolean, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Boolean` + * @throws ClassCastException if the instance is not `Boolean` + */ + public Boolean getBoolean() throws ClassCastException { + return (Boolean)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java new file mode 100644 index 000000000000..5dce5dc12aca --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java @@ -0,0 +1,305 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SimpleModelWithArrayProperty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class SimpleModelWithArrayProperty { + public static final String SERIALIZED_NAME_ARRAY_OF_STRINGS = "arrayOfStrings"; + @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRINGS) + @javax.annotation.Nonnull + private List arrayOfStrings = new ArrayList<>(); + + public SimpleModelWithArrayProperty() { + } + + public SimpleModelWithArrayProperty arrayOfStrings(@javax.annotation.Nonnull List arrayOfStrings) { + this.arrayOfStrings = arrayOfStrings; + return this; + } + + public SimpleModelWithArrayProperty addArrayOfStringsItem(String arrayOfStringsItem) { + if (this.arrayOfStrings == null) { + this.arrayOfStrings = new ArrayList<>(); + } + this.arrayOfStrings.add(arrayOfStringsItem); + return this; + } + + /** + * Get arrayOfStrings + * @return arrayOfStrings + */ + @javax.annotation.Nonnull + + public List getArrayOfStrings() { + return arrayOfStrings; + } + + public void setArrayOfStrings(@javax.annotation.Nonnull List arrayOfStrings) { + this.arrayOfStrings = arrayOfStrings; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SimpleModelWithArrayProperty instance itself + */ + public SimpleModelWithArrayProperty putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SimpleModelWithArrayProperty simpleModelWithArrayProperty = (SimpleModelWithArrayProperty) o; + return Objects.equals(this.arrayOfStrings, simpleModelWithArrayProperty.arrayOfStrings)&& + Objects.equals(this.additionalProperties, simpleModelWithArrayProperty.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfStrings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SimpleModelWithArrayProperty {\n"); + sb.append(" arrayOfStrings: ").append(toIndentedString(arrayOfStrings)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("arrayOfStrings")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("arrayOfStrings")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SimpleModelWithArrayProperty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SimpleModelWithArrayProperty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SimpleModelWithArrayProperty is not found in the empty JSON string", SimpleModelWithArrayProperty.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SimpleModelWithArrayProperty.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("arrayOfStrings") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("arrayOfStrings").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `arrayOfStrings` to be an array in the JSON string but got `%s`", jsonObj.get("arrayOfStrings").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SimpleModelWithArrayProperty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SimpleModelWithArrayProperty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SimpleModelWithArrayProperty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SimpleModelWithArrayProperty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SimpleModelWithArrayProperty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SimpleModelWithArrayProperty instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SimpleModelWithArrayProperty given an JSON string + * + * @param jsonString JSON string + * @return An instance of SimpleModelWithArrayProperty + * @throws IOException if the JSON string is invalid with respect to SimpleModelWithArrayProperty + */ + public static SimpleModelWithArrayProperty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SimpleModelWithArrayProperty.class); + } + + /** + * Convert an instance of SimpleModelWithArrayProperty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/StringOrInt.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/StringOrInt.java new file mode 100644 index 000000000000..d1509f3de8b9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/StringOrInt.java @@ -0,0 +1,260 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class StringOrInt extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(StringOrInt.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StringOrInt + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + List errorMessages = new ArrayList<>(); + int matches = 0; + + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + } + + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + } + + + if (matches == 0) { + throw new IOException(String.format("Failed deserialization for StringOrInt: no match found. %s", errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StringOrInt.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StringOrInt' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final TypeAdapter adapterInteger = gson.getDelegateAdapter(this, TypeToken.get(Integer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StringOrInt value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + // check if the actual instance is of the type `Integer` + if (value.getActualInstance() instanceof Integer) { + JsonPrimitive primitive = adapterInteger.toJsonTree((Integer)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: Integer, String"); + } + + @Override + public StringOrInt read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + StringOrInt ret = new StringOrInt(); + ret.setActualInstance(adapterString.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + StringOrInt ret = new StringOrInt(); + ret.setActualInstance(adapterInteger.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + + throw new IOException(String.format("Failed deserialization for StringOrInt: no match found. %s", errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public StringOrInt() { + super("anyOf", Boolean.FALSE); + } + + public StringOrInt(Integer o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public StringOrInt(String o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return StringOrInt.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Integer, String + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, String"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, String + * + * @return The actual instance (Integer, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..de14a3aee9b3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,311 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A tag for a pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Tag { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Tag + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Tag.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Tag' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Tag value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Tag read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Tag given an JSON string + * + * @param jsonString JSON string + * @return An instance of Tag + * @throws IOException if the JSON string is invalid with respect to Tag + */ + public static Tag fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Tag.class); + } + + /** + * Convert an instance of Tag to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..01d7a093236a --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,488 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A User who is purchasing from the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class User { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nullable + private String username; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nullable + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nullable + private String lastName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nullable + private String password; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nullable + private String phone; + + public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; + @SerializedName(SERIALIZED_NAME_USER_STATUS) + @javax.annotation.Nullable + private Integer userStatus; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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.additionalProperties, user.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to User + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) && !jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!User.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'User' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(User.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, User value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public User read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of User given an JSON string + * + * @param jsonString JSON string + * @return An instance of User + * @throws IOException if the JSON string is invalid with respect to User + */ + public static User fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, User.class); + } + + /** + * Convert an instance of User to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/DefaultApiTest.java new file mode 100644 index 000000000000..893abb1f7a90 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -0,0 +1,44 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.FakeWebhooksSourcesDeletedPostRequest; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for DefaultApi + */ +@Disabled +public class DefaultApiTest { + + private final DefaultApi api = new DefaultApi(); + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fakeWebhooksSourcesDeletedPostTest() throws ApiException { + FakeWebhooksSourcesDeletedPostRequest fakeWebhooksSourcesDeletedPostRequest = null; + api.fakeWebhooksSourcesDeletedPost(fakeWebhooksSourcesDeletedPostRequest); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 000000000000..aa4b626b191a --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,159 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.CodesEnum; +import org.openapitools.client.model.RefRefToPathLevelParameterOneofRefToOneofParameter; +import org.openapitools.client.model.RefToRefParameterAnyofRefToAnyofParameter; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +@Disabled +public class FakeApiTest { + + private final FakeApi api = new FakeApi(); + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fakeInlineSchemaAnyofPath1GetTest() throws ApiException { + Object response = api.fakeInlineSchemaAnyofPath1Get(); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fakeInlineSchemaAnyofPath2GetTest() throws ApiException { + Object response = api.fakeInlineSchemaAnyofPath2Get(); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fakeInlineSchemaAnyofPath3GetTest() throws ApiException { + List response = api.fakeInlineSchemaAnyofPath3Get(); + // TODO: test validations + } + + /** + * op1 + * + * @throws ApiException if the Api call fails + */ + @Test + public void op1Test() throws ApiException { + Object response = api.op1(); + // TODO: test validations + } + + /** + * op2 + * + * @throws ApiException if the Api call fails + */ + @Test + public void op2Test() throws ApiException { + Object response = api.op2(); + // TODO: test validations + } + + /** + * op3 + * + * @throws ApiException if the Api call fails + */ + @Test + public void op3Test() throws ApiException { + List queryEnum = null; + api.op3(queryEnum); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void refToRefParameterTest() throws ApiException { + UUID refToUuid = null; + String response = api.refToRefParameter(refToUuid); + // TODO: test validations + } + + /** + * to test $ref to operation level parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void refToRefParameterAnyofTest() throws ApiException { + RefToRefParameterAnyofRefToAnyofParameter refToAnyof = null; + api.refToRefParameterAnyof(refToAnyof); + // TODO: test validations + } + + /** + * to test $ref to path level parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void refToRefParameterOneofTest() throws ApiException { + RefRefToPathLevelParameterOneofRefToOneofParameter refToOneof = null; + api.refToRefParameterOneof(refToOneof); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void responseNoRefTest() throws ApiException { + String response = api.responseNoRef(); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void responseRefToNoRefTest() throws ApiException { + String response = api.responseRefToNoRef(); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void responseRefToRefTest() throws ApiException { + String response = api.responseRefToRef(); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..44e74f1cf98b --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,153 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + Pet response = api.addPet(pet); + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + Pet response = api.updatePet(pet); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.uploadFile(petId, additionalMetadata, _file); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..3ca20d0b210b --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,89 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = api.getOrderById(orderId); + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order order = null; + Order response = api.placeOrder(order); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..a46743c4435d --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,148 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User user = null; + api.createUser(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List user = null; + api.createUsersWithArrayInput(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List user = null; + api.createUsersWithListInput(user); + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + api.deleteUser(username); + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + api.logoutUser(); + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User user = null; + api.updateUser(username, user); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/AllOfSimpleModelTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/AllOfSimpleModelTest.java new file mode 100644 index 000000000000..3afe85fb5f69 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/AllOfSimpleModelTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfSimpleModel + */ +public class AllOfSimpleModelTest { + private final AllOfSimpleModel model = new AllOfSimpleModel(); + + /** + * Model tests for AllOfSimpleModel + */ + @Test + public void testAllOfSimpleModel() { + // TODO: test AllOfSimpleModel + } + + /** + * Test the property 'arrayOfStrings' + */ + @Test + public void arrayOfStringsTest() { + // TODO: test arrayOfStrings + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/AnimalTest.java new file mode 100644 index 000000000000..34f083ddf57e --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Animal + */ +public class AnimalTest { + private final Animal model = new Animal(); + + /** + * Model tests for Animal + */ + @Test + public void testAnimal() { + // TODO: test Animal + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/AnyTypeTestTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/AnyTypeTestTest.java new file mode 100644 index 000000000000..4f54c0a31379 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/AnyTypeTestTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AnyTypeTest + */ +public class AnyTypeTestTest { + private final AnyTypeTest model = new AnyTypeTest(); + + /** + * Model tests for AnyTypeTest + */ + @Test + public void testAnyTypeTest() { + // TODO: test AnyTypeTest + } + + /** + * Test the property 'anyTypeProperty' + */ + @Test + public void anyTypePropertyTest() { + // TODO: test anyTypeProperty + } + + /** + * Test the property 'arrayProp' + */ + @Test + public void arrayPropTest() { + // TODO: test arrayProp + } + + /** + * Test the property 'refArrayPrefixItems' + */ + @Test + public void refArrayPrefixItemsTest() { + // TODO: test refArrayPrefixItems + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/ArrayOfSameRefTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/ArrayOfSameRefTest.java new file mode 100644 index 000000000000..0a2e22f4c715 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/ArrayOfSameRefTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfSameRef + */ +public class ArrayOfSameRefTest { + private final ArrayOfSameRef model = new ArrayOfSameRef(); + + /** + * Model tests for ArrayOfSameRef + */ + @Test + public void testArrayOfSameRef() { + // TODO: test ArrayOfSameRef + } + + /** + * Test the property 'arrayFooOne' + */ + @Test + public void arrayFooOneTest() { + // TODO: test arrayFooOne + } + + /** + * Test the property 'arrayFooTwo' + */ + @Test + public void arrayFooTwoTest() { + // TODO: test arrayFooTwo + } + + /** + * Test the property 'arrayFooThree' + */ + @Test + public void arrayFooThreeTest() { + // TODO: test arrayFooThree + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CatTest.java new file mode 100644 index 000000000000..fbaf06084fb5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CatTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Cat + */ +public class CatTest { + private final Cat model = new Cat(); + + /** + * Model tests for Cat + */ + @Test + public void testCat() { + // TODO: test Cat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..5bf64f190609 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CircularReference1Test.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CircularReference1Test.java new file mode 100644 index 000000000000..b0d811b6c19f --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CircularReference1Test.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.CircularReference2; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for CircularReference1 + */ +public class CircularReference1Test { + private final CircularReference1 model = new CircularReference1(); + + /** + * Model tests for CircularReference1 + */ + @Test + public void testCircularReference1() { + // TODO: test CircularReference1 + } + + /** + * Test the property 'prop1' + */ + @Test + public void prop1Test() { + // TODO: test prop1 + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CircularReference2Test.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CircularReference2Test.java new file mode 100644 index 000000000000..618be3f265f4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CircularReference2Test.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.CircularReference3; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for CircularReference2 + */ +public class CircularReference2Test { + private final CircularReference2 model = new CircularReference2(); + + /** + * Model tests for CircularReference2 + */ + @Test + public void testCircularReference2() { + // TODO: test CircularReference2 + } + + /** + * Test the property 'prop1' + */ + @Test + public void prop1Test() { + // TODO: test prop1 + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CircularReference3Test.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CircularReference3Test.java new file mode 100644 index 000000000000..b995fefb220c --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CircularReference3Test.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.CircularReference1; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for CircularReference3 + */ +public class CircularReference3Test { + private final CircularReference3 model = new CircularReference3(); + + /** + * Model tests for CircularReference3 + */ + @Test + public void testCircularReference3() { + // TODO: test CircularReference3 + } + + /** + * Test the property 'prop1' + */ + @Test + public void prop1Test() { + // TODO: test prop1 + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CodesEnumTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CodesEnumTest.java new file mode 100644 index 000000000000..37a98f3899cb --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/CodesEnumTest.java @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for CodesEnum + */ +public class CodesEnumTest { + /** + * Model tests for CodesEnum + */ + @Test + public void testCodesEnum() { + // TODO: test CodesEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/DogTest.java new file mode 100644 index 000000000000..c042d8036e0f --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/DogTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Dog + */ +public class DogTest { + private final Dog model = new Dog(); + + /** + * Model tests for Dog + */ + @Test + public void testDog() { + // TODO: test Dog + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEventTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEventTest.java new file mode 100644 index 000000000000..474658fa1b72 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEventTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeWebhooksSourcesDeletedPostRequestEvent + */ +public class FakeWebhooksSourcesDeletedPostRequestEventTest { + private final FakeWebhooksSourcesDeletedPostRequestEvent model = new FakeWebhooksSourcesDeletedPostRequestEvent(); + + /** + * Model tests for FakeWebhooksSourcesDeletedPostRequestEvent + */ + @Test + public void testFakeWebhooksSourcesDeletedPostRequestEvent() { + // TODO: test FakeWebhooksSourcesDeletedPostRequestEvent + } + + /** + * Test the property 'eventId' + */ + @Test + public void eventIdTest() { + // TODO: test eventId + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestTest.java new file mode 100644 index 000000000000..77443d355afb --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.FakeWebhooksSourcesDeletedPostRequestEvent; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeWebhooksSourcesDeletedPostRequest + */ +public class FakeWebhooksSourcesDeletedPostRequestTest { + private final FakeWebhooksSourcesDeletedPostRequest model = new FakeWebhooksSourcesDeletedPostRequest(); + + /** + * Model tests for FakeWebhooksSourcesDeletedPostRequest + */ + @Test + public void testFakeWebhooksSourcesDeletedPostRequest() { + // TODO: test FakeWebhooksSourcesDeletedPostRequest + } + + /** + * Test the property 'eventTimestamp' + */ + @Test + public void eventTimestampTest() { + // TODO: test eventTimestamp + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'event' + */ + @Test + public void eventTest() { + // TODO: test event + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..91f7c6e7b08b --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/OneOfStringOrIntTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/OneOfStringOrIntTest.java new file mode 100644 index 000000000000..51cb133f44ed --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/OneOfStringOrIntTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OneOfStringOrInt + */ +public class OneOfStringOrIntTest { + private final OneOfStringOrInt model = new OneOfStringOrInt(); + + /** + * Model tests for OneOfStringOrInt + */ + @Test + public void testOneOfStringOrInt() { + // TODO: test OneOfStringOrInt + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..68d51864f2e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..1dbb74a230c4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/PetWithTypesObjectNullAndRefTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/PetWithTypesObjectNullAndRefTest.java new file mode 100644 index 000000000000..f12b1da6b3fa --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/PetWithTypesObjectNullAndRefTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetWithTypesObjectNullAndRef + */ +public class PetWithTypesObjectNullAndRefTest { + private final PetWithTypesObjectNullAndRef model = new PetWithTypesObjectNullAndRef(); + + /** + * Model tests for PetWithTypesObjectNullAndRef + */ + @Test + public void testPetWithTypesObjectNullAndRef() { + // TODO: test PetWithTypesObjectNullAndRef + } + + /** + * Test the property 'firstProperty' + */ + @Test + public void firstPropertyTest() { + // TODO: test firstProperty + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameterTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameterTest.java new file mode 100644 index 000000000000..ea34e98696f4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameterTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for RefRefToPathLevelParameterOneofRefToOneofParameter + */ +public class RefRefToPathLevelParameterOneofRefToOneofParameterTest { + private final RefRefToPathLevelParameterOneofRefToOneofParameter model = new RefRefToPathLevelParameterOneofRefToOneofParameter(); + + /** + * Model tests for RefRefToPathLevelParameterOneofRefToOneofParameter + */ + @Test + public void testRefRefToPathLevelParameterOneofRefToOneofParameter() { + // TODO: test RefRefToPathLevelParameterOneofRefToOneofParameter + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameterTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameterTest.java new file mode 100644 index 000000000000..235977518174 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameterTest.java @@ -0,0 +1,34 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for RefToRefParameterAnyofRefToAnyofParameter + */ +public class RefToRefParameterAnyofRefToAnyofParameterTest { + private final RefToRefParameterAnyofRefToAnyofParameter model = new RefToRefParameterAnyofRefToAnyofParameter(); + + /** + * Model tests for RefToRefParameterAnyofRefToAnyofParameter + */ + @Test + public void testRefToRefParameterAnyofRefToAnyofParameter() { + // TODO: test RefToRefParameterAnyofRefToAnyofParameter + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SelfReferenceAdditionalPropertiesTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SelfReferenceAdditionalPropertiesTest.java new file mode 100644 index 000000000000..2107bd7e4ef1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SelfReferenceAdditionalPropertiesTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SelfReferenceAdditionalProperties + */ +public class SelfReferenceAdditionalPropertiesTest { + private final SelfReferenceAdditionalProperties model = new SelfReferenceAdditionalProperties(); + + /** + * Model tests for SelfReferenceAdditionalProperties + */ + @Test + public void testSelfReferenceAdditionalProperties() { + // TODO: test SelfReferenceAdditionalProperties + } + + /** + * Test the property 'dummy' + */ + @Test + public void dummyTest() { + // TODO: test dummy + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SelfReferenceAnyOfTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SelfReferenceAnyOfTest.java new file mode 100644 index 000000000000..dd827380993d --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SelfReferenceAnyOfTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SelfReferenceAnyOf + */ +public class SelfReferenceAnyOfTest { + private final SelfReferenceAnyOf model = new SelfReferenceAnyOf(); + + /** + * Model tests for SelfReferenceAnyOf + */ + @Test + public void testSelfReferenceAnyOf() { + // TODO: test SelfReferenceAnyOf + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SelfReferenceOneOfTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SelfReferenceOneOfTest.java new file mode 100644 index 000000000000..a1e80bbd1dc7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SelfReferenceOneOfTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SelfReferenceOneOf + */ +public class SelfReferenceOneOfTest { + private final SelfReferenceOneOf model = new SelfReferenceOneOf(); + + /** + * Model tests for SelfReferenceOneOf + */ + @Test + public void testSelfReferenceOneOf() { + // TODO: test SelfReferenceOneOf + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SimpleModelWithArrayPropertyTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SimpleModelWithArrayPropertyTest.java new file mode 100644 index 000000000000..7368878c9ab6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/SimpleModelWithArrayPropertyTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SimpleModelWithArrayProperty + */ +public class SimpleModelWithArrayPropertyTest { + private final SimpleModelWithArrayProperty model = new SimpleModelWithArrayProperty(); + + /** + * Model tests for SimpleModelWithArrayProperty + */ + @Test + public void testSimpleModelWithArrayProperty() { + // TODO: test SimpleModelWithArrayProperty + } + + /** + * Test the property 'arrayOfStrings' + */ + @Test + public void arrayOfStringsTest() { + // TODO: test arrayOfStrings + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/StringOrIntTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/StringOrIntTest.java new file mode 100644 index 000000000000..431c856d891a --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/StringOrIntTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for StringOrInt + */ +public class StringOrIntTest { + private final StringOrInt model = new StringOrInt(); + + /** + * Model tests for StringOrInt + */ + @Test + public void testStringOrInt() { + // TODO: test StringOrInt + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..baef6f40d3a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..1be6c73e32cd --- /dev/null +++ b/samples/client/petstore/java/okhttp-3.1/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp-awsv4signature/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp-awsv4signature/.gitignore b/samples/client/petstore/java/okhttp-awsv4signature/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/.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/client/petstore/java/okhttp-awsv4signature/.openapi-generator-ignore b/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/.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/client/petstore/java/okhttp-awsv4signature/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/FILES new file mode 100644 index 000000000000..ae8005a8abc5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/FILES @@ -0,0 +1,60 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/Category.md +docs/ModelApiResponse.md +docs/Order.md +docs/Pet.md +docs/PetApi.md +docs/StoreApi.md +docs/Tag.md +docs/User.md +docs/UserApi.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/auth/AWS4Auth.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/User.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java diff --git a/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-awsv4signature/.travis.yml b/samples/client/petstore/java/okhttp-awsv4signature/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/.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/client/petstore/java/okhttp-awsv4signature/README.md b/samples/client/petstore/java/okhttp-awsv4signature/README.md new file mode 100644 index 000000000000..57c164fe2035 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/README.md @@ -0,0 +1,186 @@ +# okhttp-awsv4signature + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + okhttp-awsv4signature + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'okhttp-awsv4signature' jar has been published to maven central. + mavenLocal() // Needed if the 'okhttp-awsv4signature' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:okhttp-awsv4signature:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/okhttp-awsv4signature-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Category](docs/Category.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/api/openapi.yaml b/samples/client/petstore/java/okhttp-awsv4signature/api/openapi.yaml new file mode 100644 index 000000000000..a1efcc2e4d8c --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/api/openapi.yaml @@ -0,0 +1,870 @@ +openapi: 3.0.0 +info: + description: "This is a sample server Petstore server. For this sample, you can\ + \ use the api key `special-key` to test the authorization filters." + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + put: + description: "" + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: orderId + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + Order: + description: An order for a pets from the pet store + example: + id: 0 + petId: 6 + quantity: 1 + shipDate: 2000-01-23T04:56:07.000+00:00 + status: placed + complete: false + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object + xml: + name: Order + Category: + description: A category for a pet + example: + id: 6 + name: name + properties: + id: + format: int64 + type: integer + name: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + title: Pet category + type: object + xml: + name: Category + User: + description: A User who is purchasing from the pet store + example: + id: 0 + username: username + firstName: firstName + lastName: lastName + email: email + password: password + phone: phone + userStatus: 6 + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Tag: + description: A tag for a pet + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + Pet: + description: A pet for sale in the pet store + example: + id: 0 + category: + id: 6 + name: name + name: doggie + photoUrls: + - photoUrls + - photoUrls + tags: + - id: 1 + name: name + - id: 1 + name: name + status: available + properties: + id: + format: int64 + type: integer + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/build.gradle b/samples/client/petstore/java/okhttp-awsv4signature/build.gradle new file mode 100644 index 000000000000..48b5e66129ea --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/build.gradle @@ -0,0 +1,65 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'okhttp-awsv4signature' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation 'software.amazon.awssdk:auth:2.20.157' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/build.sbt b/samples/client/petstore/java/okhttp-awsv4signature/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp-awsv4signature/docs/Category.md b/samples/client/petstore/java/okhttp-awsv4signature/docs/Category.md new file mode 100644 index 000000000000..a7fc939d252e --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/docs/Category.md @@ -0,0 +1,15 @@ + + +# Category + +A category for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-awsv4signature/docs/ModelApiResponse.md new file mode 100644 index 000000000000..cd7e3c400be6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/docs/ModelApiResponse.md @@ -0,0 +1,16 @@ + + +# ModelApiResponse + +Describes the result of uploading an image resource + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/docs/Order.md b/samples/client/petstore/java/okhttp-awsv4signature/docs/Order.md new file mode 100644 index 000000000000..0c33059b8b6a --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/docs/Order.md @@ -0,0 +1,29 @@ + + +# Order + +An order for a pets from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/docs/Pet.md b/samples/client/petstore/java/okhttp-awsv4signature/docs/Pet.md new file mode 100644 index 000000000000..8bb363301232 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/docs/Pet.md @@ -0,0 +1,29 @@ + + +# Pet + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/docs/PetApi.md b/samples/client/petstore/java/okhttp-awsv4signature/docs/PetApi.md new file mode 100644 index 000000000000..7199b126d6ca --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/docs/PetApi.md @@ -0,0 +1,586 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | + + + +# **addPet** +> Pet addPet(pet) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +# **updatePet** +> Pet updatePet(pet) + +Update an existing pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.updatePet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/docs/StoreApi.md b/samples/client/petstore/java/okhttp-awsv4signature/docs/StoreApi.md new file mode 100644 index 000000000000..881601a19ff2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/docs/StoreApi.md @@ -0,0 +1,274 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + 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 + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + + + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/docs/Tag.md b/samples/client/petstore/java/okhttp-awsv4signature/docs/Tag.md new file mode 100644 index 000000000000..abfde4afb501 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/docs/Tag.md @@ -0,0 +1,15 @@ + + +# Tag + +A tag for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/docs/User.md b/samples/client/petstore/java/okhttp-awsv4signature/docs/User.md new file mode 100644 index 000000000000..426845227bd3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/docs/User.md @@ -0,0 +1,21 @@ + + +# User + +A User who is purchasing from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/docs/UserApi.md b/samples/client/petstore/java/okhttp-awsv4signature/docs/UserApi.md new file mode 100644 index 000000000000..83a174dd327a --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/docs/UserApi.md @@ -0,0 +1,569 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | + + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + 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 + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + // Configure AWS Signature V4 authorization + defaultClient.setAWS4Configuration("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", "REGION", "SERVICE") + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/git_push.sh b/samples/client/petstore/java/okhttp-awsv4signature/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp-awsv4signature/gradle.properties b/samples/client/petstore/java/okhttp-awsv4signature/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-awsv4signature/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-awsv4signature/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-awsv4signature/gradlew.bat b/samples/client/petstore/java/okhttp-awsv4signature/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp-awsv4signature/pom.xml b/samples/client/petstore/java/okhttp-awsv4signature/pom.xml new file mode 100644 index 000000000000..d93c55808d93 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/pom.xml @@ -0,0 +1,289 @@ + + 4.0.0 + org.openapitools + okhttp-awsv4signature + jar + okhttp-awsv4signature + 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-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + software.amazon.awssdk + auth + 2.20.157 + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.10.1 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/settings.gradle b/samples/client/petstore/java/okhttp-awsv4signature/settings.gradle new file mode 100644 index 000000000000..5c660e5f7831 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "okhttp-awsv4signature" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-awsv4signature/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..e818a511443e --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..d395d816a312 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1747 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; +import org.openapitools.client.auth.AWS4Auth; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://petstore.swagger.io/v2"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("AWS4Auth", new AWS4Auth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("AWS4Auth", new AWS4Auth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = ""; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("AWS4Auth", new AWS4Auth()); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io/v2) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + for (Authentication auth : authentications.values()) { + if (auth instanceof AWS4Auth) { + ((AWS4Auth) auth).setCredentials(accessKey, secretKey); + ((AWS4Auth) auth).setRegion(region); + ((AWS4Auth) auth).setService(service); + return; + } + } + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + for (Authentication auth : authentications.values()) { + if (auth instanceof AWS4Auth) { + ((AWS4Auth) auth).setCredentials(accessKey, secretKey, sessionToken); + ((AWS4Auth) auth).setRegion(region); + ((AWS4Auth) auth).setService(service); + return; + } + } + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..bbe1b2c8ee33 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..189537deb549 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..ba56d6cab13d --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..01aa8bb7a1f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,445 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Category.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelApiResponse.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Order.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Pet.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Tag.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.User.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..8b84ab37c82a --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..673ffc4cbb7b --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..10eeda6a297e --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..ae47d8bdb452 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..1b09cdb8d75c --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..a4859da9a700 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..8e9d822a45be --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1201 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PetApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addPet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call addPetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addPetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling addPet(Async)"); + } + + return addPetCall(pet, _callback); + + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public Pet addPet(@javax.annotation.Nonnull Pet pet) throws ApiException { + ApiResponse localVarResp = addPetWithHttpInfo(pet); + return localVarResp.getData(); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Add a new pet to the store (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call addPetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deletePet + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + + String[] localVarAuthNames = new String[] { "AWS4Auth", "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePetValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); + } + + return deletePetCall(petId, apiKey, _callback); + + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deletes a pet (asynchronously) + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for findPetsByStatus + * @param status Status values that need to be considered for filter (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "status", status)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByStatusValidateBeforeCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + + return findPetsByStatusCall(status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + ApiResponse> localVarResp = findPetsByStatusWithHttpInfo(status); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by status (asynchronously) + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusAsync(@javax.annotation.Nonnull List status, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for findPetsByTags + * @param tags Tags to filter by (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByTagsValidateBeforeCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); + } + + return findPetsByTagsCall(tags, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { + ApiResponse> localVarResp = findPetsByTagsWithHttpInfo(tags); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by tags (asynchronously) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsAsync(@javax.annotation.Nonnull List tags, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPetById + * @param petId ID of pet to return (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + return getPetByIdCall(petId, _callback); + + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + ApiResponse localVarResp = getPetByIdWithHttpInfo(petId); + return localVarResp.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find pet by ID (asynchronously) + * Returns a single pet + * @param petId ID of pet to return (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdAsync(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public okhttp3.Call updatePetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling updatePet(Async)"); + } + + return updatePetCall(pet, _callback); + + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public Pet updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException { + ApiResponse localVarResp = updatePetWithHttpInfo(pet); + return localVarResp.getData(); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update an existing pet (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public okhttp3.Call updatePetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePetWithForm + * @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) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetWithFormValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); + } + + return updatePetWithFormCall(petId, name, status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updates a pet in the store with form data (asynchronously) + * + * @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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for uploadFile + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); + } + + return uploadFileCall(petId, additionalMetadata, _file, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = uploadFileWithHttpInfo(petId, additionalMetadata, _file); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (asynchronously) + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..adf107bae2f4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,593 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Order; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class StoreApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteOrder + * @param orderId ID of the order that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{orderId}" + .replace("{" + "orderId" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOrderValidateBeforeCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); + } + + return deleteOrderCall(orderId, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete purchase order by ID (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderAsync(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getInventory + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getInventoryCall(_callback); + + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Map getInventory() throws ApiException { + ApiResponse> localVarResp = getInventoryWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Returns pet inventories by status (asynchronously) + * Returns a map of status codes to quantities + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderById + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{orderId}" + .replace("{" + "orderId" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderByIdValidateBeforeCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); + } + + return getOrderByIdCall(orderId, _callback); + + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + ApiResponse localVarResp = getOrderByIdWithHttpInfo(orderId); + return localVarResp.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find purchase order by ID (asynchronously) + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdAsync(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for placeOrder + * @param order order placed for purchasing the pet (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = order; + + // create path and map variables + String localVarPath = "/store/order"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException("Missing the required parameter 'order' when calling placeOrder(Async)"); + } + + return placeOrderCall(order, _callback); + + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { + ApiResponse localVarResp = placeOrderWithHttpInfo(order); + return localVarResp.getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Place an order for a pet (asynchronously) + * + * @param order order placed for purchasing the pet (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderAsync(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..ce5daf993bda --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,1105 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UserApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createUser + * @param user Created user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUserValidateBeforeCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUser(Async)"); + } + + return createUserCall(user, _callback); + + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create user (asynchronously) + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserAsync(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithArrayInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithArrayInput(Async)"); + } + + return createUsersWithArrayInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithListInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithList"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithListInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithListInput(Async)"); + } + + return createUsersWithListInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteUser + * @param username The name that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteUserValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); + } + + return deleteUserCall(username, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete user (asynchronously) + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getUserByName + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByNameValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); + } + + return getUserByNameCall(username, _callback); + + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + ApiResponse localVarResp = getUserByNameWithHttpInfo(username); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get user by user name (asynchronously) + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for loginUser + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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 okhttp3.Call loginUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (username != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); + } + + if (password != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("password", password)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call loginUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); + } + + return loginUserCall(username, password, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + ApiResponse localVarResp = loginUserWithHttpInfo(username, password); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Logs user into the system (asynchronously) + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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 okhttp3.Call loginUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for logoutUser + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return logoutUserCall(_callback); + + } + + /** + * Logs out current logged in user session + * + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Logs out current logged in user session (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateUser + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AWS4Auth", "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling updateUser(Async)"); + } + + return updateUserCall(username, user, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updated user (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/AWS4Auth.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/AWS4Auth.java new file mode 100644 index 000000000000..357580c13603 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/AWS4Auth.java @@ -0,0 +1,115 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.io.ByteArrayInputStream; +import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.List; +import java.util.stream.Collectors; + +import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider; +import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; +import software.amazon.awssdk.auth.credentials.AwsSessionCredentials; +import software.amazon.awssdk.auth.credentials.AwsCredentials; +import software.amazon.awssdk.auth.signer.Aws4Signer; +import software.amazon.awssdk.auth.signer.params.Aws4SignerParams; +import software.amazon.awssdk.http.ContentStreamProvider; +import software.amazon.awssdk.http.SdkHttpFullRequest; +import software.amazon.awssdk.http.SdkHttpMethod; +import software.amazon.awssdk.regions.Region; + +import okio.Buffer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AWS4Auth implements Authentication { + + private AwsCredentials credentials; + private String region; + private String service; + + public AWS4Auth() { + this.credentials = AnonymousCredentialsProvider.create().resolveCredentials(); + } + + public void setCredentials(String accessKey, String secretKey) { + this.credentials = AwsBasicCredentials.create(accessKey, secretKey); + } + + public void setCredentials(String accessKey, String secretKey, String sessionToken) { + this.credentials = AwsSessionCredentials.create(accessKey, secretKey, sessionToken); + } + + public void setRegion(String region) { + this.region = region; + } + + public void setService(String service) { + this.service = service; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, + Map cookieParams, String payload, String method, URI uri) + throws ApiException { + + SdkHttpFullRequest.Builder requestBuilder = + SdkHttpFullRequest.builder().uri(uri).method(SdkHttpMethod.fromValue(method)); + + ContentStreamProvider provider = new ContentStreamProvider() { + @Override + public InputStream newStream() { + InputStream is = new ByteArrayInputStream(payload.getBytes(StandardCharsets.UTF_8)); + return is; + } + }; + + requestBuilder = requestBuilder.contentStreamProvider(provider); + + SdkHttpFullRequest signableRequest = sign(requestBuilder); + + Map headers = signableRequest.headers().entrySet().stream() + .collect(Collectors.toMap(s -> s.getKey(), e -> e.getValue().get(0))); + + headerParams.putAll(headers); + } + + /** + * AWS Signature Version 4 signing. + * + * @param request {@link SdkHttpFullRequest.Builder} + * @return {@link SdkHttpFullRequest} + */ + private SdkHttpFullRequest sign(final SdkHttpFullRequest.Builder request) { + + SdkHttpFullRequest req = request.build(); + + if (this.service != null && this.region != null && this.credentials != null) { + Aws4SignerParams params = Aws4SignerParams.builder().signingName(this.service) + .signingRegion(Region.of(this.region)).awsCredentials(this.credentials).build(); + + Aws4Signer signer = Aws4Signer.create(); + + req = signer.sign(req, params); + } + + return req; + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..334ae1f6fd40 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..07839e9966cf --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..85d6556f1f68 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..f728b306c358 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..0b5e71fe6212 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,43 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..0de7ae9fc491 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..57db3963e4f6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..75a1d304801f --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..bdd0ae91976f --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,142 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..1332de3a1697 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,311 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A category for a pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Category { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, category.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Category + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Category.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Category' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Category.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Category value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Category read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Category given an JSON string + * + * @param jsonString JSON string + * @return An instance of Category + * @throws IOException if the JSON string is invalid with respect to Category + */ + public static Category fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Category.class); + } + + /** + * Convert an instance of Category to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..1bc343bd5338 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,341 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Describes the result of uploading an image resource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelApiResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + + public Integer getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, _apiResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("code", "type", "message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelApiResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelApiResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelApiResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelApiResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelApiResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelApiResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelApiResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelApiResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelApiResponse + * @throws IOException if the JSON string is invalid with respect to ModelApiResponse + */ + public static ModelApiResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelApiResponse.class); + } + + /** + * Convert an instance of ModelApiResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..db0571d69be1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,478 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * An order for a pets from the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Order { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_PET_ID = "petId"; + @SerializedName(SERIALIZED_NAME_PET_ID) + @javax.annotation.Nullable + private Long petId; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; + @SerializedName(SERIALIZED_NAME_SHIP_DATE) + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_COMPLETE = "complete"; + @SerializedName(SERIALIZED_NAME_COMPLETE) + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + + public Long getPetId() { + return petId; + } + + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + + public OffsetDateTime getShipDate() { + return shipDate; + } + + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + + public Boolean getComplete() { + return complete; + } + + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, order.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "petId", "quantity", "shipDate", "status", "complete")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Order + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Order.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Order' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Order.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Order value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Order read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Order instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Order given an JSON string + * + * @param jsonString JSON string + * @return An instance of Order + * @throws IOException if the JSON string is invalid with respect to Order + */ + public static Order fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Order.class); + } + + /** + * Convert an instance of Order to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..385b0eb2ad13 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,537 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A pet for sale in the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pet { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @Deprecated + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable 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 + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + @Deprecated + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + @Deprecated + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, pet.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Pet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Pet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Pet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Pet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Pet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Pet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Pet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Pet given an JSON string + * + * @param jsonString JSON string + * @return An instance of Pet + * @throws IOException if the JSON string is invalid with respect to Pet + */ + public static Pet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Pet.class); + } + + /** + * Convert an instance of Pet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..de14a3aee9b3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,311 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A tag for a pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Tag { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Tag + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Tag.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Tag' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Tag value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Tag read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Tag given an JSON string + * + * @param jsonString JSON string + * @return An instance of Tag + * @throws IOException if the JSON string is invalid with respect to Tag + */ + public static Tag fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Tag.class); + } + + /** + * Convert an instance of Tag to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..01d7a093236a --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,488 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A User who is purchasing from the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class User { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nullable + private String username; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nullable + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nullable + private String lastName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nullable + private String password; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nullable + private String phone; + + public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; + @SerializedName(SERIALIZED_NAME_USER_STATUS) + @javax.annotation.Nullable + private Integer userStatus; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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.additionalProperties, user.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to User + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) && !jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!User.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'User' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(User.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, User value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public User read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of User given an JSON string + * + * @param jsonString JSON string + * @return An instance of User + * @throws IOException if the JSON string is invalid with respect to User + */ + public static User fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, User.class); + } + + /** + * Convert an instance of User to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..44e74f1cf98b --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,153 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + Pet response = api.addPet(pet); + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + Pet response = api.updatePet(pet); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.uploadFile(petId, additionalMetadata, _file); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..3ca20d0b210b --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,89 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = api.getOrderById(orderId); + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order order = null; + Order response = api.placeOrder(order); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..a46743c4435d --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,148 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User user = null; + api.createUser(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List user = null; + api.createUsersWithArrayInput(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List user = null; + api.createUsersWithListInput(user); + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + api.deleteUser(username); + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + api.logoutUser(); + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User user = null; + api.updateUser(username, user); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..5bf64f190609 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..91f7c6e7b08b --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..68d51864f2e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..1dbb74a230c4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..baef6f40d3a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..1be6c73e32cd --- /dev/null +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp-dynamicOperations/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/.gitignore b/samples/client/petstore/java/okhttp-dynamicOperations/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/.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/client/petstore/java/okhttp-dynamicOperations/.openapi-generator-ignore b/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/.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/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/FILES new file mode 100644 index 000000000000..d8fcfa5a52db --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/FILES @@ -0,0 +1,186 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +build.gradle +build.sbt +docs/AdditionalPropertiesAnyType.md +docs/AdditionalPropertiesArray.md +docs/AdditionalPropertiesBoolean.md +docs/AdditionalPropertiesClass.md +docs/AdditionalPropertiesInteger.md +docs/AdditionalPropertiesNumber.md +docs/AdditionalPropertiesObject.md +docs/AdditionalPropertiesString.md +docs/Animal.md +docs/AnotherFakeApi.md +docs/ArrayOfArrayOfNumberOnly.md +docs/ArrayOfNumberOnly.md +docs/ArrayTest.md +docs/BigCat.md +docs/Capitalization.md +docs/Cat.md +docs/Category.md +docs/ClassModel.md +docs/Client.md +docs/Dog.md +docs/EnumArrays.md +docs/EnumClass.md +docs/EnumTest.md +docs/FakeApi.md +docs/FakeClassnameTags123Api.md +docs/FileSchemaTestClass.md +docs/FormatTest.md +docs/HasOnlyReadOnly.md +docs/MapTest.md +docs/MixedPropertiesAndAdditionalPropertiesClass.md +docs/Model200Response.md +docs/ModelApiResponse.md +docs/ModelFile.md +docs/ModelList.md +docs/ModelReturn.md +docs/Name.md +docs/NumberOnly.md +docs/Order.md +docs/OuterComposite.md +docs/OuterEnum.md +docs/Pet.md +docs/PetApi.md +docs/ReadOnlyFirst.md +docs/SpecialModelName.md +docs/StoreApi.md +docs/Tag.md +docs/TypeHolderDefault.md +docs/TypeHolderExample.md +docs/User.md +docs/UserApi.md +docs/XmlItem.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiOperation.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/AnotherFakeApi.java +src/main/java/org/openapitools/client/api/FakeApi.java +src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +src/main/java/org/openapitools/client/model/Animal.java +src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayTest.java +src/main/java/org/openapitools/client/model/BigCat.java +src/main/java/org/openapitools/client/model/Capitalization.java +src/main/java/org/openapitools/client/model/Cat.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ClassModel.java +src/main/java/org/openapitools/client/model/Client.java +src/main/java/org/openapitools/client/model/Dog.java +src/main/java/org/openapitools/client/model/EnumArrays.java +src/main/java/org/openapitools/client/model/EnumClass.java +src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +src/main/java/org/openapitools/client/model/FormatTest.java +src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +src/main/java/org/openapitools/client/model/MapTest.java +src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/Model200Response.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/ModelFile.java +src/main/java/org/openapitools/client/model/ModelList.java +src/main/java/org/openapitools/client/model/ModelReturn.java +src/main/java/org/openapitools/client/model/Name.java +src/main/java/org/openapitools/client/model/NumberOnly.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/OuterComposite.java +src/main/java/org/openapitools/client/model/OuterEnum.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +src/main/java/org/openapitools/client/model/SpecialModelName.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/TypeHolderDefault.java +src/main/java/org/openapitools/client/model/TypeHolderExample.java +src/main/java/org/openapitools/client/model/User.java +src/main/java/org/openapitools/client/model/XmlItem.java +src/main/resources/openapi/openapi.yaml +src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java +src/test/java/org/openapitools/client/api/FakeApiTest.java +src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java +src/test/java/org/openapitools/client/model/AnimalTest.java +src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayTestTest.java +src/test/java/org/openapitools/client/model/BigCatTest.java +src/test/java/org/openapitools/client/model/CapitalizationTest.java +src/test/java/org/openapitools/client/model/CatTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ClassModelTest.java +src/test/java/org/openapitools/client/model/ClientTest.java +src/test/java/org/openapitools/client/model/DogTest.java +src/test/java/org/openapitools/client/model/EnumArraysTest.java +src/test/java/org/openapitools/client/model/EnumClassTest.java +src/test/java/org/openapitools/client/model/EnumTestTest.java +src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java +src/test/java/org/openapitools/client/model/FormatTestTest.java +src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java +src/test/java/org/openapitools/client/model/MapTestTest.java +src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java +src/test/java/org/openapitools/client/model/Model200ResponseTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/ModelFileTest.java +src/test/java/org/openapitools/client/model/ModelListTest.java +src/test/java/org/openapitools/client/model/ModelReturnTest.java +src/test/java/org/openapitools/client/model/NameTest.java +src/test/java/org/openapitools/client/model/NumberOnlyTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/OuterCompositeTest.java +src/test/java/org/openapitools/client/model/OuterEnumTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java +src/test/java/org/openapitools/client/model/SpecialModelNameTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java +src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java +src/test/java/org/openapitools/client/model/UserTest.java +src/test/java/org/openapitools/client/model/XmlItemTest.java diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/.travis.yml b/samples/client/petstore/java/okhttp-dynamicOperations/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/.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/client/petstore/java/okhttp-dynamicOperations/README.md b/samples/client/petstore/java/okhttp-dynamicOperations/README.md new file mode 100644 index 000000000000..91a7266702e6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/README.md @@ -0,0 +1,248 @@ +# petstore-okhttp-dynamicoperations + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-okhttp-dynamicoperations + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-okhttp-dynamicoperations' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp-dynamicoperations' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp-dynamicoperations:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/petstore-okhttp-dynamicoperations-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + UUID uuidTest = UUID.randomUUID(); // UUID | to test uuid example value + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(uuidTest, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +*FakeApi* | [**createXmlItem**](docs/FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem +*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +*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* | [**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 +*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | +*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md) + - [AdditionalPropertiesArray](docs/AdditionalPropertiesArray.md) + - [AdditionalPropertiesBoolean](docs/AdditionalPropertiesBoolean.md) + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AdditionalPropertiesInteger](docs/AdditionalPropertiesInteger.md) + - [AdditionalPropertiesNumber](docs/AdditionalPropertiesNumber.md) + - [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md) + - [AdditionalPropertiesString](docs/AdditionalPropertiesString.md) + - [Animal](docs/Animal.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayTest](docs/ArrayTest.md) + - [BigCat](docs/BigCat.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [Category](docs/Category.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [Dog](docs/Dog.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumTest](docs/EnumTest.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [FormatTest](docs/FormatTest.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [ModelFile](docs/ModelFile.md) + - [ModelList](docs/ModelList.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [NumberOnly](docs/NumberOnly.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [Pet](docs/Pet.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [TypeHolderDefault](docs/TypeHolderDefault.md) + - [TypeHolderExample](docs/TypeHolderExample.md) + - [User](docs/User.md) + - [XmlItem](docs/XmlItem.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/build.gradle b/samples/client/petstore/java/okhttp-dynamicOperations/build.gradle new file mode 100644 index 000000000000..9dc274c1ea57 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/build.gradle @@ -0,0 +1,65 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-okhttp-dynamicoperations' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + implementation 'io.swagger.parser.v3:swagger-parser-v3:2.0.30' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/build.sbt b/samples/client/petstore/java/okhttp-dynamicOperations/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesAnyType.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesAnyType.md new file mode 100644 index 000000000000..5158bd815e67 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesAnyType.md @@ -0,0 +1,13 @@ + + +# AdditionalPropertiesAnyType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesArray.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesArray.md new file mode 100644 index 000000000000..9edcf46b0e44 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesArray.md @@ -0,0 +1,13 @@ + + +# AdditionalPropertiesArray + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesBoolean.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesBoolean.md new file mode 100644 index 000000000000..1e1ed764a56e --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesBoolean.md @@ -0,0 +1,13 @@ + + +# AdditionalPropertiesBoolean + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..79402f75c68c --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesClass.md @@ -0,0 +1,23 @@ + + +# AdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapString** | **Map<String, String>** | | [optional] | +|**mapNumber** | **Map<String, BigDecimal>** | | [optional] | +|**mapInteger** | **Map<String, Integer>** | | [optional] | +|**mapBoolean** | **Map<String, Boolean>** | | [optional] | +|**mapArrayInteger** | **Map<String, List<Integer>>** | | [optional] | +|**mapArrayAnytype** | **Map<String, List<Object>>** | | [optional] | +|**mapMapString** | **Map<String, Map<String, String>>** | | [optional] | +|**mapMapAnytype** | **Map<String, Map<String, Object>>** | | [optional] | +|**anytype1** | **Object** | | [optional] | +|**anytype2** | **Object** | | [optional] | +|**anytype3** | **Object** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesInteger.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesInteger.md new file mode 100644 index 000000000000..cbc1673c059b --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesInteger.md @@ -0,0 +1,13 @@ + + +# AdditionalPropertiesInteger + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesNumber.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesNumber.md new file mode 100644 index 000000000000..0bd133ccf09a --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesNumber.md @@ -0,0 +1,13 @@ + + +# AdditionalPropertiesNumber + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesObject.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesObject.md new file mode 100644 index 000000000000..3f419f8551ff --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesObject.md @@ -0,0 +1,13 @@ + + +# AdditionalPropertiesObject + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesString.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesString.md new file mode 100644 index 000000000000..269a1961cf88 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AdditionalPropertiesString.md @@ -0,0 +1,13 @@ + + +# AdditionalPropertiesString + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/Animal.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Animal.md new file mode 100644 index 000000000000..d9b32f14c88a --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Animal.md @@ -0,0 +1,14 @@ + + +# Animal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | +|**color** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/AnotherFakeApi.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AnotherFakeApi.md new file mode 100644 index 000000000000..3b390ea25a0c --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/AnotherFakeApi.md @@ -0,0 +1,73 @@ +# AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags | + + + +# **call123testSpecialTags** +> Client call123testSpecialTags(uuidTest, body) + +To test special tags + +To test special tags and operation ID starting with number + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + UUID uuidTest = UUID.randomUUID(); // UUID | to test uuid example value + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(uuidTest, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **uuidTest** | **UUID**| to test uuid example value | | +| **body** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..0188db3eb131 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayArrayNumber** | **List<List<BigDecimal>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..a5753530aada --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayNumber** | **List<BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/ArrayTest.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ArrayTest.md new file mode 100644 index 000000000000..36077c9df300 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ArrayTest.md @@ -0,0 +1,15 @@ + + +# ArrayTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayOfString** | **List<String>** | | [optional] | +|**arrayArrayOfInteger** | **List<List<Long>>** | | [optional] | +|**arrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/BigCat.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/BigCat.md new file mode 100644 index 000000000000..d317a0617f37 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/BigCat.md @@ -0,0 +1,24 @@ + + +# BigCat + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**kind** | [**KindEnum**](#KindEnum) | | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| LIONS | "lions" | +| TIGERS | "tigers" | +| LEOPARDS | "leopards" | +| JAGUARS | "jaguars" | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/Capitalization.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Capitalization.md new file mode 100644 index 000000000000..82a812711de2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Capitalization.md @@ -0,0 +1,18 @@ + + +# Capitalization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**smallCamel** | **String** | | [optional] | +|**capitalCamel** | **String** | | [optional] | +|**smallSnake** | **String** | | [optional] | +|**capitalSnake** | **String** | | [optional] | +|**scAETHFlowPoints** | **String** | | [optional] | +|**ATT_NAME** | **String** | Name of the pet | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/Cat.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Cat.md new file mode 100644 index 000000000000..390dd519c8ce --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Cat.md @@ -0,0 +1,13 @@ + + +# Cat + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**declawed** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/Category.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Category.md new file mode 100644 index 000000000000..ab6d1ec334dc --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Category.md @@ -0,0 +1,14 @@ + + +# Category + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/ClassModel.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ClassModel.md new file mode 100644 index 000000000000..af46dea1f6c8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ClassModel.md @@ -0,0 +1,14 @@ + + +# ClassModel + +Model for testing model with \"_class\" property + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/Client.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Client.md new file mode 100644 index 000000000000..ef07b4ab8b9d --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Client.md @@ -0,0 +1,13 @@ + + +# Client + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**client** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/Dog.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Dog.md new file mode 100644 index 000000000000..972c981c0d05 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Dog.md @@ -0,0 +1,13 @@ + + +# Dog + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/EnumArrays.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/EnumArrays.md new file mode 100644 index 000000000000..b2222d5beb25 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/EnumArrays.md @@ -0,0 +1,32 @@ + + +# EnumArrays + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] | +|**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] | + + + +## Enum: JustSymbolEnum + +| Name | Value | +|---- | -----| +| GREATER_THAN_OR_EQUAL_TO | ">=" | +| DOLLAR | "$" | + + + +## Enum: List<ArrayEnumEnum> + +| Name | Value | +|---- | -----| +| FISH | "fish" | +| CRAB | "crab" | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/EnumClass.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/EnumClass.md new file mode 100644 index 000000000000..b314590a7591 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/EnumClass.md @@ -0,0 +1,15 @@ + + +# EnumClass + +## Enum + + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/EnumTest.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/EnumTest.md new file mode 100644 index 000000000000..bf2def484c6d --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/EnumTest.md @@ -0,0 +1,55 @@ + + +# EnumTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] | +|**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | | +|**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] | +|**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] | +|**outerEnum** | **OuterEnum** | | [optional] | + + + +## Enum: EnumStringEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumStringRequiredEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumIntegerEnum + +| Name | Value | +|---- | -----| +| NUMBER_1 | 1 | +| NUMBER_MINUS_1 | -1 | + + + +## Enum: EnumNumberEnum + +| Name | Value | +|---- | -----| +| NUMBER_1_DOT_1 | 1.1 | +| NUMBER_MINUS_1_DOT_2 | -1.2 | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/FakeApi.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/FakeApi.md new file mode 100644 index 000000000000..98f0b0098b8b --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/FakeApi.md @@ -0,0 +1,949 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createXmlItem**](FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem | +| [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | +| [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | | +| [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | | +| [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | | +| [**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 | +| [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 | +| [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters | +| [**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) | +| [**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties | +| [**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data | +| [**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | | + + + +# **createXmlItem** +> createXmlItem(xmlItem) + +creates an XmlItem + +this route creates an XmlItem + +### 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); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### 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); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **Boolean**| Input boolean as post body | [optional] | + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### 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); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] | + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### 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); + BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **BigDecimal**| Input number as post body | [optional] | + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### 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); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **String**| Input string as post body | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(body) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +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); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(query, body) + + + +### 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); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **query** | **String**| | | +| **body** | [**User**](User.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testClientModel** +> Client testClientModel(body) + +To test \"client\" model + +To test \"client\" model + +### 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); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testEndpointParameters** +> testEndpointParameters(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 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(78); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = LocalDate.now(); // LocalDate | None + OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **number** | **BigDecimal**| None | | +| **_double** | **Double**| None | | +| **patternWithoutDelimiter** | **String**| None | | +| **_byte** | **byte[]**| None | | +| **integer** | **Integer**| None | [optional] | +| **int32** | **Integer**| None | [optional] | +| **int64** | **Long**| None | [optional] | +| **_float** | **Float**| None | [optional] | +| **string** | **String**| None | [optional] | +| **binary** | **File**| None | [optional] | +| **date** | **LocalDate**| None | [optional] | +| **dateTime** | **OffsetDateTime**| None | [optional] | +| **password** | **String**| None | [optional] | +| **paramCallback** | **String**| None | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **testEnumParameters** +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### 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); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "_abc"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "_abc"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 1; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 1.1D; // Double | Query parameter enum test (double) + List enumFormStringArray = Arrays.asList("$"); // List | Form parameter enum test (string array) + String enumFormString = "_abc"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] | +| **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] | +| **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] | +| **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] | +| **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] | +| **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + + +# **testGroupParameters** +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group).stringGroup(stringGroup).booleanGroup(booleanGroup).int64Group(int64Group).execute(); + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### 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); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requiredStringGroup** | **Integer**| Required String in group parameters | | +| **requiredBooleanGroup** | **Boolean**| Required Boolean in group parameters | | +| **requiredInt64Group** | **Long**| Required Integer in group parameters | | +| **stringGroup** | **Integer**| String in group parameters | [optional] | +| **booleanGroup** | **Boolean**| Boolean in group parameters | [optional] | +| **int64Group** | **Long**| Integer in group parameters | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Something wrong | - | + + +# **testInlineAdditionalProperties** +> testInlineAdditionalProperties(param) + +test inline additionalProperties + +### 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); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **param** | [**Map<String, String>**](String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + +### 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); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **param** | **String**| field1 | | +| **param2** | **String**| field2 | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + + +To test the collection format in query parameters + +### 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); + List pipe = Arrays.asList(); // List | + List ioutil = Arrays.asList(); // List | + List http = Arrays.asList(); // List | + List url = Arrays.asList(); // List | + List context = Arrays.asList(); // List | + try { + apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pipe** | [**List<String>**](String.md)| | | +| **ioutil** | [**List<String>**](String.md)| | | +| **http** | [**List<String>**](String.md)| | | +| **url** | [**List<String>**](String.md)| | | +| **context** | [**List<String>**](String.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..e9f04dd15e3a --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/FakeClassnameTags123Api.md @@ -0,0 +1,78 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case | + + + +# **testClassname** +> Client testClassname(body) + +To test class name in snake case + +To test class name in snake case + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); + + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/FileSchemaTestClass.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..85d1a0636694 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/FileSchemaTestClass.md @@ -0,0 +1,14 @@ + + +# FileSchemaTestClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_file** | [**ModelFile**](ModelFile.md) | | [optional] | +|**files** | [**List<ModelFile>**](ModelFile.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/FormatTest.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/FormatTest.md new file mode 100644 index 000000000000..9c68c3080e13 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/FormatTest.md @@ -0,0 +1,26 @@ + + +# FormatTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integer** | **Integer** | | [optional] | +|**int32** | **Integer** | | [optional] | +|**int64** | **Long** | | [optional] | +|**number** | **BigDecimal** | | | +|**_float** | **Float** | | [optional] | +|**_double** | **Double** | | [optional] | +|**string** | **String** | | [optional] | +|**_byte** | **byte[]** | | | +|**binary** | **File** | | [optional] | +|**date** | **LocalDate** | | | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**uuid** | **UUID** | | [optional] | +|**password** | **String** | | | +|**bigDecimal** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/HasOnlyReadOnly.md new file mode 100644 index 000000000000..29da5205dbba --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/HasOnlyReadOnly.md @@ -0,0 +1,14 @@ + + +# HasOnlyReadOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**foo** | **String** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/MapTest.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/MapTest.md new file mode 100644 index 000000000000..54380188e1d6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/MapTest.md @@ -0,0 +1,25 @@ + + +# MapTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapMapOfString** | **Map<String, Map<String, String>>** | | [optional] | +|**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] | +|**directMap** | **Map<String, Boolean>** | | [optional] | +|**indirectMap** | **Map<String, Boolean>** | | [optional] | + + + +## Enum: Map<String, InnerEnum> + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..a5ddf0faa6a9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,15 @@ + + +# MixedPropertiesAndAdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **UUID** | | [optional] | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**map** | [**Map<String, Animal>**](Animal.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/Model200Response.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Model200Response.md new file mode 100644 index 000000000000..109411580c62 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Model200Response.md @@ -0,0 +1,15 @@ + + +# Model200Response + +Model for testing model name starting with number + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | [optional] | +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelApiResponse.md new file mode 100644 index 000000000000..e374c2dd2dec --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelApiResponse.md @@ -0,0 +1,15 @@ + + +# ModelApiResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelFile.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelFile.md new file mode 100644 index 000000000000..adcde984f527 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelFile.md @@ -0,0 +1,14 @@ + + +# ModelFile + +Must be named `File` for test. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**sourceURI** | **String** | Test capitalization | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelList.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelList.md new file mode 100644 index 000000000000..f93ab7dde8d4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelList.md @@ -0,0 +1,13 @@ + + +# ModelList + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_123list** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelReturn.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelReturn.md new file mode 100644 index 000000000000..0bd356861eb7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ModelReturn.md @@ -0,0 +1,14 @@ + + +# ModelReturn + +Model for testing reserved words + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_return** | **Integer** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/Name.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Name.md new file mode 100644 index 000000000000..c901d9435309 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Name.md @@ -0,0 +1,17 @@ + + +# Name + +Model for testing model name same as property name + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | | +|**snakeCase** | **Integer** | | [optional] [readonly] | +|**property** | **String** | | [optional] | +|**_123number** | **Integer** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/NumberOnly.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/NumberOnly.md new file mode 100644 index 000000000000..b8ed1a4cfae1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/NumberOnly.md @@ -0,0 +1,13 @@ + + +# NumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justNumber** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/Order.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Order.md new file mode 100644 index 000000000000..27af32855c5c --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Order.md @@ -0,0 +1,28 @@ + + +# Order + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/OuterComposite.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/OuterComposite.md new file mode 100644 index 000000000000..98b56e0763ff --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/OuterComposite.md @@ -0,0 +1,15 @@ + + +# OuterComposite + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**myNumber** | **BigDecimal** | | [optional] | +|**myString** | **String** | | [optional] | +|**myBoolean** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/OuterEnum.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/OuterEnum.md new file mode 100644 index 000000000000..1f9b723eb8e7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/OuterEnum.md @@ -0,0 +1,15 @@ + + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/Pet.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Pet.md new file mode 100644 index 000000000000..54af77a9f5a7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Pet.md @@ -0,0 +1,28 @@ + + +# Pet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **Set<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/PetApi.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/PetApi.md new file mode 100644 index 000000000000..7e992889a380 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/PetApi.md @@ -0,0 +1,629 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | +| [**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) | + + + +# **addPet** +> addPet(body) + +Add a new pet to the store + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +# **findPetsByTags** +> Set<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Set tags = new LinkedHashSet<>(); // Set | Tags to filter by + try { + Set result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**Set<String>**](String.md)| Tags to filter by | | + +### Return type + +[**Set<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +# **updatePet** +> updatePet(body) + +Update an existing pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **uploadFileWithRequiredFile** +> ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **requiredFile** | **File**| file to upload | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/ReadOnlyFirst.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ReadOnlyFirst.md new file mode 100644 index 000000000000..ad6af7ee155f --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/ReadOnlyFirst.md @@ -0,0 +1,14 @@ + + +# ReadOnlyFirst + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**baz** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/SpecialModelName.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/SpecialModelName.md new file mode 100644 index 000000000000..4b6a06e36224 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/SpecialModelName.md @@ -0,0 +1,13 @@ + + +# SpecialModelName + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**$specialPropertyName** | **Long** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/StoreApi.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/StoreApi.md new file mode 100644 index 000000000000..0995ac3a2d8b --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/StoreApi.md @@ -0,0 +1,264 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + 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 + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **placeOrder** +> Order placeOrder(body) + +Place an order for a pet + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/Tag.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Tag.md new file mode 100644 index 000000000000..5088b2dd1c31 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/Tag.md @@ -0,0 +1,14 @@ + + +# Tag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/TypeHolderDefault.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/TypeHolderDefault.md new file mode 100644 index 000000000000..71a9f3dc9027 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/TypeHolderDefault.md @@ -0,0 +1,17 @@ + + +# TypeHolderDefault + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**stringItem** | **String** | | | +|**numberItem** | **BigDecimal** | | | +|**integerItem** | **Integer** | | | +|**boolItem** | **Boolean** | | | +|**arrayItem** | **List<Integer>** | | | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/TypeHolderExample.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/TypeHolderExample.md new file mode 100644 index 000000000000..9e410c666e44 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/TypeHolderExample.md @@ -0,0 +1,18 @@ + + +# TypeHolderExample + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**stringItem** | **String** | | | +|**numberItem** | **BigDecimal** | | | +|**floatItem** | **Float** | | | +|**integerItem** | **Integer** | | | +|**boolItem** | **Boolean** | | | +|**arrayItem** | **List<Integer>** | | | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/User.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/User.md new file mode 100644 index 000000000000..08813e4b10b4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/User.md @@ -0,0 +1,20 @@ + + +# User + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/UserApi.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/UserApi.md new file mode 100644 index 000000000000..cbf7dd74a09e --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/UserApi.md @@ -0,0 +1,501 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | + + + +# **createUser** +> createUser(body) + +Create user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**User**](User.md)| Created user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(body) + +Creates list of users with given input array + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithListInput** +> createUsersWithListInput(body) + +Creates list of users with given input array + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### 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 | - | + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + 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 + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **updateUser** +> updateUser(username, body) + +Updated user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **body** | [**User**](User.md)| Updated user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/docs/XmlItem.md b/samples/client/petstore/java/okhttp-dynamicOperations/docs/XmlItem.md new file mode 100644 index 000000000000..349b62bed64e --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/docs/XmlItem.md @@ -0,0 +1,41 @@ + + +# XmlItem + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**attributeString** | **String** | | [optional] | +|**attributeNumber** | **BigDecimal** | | [optional] | +|**attributeInteger** | **Integer** | | [optional] | +|**attributeBoolean** | **Boolean** | | [optional] | +|**wrappedArray** | **List<Integer>** | | [optional] | +|**nameString** | **String** | | [optional] | +|**nameNumber** | **BigDecimal** | | [optional] | +|**nameInteger** | **Integer** | | [optional] | +|**nameBoolean** | **Boolean** | | [optional] | +|**nameArray** | **List<Integer>** | | [optional] | +|**nameWrappedArray** | **List<Integer>** | | [optional] | +|**prefixString** | **String** | | [optional] | +|**prefixNumber** | **BigDecimal** | | [optional] | +|**prefixInteger** | **Integer** | | [optional] | +|**prefixBoolean** | **Boolean** | | [optional] | +|**prefixArray** | **List<Integer>** | | [optional] | +|**prefixWrappedArray** | **List<Integer>** | | [optional] | +|**namespaceString** | **String** | | [optional] | +|**namespaceNumber** | **BigDecimal** | | [optional] | +|**namespaceInteger** | **Integer** | | [optional] | +|**namespaceBoolean** | **Boolean** | | [optional] | +|**namespaceArray** | **List<Integer>** | | [optional] | +|**namespaceWrappedArray** | **List<Integer>** | | [optional] | +|**prefixNsString** | **String** | | [optional] | +|**prefixNsNumber** | **BigDecimal** | | [optional] | +|**prefixNsInteger** | **Integer** | | [optional] | +|**prefixNsBoolean** | **Boolean** | | [optional] | +|**prefixNsArray** | **List<Integer>** | | [optional] | +|**prefixNsWrappedArray** | **List<Integer>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/git_push.sh b/samples/client/petstore/java/okhttp-dynamicOperations/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp-dynamicOperations/gradle.properties b/samples/client/petstore/java/okhttp-dynamicOperations/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-dynamicOperations/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/gradlew.bat b/samples/client/petstore/java/okhttp-dynamicOperations/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/pom.xml b/samples/client/petstore/java/okhttp-dynamicOperations/pom.xml new file mode 100644 index 000000000000..5b6179dd21af --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/pom.xml @@ -0,0 +1,284 @@ + + 4.0.0 + org.openapitools + petstore-okhttp-dynamicoperations + jar + petstore-okhttp-dynamicoperations + 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-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.10.1 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/settings.gradle b/samples/client/petstore/java/okhttp-dynamicOperations/settings.gradle new file mode 100644 index 000000000000..fda1b034d2e0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-okhttp-dynamicoperations" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..e9ab7a8d7a60 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiCallback.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; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..56b19ced09b6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1801 @@ +/* + * 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 io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.PathItem; +import io.swagger.v3.oas.models.parameters.Parameter; +import io.swagger.v3.oas.models.parameters.Parameter.StyleEnum; +import io.swagger.v3.parser.OpenAPIV3Parser; +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://petstore.swagger.io:80/v2"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io:80/v2", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + protected Map operationLookupMap = new HashMap<>(); + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = ""; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + + OpenAPI openAPI = new OpenAPIV3Parser().read("openapi/openapi.yaml"); + createOperationLookupMap(openAPI); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io:80/v2) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + public List parameterToPairs(Parameter param, Collection value) { + List params = new ArrayList(); + + // preconditions + if (param == null || param.getName() == null || param.getName().isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if (StyleEnum.FORM.equals(param.getStyle()) && Boolean.TRUE.equals(param.getExplode())) { + for (Object item : value) { + params.add(new Pair(param.getName(), escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if (StyleEnum.SPACEDELIMITED.equals(param.getStyle())) { + delimiter = escapeString(" "); + } else if (StyleEnum.PIPEDELIMITED.equals(param.getStyle())) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(param.getName(), sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + public ApiClient createOperationLookupMap(OpenAPI openAPI) { + operationLookupMap = new HashMap<>(); + for (Map.Entry pathItemEntry : openAPI.getPaths().entrySet()) { + String path = pathItemEntry.getKey(); + PathItem pathItem = pathItemEntry.getValue(); + addOperationLookupEntry(path, "GET", pathItem.getGet()); + addOperationLookupEntry(path, "PUT", pathItem.getPut()); + addOperationLookupEntry(path, "POST", pathItem.getPost()); + addOperationLookupEntry(path, "DELETE", pathItem.getDelete()); + addOperationLookupEntry(path, "OPTIONS", pathItem.getOptions()); + addOperationLookupEntry(path, "HEAD", pathItem.getHead()); + addOperationLookupEntry(path, "PATCH", pathItem.getPatch()); + addOperationLookupEntry(path, "TRACE", pathItem.getTrace()); + } + return this; + } + + protected void addOperationLookupEntry(String path, String method, Operation operation) { + if ( operation != null && operation.getOperationId() != null) { + operationLookupMap.put( + operation.getOperationId(), + new ApiOperation(path, method, operation)); + } + } + + public Map getOperationLookupMap() { + return operationLookupMap; + } + + public String fillParametersFromOperation( + Operation operation, + Map paramMap, + String path, + List queryParams, + List collectionQueryParams, + Map headerParams, + Map cookieParams + ) { + for (Map.Entry entry : paramMap.entrySet()) { + Object value = entry.getValue(); + for (Parameter param : operation.getParameters()) { + if (entry.getKey().equals(param.getName())) { + switch (param.getIn()) { + case "path": + path = path.replace("{" + param.getName() + "}", escapeString(value.toString())); + break; + case "query": + if (value instanceof Collection) { + collectionQueryParams.addAll(parameterToPairs(param, (Collection) value)); + } else { + queryParams.addAll(parameterToPair(param.getName(), value)); + } + break; + case "header": + headerParams.put(param.getName(), parameterToString(value)); + break; + case "cookie": + cookieParams.put(param.getName(), parameterToString(value)); + break; + default: + throw new IllegalStateException("Unexpected param in: " + param.getIn()); + } + + } + } + } + return path; + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..0c0f52846910 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiOperation.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiOperation.java new file mode 100644 index 000000000000..bd7670c17a0b --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiOperation.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; + +import io.swagger.v3.oas.models.Operation; + +public class ApiOperation { + private final String path; + private final String method; + private final Operation operation; + + public ApiOperation(String path, String method, Operation operation) { + this.path = path; + this.method = method; + this.operation = operation; + } + + public Operation getOperation() { + return operation; + } + + public String getPath() { + return path; + } + + public String getMethod() { + return method; + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..fb13945bd775 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..79955372fb33 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..75ddfa07d2cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,520 @@ +/* + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Animal.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BigCat", org.openapitools.client.model.BigCat.class); + classByDiscriminatorValue.put("Cat", org.openapitools.client.model.Cat.class); + classByDiscriminatorValue.put("Dog", org.openapitools.client.model.Dog.class); + classByDiscriminatorValue.put("Animal", org.openapitools.client.model.Animal.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.BigCat.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BigCat", org.openapitools.client.model.BigCat.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Cat.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BigCat", org.openapitools.client.model.BigCat.class); + classByDiscriminatorValue.put("Cat", org.openapitools.client.model.Cat.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Dog.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Dog", org.openapitools.client.model.Dog.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesAnyType.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesArray.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesBoolean.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesClass.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesInteger.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesNumber.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesObject.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesString.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayOfArrayOfNumberOnly.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayOfNumberOnly.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayTest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.BigCat.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Capitalization.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Category.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ClassModel.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Client.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Dog.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.EnumArrays.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.EnumTest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FileSchemaTestClass.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FormatTest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.HasOnlyReadOnly.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.MapTest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.MixedPropertiesAndAdditionalPropertiesClass.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Model200Response.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelApiResponse.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelFile.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelList.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelReturn.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Name.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NumberOnly.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Order.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.OuterComposite.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Pet.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ReadOnlyFirst.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.SpecialModelName.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Tag.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.TypeHolderDefault.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.TypeHolderExample.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.User.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.XmlItem.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..505e6f786f4c --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..924dd8668973 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..eee56669a4a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..1787a231e76b --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..bc81f54d83a6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..6473166843d5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/AnotherFakeApi.java new file mode 100644 index 000000000000..1be6cb8ba18d --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -0,0 +1,227 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiOperation; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.parameters.Parameter; + +import java.io.IOException; + + +import org.openapitools.client.model.Client; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AnotherFakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AnotherFakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public AnotherFakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for call123testSpecialTags + * @param uuidTest to test uuid example value (required) + * @param body client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsCall(@javax.annotation.Nonnull UUID uuidTest, @javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("call123testSpecialTags"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("uuid_test", uuidTest); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call call123testSpecialTagsValidateBeforeCall(@javax.annotation.Nonnull UUID uuidTest, @javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'uuidTest' is set + if (uuidTest == null) { + throw new ApiException("Missing the required parameter 'uuidTest' when calling call123testSpecialTags(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling call123testSpecialTags(Async)"); + } + + return call123testSpecialTagsCall(uuidTest, body, _callback); + + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param uuidTest to test uuid example value (required) + * @param body client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client call123testSpecialTags(@javax.annotation.Nonnull UUID uuidTest, @javax.annotation.Nonnull Client body) throws ApiException { + ApiResponse localVarResp = call123testSpecialTagsWithHttpInfo(uuidTest, body); + return localVarResp.getData(); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param uuidTest to test uuid example value (required) + * @param body client model (required) + * @return ApiResponse<Client> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull UUID uuidTest, @javax.annotation.Nonnull Client body) throws ApiException { + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(uuidTest, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test special tags (asynchronously) + * To test special tags and operation ID starting with number + * @param uuidTest to test uuid example value (required) + * @param body client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsAsync(@javax.annotation.Nonnull UUID uuidTest, @javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(uuidTest, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 000000000000..636cb8456870 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,2248 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiOperation; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.parameters.Parameter; + +import java.io.IOException; + + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.User; +import org.openapitools.client.model.XmlItem; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createXmlItem + * @param xmlItem XmlItem Body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call createXmlItemCall(@javax.annotation.Nonnull XmlItem xmlItem, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = xmlItem; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("createXmlItem"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/xml", + "application/xml; charset=utf-8", + "application/xml; charset=utf-16", + "text/xml", + "text/xml; charset=utf-8", + "text/xml; charset=utf-16" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createXmlItemValidateBeforeCall(@javax.annotation.Nonnull XmlItem xmlItem, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'xmlItem' is set + if (xmlItem == null) { + throw new ApiException("Missing the required parameter 'xmlItem' when calling createXmlItem(Async)"); + } + + return createXmlItemCall(xmlItem, _callback); + + } + + /** + * creates an XmlItem + * this route creates an XmlItem + * @param xmlItem XmlItem Body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void createXmlItem(@javax.annotation.Nonnull XmlItem xmlItem) throws ApiException { + createXmlItemWithHttpInfo(xmlItem); + } + + /** + * creates an XmlItem + * this route creates an XmlItem + * @param xmlItem XmlItem Body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse createXmlItemWithHttpInfo(@javax.annotation.Nonnull XmlItem xmlItem) throws ApiException { + okhttp3.Call localVarCall = createXmlItemValidateBeforeCall(xmlItem, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * creates an XmlItem (asynchronously) + * this route creates an XmlItem + * @param xmlItem XmlItem Body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call createXmlItemAsync(@javax.annotation.Nonnull XmlItem xmlItem, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createXmlItemValidateBeforeCall(xmlItem, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterBooleanSerialize + * @param body Input boolean as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeCall(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("fakeOuterBooleanSerialize"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterBooleanSerializeValidateBeforeCall(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + return fakeOuterBooleanSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public Boolean fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body) throws ApiException { + ApiResponse localVarResp = fakeOuterBooleanSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return ApiResponse<Boolean> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(@javax.annotation.Nullable Boolean body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterBooleanSerializeValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeAsync(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterBooleanSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterCompositeSerialize + * @param body Input composite as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeCall(@javax.annotation.Nullable OuterComposite body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("fakeOuterCompositeSerialize"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterCompositeSerializeValidateBeforeCall(@javax.annotation.Nullable OuterComposite body, final ApiCallback _callback) throws ApiException { + return fakeOuterCompositeSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public OuterComposite fakeOuterCompositeSerialize(@javax.annotation.Nullable OuterComposite body) throws ApiException { + ApiResponse localVarResp = fakeOuterCompositeSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return ApiResponse<OuterComposite> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(@javax.annotation.Nullable OuterComposite body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterCompositeSerializeValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeAsync(@javax.annotation.Nullable OuterComposite body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterCompositeSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterNumberSerialize + * @param body Input number as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeCall(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("fakeOuterNumberSerialize"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterNumberSerializeValidateBeforeCall(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + return fakeOuterNumberSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public BigDecimal fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal body) throws ApiException { + ApiResponse localVarResp = fakeOuterNumberSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return ApiResponse<BigDecimal> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public ApiResponse fakeOuterNumberSerializeWithHttpInfo(@javax.annotation.Nullable BigDecimal body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterNumberSerializeValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeAsync(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterNumberSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterStringSerialize + * @param body Input string as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeCall(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("fakeOuterStringSerialize"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterStringSerializeValidateBeforeCall(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + return fakeOuterStringSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public String fakeOuterStringSerialize(@javax.annotation.Nullable String body) throws ApiException { + ApiResponse localVarResp = fakeOuterStringSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public ApiResponse fakeOuterStringSerializeWithHttpInfo(@javax.annotation.Nullable String body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterStringSerializeValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeAsync(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterStringSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testBodyWithFileSchema + * @param body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaCall(@javax.annotation.Nonnull FileSchemaTestClass body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("testBodyWithFileSchema"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithFileSchemaValidateBeforeCall(@javax.annotation.Nonnull FileSchemaTestClass body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling testBodyWithFileSchema(Async)"); + } + + return testBodyWithFileSchemaCall(body, _callback); + + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithFileSchema(@javax.annotation.Nonnull FileSchemaTestClass body) throws ApiException { + testBodyWithFileSchemaWithHttpInfo(body); + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithFileSchemaWithHttpInfo(@javax.annotation.Nonnull FileSchemaTestClass body) throws ApiException { + okhttp3.Call localVarCall = testBodyWithFileSchemaValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * For this test, the body for this request much reference a schema named `File`. + * @param body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaAsync(@javax.annotation.Nonnull FileSchemaTestClass body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyWithFileSchemaValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testBodyWithQueryParams + * @param query (required) + * @param body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsCall(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("testBodyWithQueryParams"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("query", query); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithQueryParamsValidateBeforeCall(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException("Missing the required parameter 'query' when calling testBodyWithQueryParams(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling testBodyWithQueryParams(Async)"); + } + + return testBodyWithQueryParamsCall(query, body, _callback); + + } + + /** + * + * + * @param query (required) + * @param body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithQueryParams(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User body) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(query, body); + } + + /** + * + * + * @param query (required) + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User body) throws ApiException { + okhttp3.Call localVarCall = testBodyWithQueryParamsValidateBeforeCall(query, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param query (required) + * @param body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsAsync(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyWithQueryParamsValidateBeforeCall(query, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testClientModel + * @param body client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelCall(@javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("testClientModel"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClientModelValidateBeforeCall(@javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling testClientModel(Async)"); + } + + return testClientModelCall(body, _callback); + + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param body client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClientModel(@javax.annotation.Nonnull Client body) throws ApiException { + ApiResponse localVarResp = testClientModelWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param body client model (required) + * @return ApiResponse<Client> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClientModelWithHttpInfo(@javax.annotation.Nonnull Client body) throws ApiException { + okhttp3.Call localVarCall = testClientModelValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test \"client\" model (asynchronously) + * To test \"client\" model + * @param body client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelAsync(@javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testClientModelValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testEndpointParameters + * @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) + * @param password None (optional) + * @param paramCallback None (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersCall(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("testEndpointParameters"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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); + } + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "http_basic_test" }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEndpointParametersValidateBeforeCall(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException("Missing the required parameter 'number' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException("Missing the required parameter '_double' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) { + throw new ApiException("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException("Missing the required parameter '_byte' when calling testEndpointParameters(Async)"); + } + + return testEndpointParametersCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, _callback); + + } + + /** + * 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) + * @param password None (optional) + * @param paramCallback None (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable 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) + * @param password None (optional) + * @param paramCallback None (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse testEndpointParametersWithHttpInfo(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { + okhttp3.Call localVarCall = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 (asynchronously) + * 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) + * @param password None (optional) + * @param paramCallback None (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersAsync(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testEnumParameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersCall(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("testEnumParameters"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("enum_header_string_array", enumHeaderStringArray); + paramMap.put("enum_header_string", enumHeaderString); + paramMap.put("enum_query_string_array", enumQueryStringArray); + paramMap.put("enum_query_string", enumQueryString); + paramMap.put("enum_query_integer", enumQueryInteger); + paramMap.put("enum_query_double", enumQueryDouble); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (enumFormStringArray != null) { + localVarFormParams.put("enum_form_string_array", enumFormStringArray); + } + + if (enumFormString != null) { + localVarFormParams.put("enum_form_string", enumFormString); + } + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEnumParametersValidateBeforeCall(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + return testEnumParametersCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, _callback); + + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public void testEnumParameters(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable 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) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public ApiResponse testEnumParametersWithHttpInfo(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString) throws ApiException { + okhttp3.Call localVarCall = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * To test enum parameters (asynchronously) + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersAsync(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + private okhttp3.Call testGroupParametersCall(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("testGroupParameters"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("required_string_group", requiredStringGroup); + paramMap.put("required_boolean_group", requiredBooleanGroup); + paramMap.put("required_int64_group", requiredInt64Group); + paramMap.put("string_group", stringGroup); + paramMap.put("boolean_group", booleanGroup); + paramMap.put("int64_group", int64Group); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testGroupParametersValidateBeforeCall(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requiredStringGroup' is set + if (requiredStringGroup == null) { + throw new ApiException("Missing the required parameter 'requiredStringGroup' when calling testGroupParameters(Async)"); + } + + // verify the required parameter 'requiredBooleanGroup' is set + if (requiredBooleanGroup == null) { + throw new ApiException("Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters(Async)"); + } + + // verify the required parameter 'requiredInt64Group' is set + if (requiredInt64Group == null) { + throw new ApiException("Missing the required parameter 'requiredInt64Group' when calling testGroupParameters(Async)"); + } + + return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + + } + + + private ApiResponse testGroupParametersWithHttpInfo(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { + okhttp3.Call localVarCall = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call testGroupParametersAsync(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APItestGroupParametersRequest { + @javax.annotation.Nonnull + private final Integer requiredStringGroup; + @javax.annotation.Nonnull + private final Boolean requiredBooleanGroup; + @javax.annotation.Nonnull + private final Long requiredInt64Group; + @javax.annotation.Nullable + private Integer stringGroup; + @javax.annotation.Nullable + private Boolean booleanGroup; + @javax.annotation.Nullable + private Long int64Group; + + private APItestGroupParametersRequest(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group) { + this.requiredStringGroup = requiredStringGroup; + this.requiredBooleanGroup = requiredBooleanGroup; + this.requiredInt64Group = requiredInt64Group; + } + + /** + * Set stringGroup + * @param stringGroup String in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest stringGroup(@javax.annotation.Nullable Integer stringGroup) { + this.stringGroup = stringGroup; + return this; + } + + /** + * Set booleanGroup + * @param booleanGroup Boolean in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest booleanGroup(@javax.annotation.Nullable Boolean booleanGroup) { + this.booleanGroup = booleanGroup; + return this; + } + + /** + * Set int64Group + * @param int64Group Integer in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest int64Group(@javax.annotation.Nullable Long int64Group) { + this.int64Group = int64Group; + return this; + } + + /** + * Build call for testGroupParameters + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + } + + /** + * Execute testGroupParameters request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public void execute() throws ApiException { + testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /** + * Execute testGroupParameters request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /** + * Execute testGroupParameters request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return testGroupParametersAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + } + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @return APItestGroupParametersRequest + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public APItestGroupParametersRequest testGroupParameters(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group) { + return new APItestGroupParametersRequest(requiredStringGroup, requiredBooleanGroup, requiredInt64Group); + } + /** + * Build call for testInlineAdditionalProperties + * @param param request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineAdditionalPropertiesCall(@javax.annotation.Nonnull Map param, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = param; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("testInlineAdditionalProperties"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testInlineAdditionalPropertiesValidateBeforeCall(@javax.annotation.Nonnull Map param, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'param' is set + if (param == null) { + throw new ApiException("Missing the required parameter 'param' when calling testInlineAdditionalProperties(Async)"); + } + + return testInlineAdditionalPropertiesCall(param, _callback); + + } + + /** + * test inline additionalProperties + * + * @param param request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testInlineAdditionalProperties(@javax.annotation.Nonnull Map param) throws ApiException { + testInlineAdditionalPropertiesWithHttpInfo(param); + } + + /** + * test inline additionalProperties + * + * @param param request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull Map param) throws ApiException { + okhttp3.Call localVarCall = testInlineAdditionalPropertiesValidateBeforeCall(param, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test inline additionalProperties (asynchronously) + * + * @param param request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineAdditionalPropertiesAsync(@javax.annotation.Nonnull Map param, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testInlineAdditionalPropertiesValidateBeforeCall(param, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testJsonFormData + * @param param field1 (required) + * @param param2 field2 (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testJsonFormDataCall(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("testJsonFormData"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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); + } + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testJsonFormDataValidateBeforeCall(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'param' is set + if (param == null) { + throw new ApiException("Missing the required parameter 'param' when calling testJsonFormData(Async)"); + } + + // verify the required parameter 'param2' is set + if (param2 == null) { + throw new ApiException("Missing the required parameter 'param2' when calling testJsonFormData(Async)"); + } + + return testJsonFormDataCall(param, param2, _callback); + + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testJsonFormData(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testJsonFormDataWithHttpInfo(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { + okhttp3.Call localVarCall = testJsonFormDataValidateBeforeCall(param, param2, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test json serialization of form data (asynchronously) + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testJsonFormDataAsync(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testJsonFormDataValidateBeforeCall(param, param2, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testQueryParameterCollectionFormat + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testQueryParameterCollectionFormatCall(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("testQueryParameterCollectionFormat"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("pipe", pipe); + paramMap.put("ioutil", ioutil); + paramMap.put("http", http); + paramMap.put("url", url); + paramMap.put("context", context); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryParameterCollectionFormatValidateBeforeCall(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pipe' is set + if (pipe == null) { + throw new ApiException("Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) { + throw new ApiException("Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'http' is set + if (http == null) { + throw new ApiException("Missing the required parameter 'http' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'url' is set + if (url == null) { + throw new ApiException("Missing the required parameter 'url' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'context' is set + if (context == null) { + throw new ApiException("Missing the required parameter 'context' when calling testQueryParameterCollectionFormat(Async)"); + } + + return testQueryParameterCollectionFormatCall(pipe, ioutil, http, url, context, _callback); + + } + + /** + * + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testQueryParameterCollectionFormat(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testQueryParameterCollectionFormatAsync(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java new file mode 100644 index 000000000000..21360f5627b1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,216 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiOperation; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.parameters.Parameter; + +import java.io.IOException; + + +import org.openapitools.client.model.Client; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeClassnameTags123Api { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for testClassname + * @param body client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameCall(@javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("testClassname"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key_query" }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClassnameValidateBeforeCall(@javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling testClassname(Async)"); + } + + return testClassnameCall(body, _callback); + + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param body client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClassname(@javax.annotation.Nonnull Client body) throws ApiException { + ApiResponse localVarResp = testClassnameWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param body client model (required) + * @return ApiResponse<Client> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClassnameWithHttpInfo(@javax.annotation.Nonnull Client body) throws ApiException { + okhttp3.Call localVarCall = testClassnameValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test class name in snake case (asynchronously) + * To test class name in snake case + * @param body client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameAsync(@javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testClassnameValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..85861c54411c --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1398 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiOperation; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.parameters.Parameter; + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import java.util.Set; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PetApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addPet + * @param body Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call addPetCall(@javax.annotation.Nonnull Pet body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("addPet"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addPetValidateBeforeCall(@javax.annotation.Nonnull Pet body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling addPet(Async)"); + } + + return addPetCall(body, _callback); + + } + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public void addPet(@javax.annotation.Nonnull Pet body) throws ApiException { + addPetWithHttpInfo(body); + } + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet body) throws ApiException { + okhttp3.Call localVarCall = addPetValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Add a new pet to the store (asynchronously) + * + * @param body Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call addPetAsync(@javax.annotation.Nonnull Pet body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addPetValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deletePet + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("deletePet"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("petId", petId); + paramMap.put("api_key", apiKey); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePetValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); + } + + return deletePetCall(petId, apiKey, _callback); + + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
+ */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deletes a pet (asynchronously) + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for findPetsByStatus + * @param status Status values that need to be considered for filter (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("findPetsByStatus"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("status", status); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByStatusValidateBeforeCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + + return findPetsByStatusCall(status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + ApiResponse> localVarResp = findPetsByStatusWithHttpInfo(status); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by status (asynchronously) + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusAsync(@javax.annotation.Nonnull List status, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for findPetsByTags + * @param tags Tags to filter by (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsCall(@javax.annotation.Nonnull Set tags, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("findPetsByTags"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("tags", tags); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByTagsValidateBeforeCall(@javax.annotation.Nonnull Set tags, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); + } + + return findPetsByTagsCall(tags, _callback); + + } + + /** + * 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 Set<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public Set findPetsByTags(@javax.annotation.Nonnull Set tags) throws ApiException { + ApiResponse> localVarResp = findPetsByTagsWithHttpInfo(tags); + return localVarResp.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<Set<Pet>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull Set tags) throws ApiException { + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by tags (asynchronously) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsAsync(@javax.annotation.Nonnull Set tags, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPetById + * @param petId ID of pet to return (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("getPetById"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("petId", petId); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + return getPetByIdCall(petId, _callback); + + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + ApiResponse localVarResp = getPetByIdWithHttpInfo(petId); + return localVarResp.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find pet by ID (asynchronously) + * Returns a single pet + * @param petId ID of pet to return (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdAsync(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePet + * @param body Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetCall(@javax.annotation.Nonnull Pet body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("updatePet"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetValidateBeforeCall(@javax.annotation.Nonnull Pet body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updatePet(Async)"); + } + + return updatePetCall(body, _callback); + + } + + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public void updatePet(@javax.annotation.Nonnull Pet body) throws ApiException { + updatePetWithHttpInfo(body); + } + + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet body) throws ApiException { + okhttp3.Call localVarCall = updatePetValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update an existing pet (asynchronously) + * + * @param body Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetAsync(@javax.annotation.Nonnull Pet body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updatePetWithForm + * @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) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("updatePetWithForm"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("petId", petId); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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); + } + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetWithFormValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); + } + + return updatePetWithFormCall(petId, name, status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updates a pet in the store with form data (asynchronously) + * + * @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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for uploadFile + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("uploadFile"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("petId", petId); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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); + } + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); + } + + return uploadFileCall(petId, additionalMetadata, _file, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = uploadFileWithHttpInfo(petId, additionalMetadata, _file); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (asynchronously) + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for uploadFileWithRequiredFile + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("uploadFileWithRequiredFile"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("petId", petId); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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); + } + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileWithRequiredFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFileWithRequiredFile(Async)"); + } + + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) { + throw new ApiException("Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile(Async)"); + } + + return uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + ApiResponse localVarResp = uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (required) (asynchronously) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..8d537390e39e --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,627 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiOperation; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.parameters.Parameter; + +import java.io.IOException; + + +import org.openapitools.client.model.Order; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class StoreApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteOrder + * @param orderId ID of the order that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("deleteOrder"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("order_id", orderId); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOrderValidateBeforeCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); + } + + return deleteOrderCall(orderId, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete purchase order by ID (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderAsync(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getInventory + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("getInventory"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getInventoryCall(_callback); + + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Map getInventory() throws ApiException { + ApiResponse> localVarResp = getInventoryWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Returns pet inventories by status (asynchronously) + * Returns a map of status codes to quantities + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderById + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("getOrderById"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("order_id", orderId); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderByIdValidateBeforeCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); + } + + return getOrderByIdCall(orderId, _callback); + + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + ApiResponse localVarResp = getOrderByIdWithHttpInfo(orderId); + return localVarResp.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find purchase order by ID (asynchronously) + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdAsync(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for placeOrder + * @param body order placed for purchasing the pet (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderCall(@javax.annotation.Nonnull Order body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("placeOrder"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(@javax.annotation.Nonnull Order body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling placeOrder(Async)"); + } + + return placeOrderCall(body, _callback); + + } + + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(@javax.annotation.Nonnull Order body) throws ApiException { + ApiResponse localVarResp = placeOrderWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order body) throws ApiException { + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Place an order for a pet (asynchronously) + * + * @param body order placed for purchasing the pet (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderAsync(@javax.annotation.Nonnull Order body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..44aabc0bc2b1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,1162 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiOperation; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.parameters.Parameter; + +import java.io.IOException; + + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UserApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createUser + * @param body Created user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserCall(@javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("createUser"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUserValidateBeforeCall(@javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling createUser(Async)"); + } + + return createUserCall(body, _callback); + + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(@javax.annotation.Nonnull User body) throws ApiException { + createUserWithHttpInfo(body); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User body) throws ApiException { + okhttp3.Call localVarCall = createUserValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create user (asynchronously) + * This can only be done by the logged in user. + * @param body Created user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserAsync(@javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUserValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithArrayInput + * @param body List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputCall(@javax.annotation.Nonnull List body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("createUsersWithArrayInput"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(@javax.annotation.Nonnull List body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling createUsersWithArrayInput(Async)"); + } + + return createUsersWithArrayInputCall(body, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull List body) throws ApiException { + createUsersWithArrayInputWithHttpInfo(body); + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List body) throws ApiException { + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param body List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputAsync(@javax.annotation.Nonnull List body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithListInput + * @param body List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputCall(@javax.annotation.Nonnull List body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("createUsersWithListInput"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithListInputValidateBeforeCall(@javax.annotation.Nonnull List body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling createUsersWithListInput(Async)"); + } + + return createUsersWithListInputCall(body, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(@javax.annotation.Nonnull List body) throws ApiException { + createUsersWithListInputWithHttpInfo(body); + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List body) throws ApiException { + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param body List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputAsync(@javax.annotation.Nonnull List body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteUser + * @param username The name that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("deleteUser"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("username", username); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteUserValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); + } + + return deleteUserCall(username, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete user (asynchronously) + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getUserByName + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("getUserByName"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("username", username); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByNameValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); + } + + return getUserByNameCall(username, _callback); + + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + ApiResponse localVarResp = getUserByNameWithHttpInfo(username); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get user by user name (asynchronously) + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for loginUser + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
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 okhttp3.Call loginUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("loginUser"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("username", username); + paramMap.put("password", password); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call loginUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); + } + + return loginUserCall(username, password, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + ApiResponse localVarResp = loginUserWithHttpInfo(username, password); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Logs user into the system (asynchronously) + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
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 okhttp3.Call loginUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for logoutUser + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("logoutUser"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return logoutUserCall(_callback); + + } + + /** + * Logs out current logged in user session + * + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Logs out current logged in user session (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateUser + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("updateUser"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + paramMap.put("username", username); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, apiOperation.getMethod(), localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updateUser(Async)"); + } + + return updateUserCall(username, body, _callback); + + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User body) throws ApiException { + updateUserWithHttpInfo(username, body); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User body) throws ApiException { + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updated user (asynchronously) + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..ed5f5fbc16ef --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..bd5e463d0b42 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..f655936f3a78 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..5aff174aff81 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..6f945f45ed46 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,43 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..59009502c11e --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * 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; + +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..cefbf4af907b --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * 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 okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..5521ee31599c --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * 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.ApiException; +import org.openapitools.client.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..fc0f2c973b8d --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.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 org.openapitools.client.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java new file mode 100644 index 000000000000..11ff508eff98 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -0,0 +1,284 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesAnyType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesAnyType { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesAnyType() { + } + + public AdditionalPropertiesAnyType name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesAnyType instance itself + */ + public AdditionalPropertiesAnyType putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o; + return Objects.equals(this.name, additionalPropertiesAnyType.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesAnyType.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesAnyType {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesAnyType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesAnyType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesAnyType is not found in the empty JSON string", AdditionalPropertiesAnyType.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesAnyType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesAnyType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesAnyType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesAnyType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesAnyType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesAnyType instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesAnyType given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesAnyType + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesAnyType + */ + public static AdditionalPropertiesAnyType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesAnyType.class); + } + + /** + * Convert an instance of AdditionalPropertiesAnyType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java new file mode 100644 index 000000000000..522143d1ddd1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -0,0 +1,285 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesArray + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesArray { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesArray() { + } + + public AdditionalPropertiesArray name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesArray instance itself + */ + public AdditionalPropertiesArray putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesArray additionalPropertiesArray = (AdditionalPropertiesArray) o; + return Objects.equals(this.name, additionalPropertiesArray.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesArray.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesArray {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesArray + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesArray.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesArray is not found in the empty JSON string", AdditionalPropertiesArray.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesArray.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesArray' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesArray.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesArray value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesArray read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesArray instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesArray given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesArray + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesArray + */ + public static AdditionalPropertiesArray fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesArray.class); + } + + /** + * Convert an instance of AdditionalPropertiesArray to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java new file mode 100644 index 000000000000..f32945dec0a9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -0,0 +1,284 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesBoolean + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesBoolean { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesBoolean() { + } + + public AdditionalPropertiesBoolean name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesBoolean instance itself + */ + public AdditionalPropertiesBoolean putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesBoolean additionalPropertiesBoolean = (AdditionalPropertiesBoolean) o; + return Objects.equals(this.name, additionalPropertiesBoolean.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesBoolean.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesBoolean {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesBoolean + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesBoolean.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesBoolean is not found in the empty JSON string", AdditionalPropertiesBoolean.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesBoolean.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesBoolean' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesBoolean.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesBoolean value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesBoolean read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesBoolean instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesBoolean given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesBoolean + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesBoolean + */ + public static AdditionalPropertiesBoolean fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesBoolean.class); + } + + /** + * Convert an instance of AdditionalPropertiesBoolean to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..0716e90f143a --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesClass { + public static final String SERIALIZED_NAME_MAP_STRING = "map_string"; + @SerializedName(SERIALIZED_NAME_MAP_STRING) + @javax.annotation.Nullable + private Map mapString = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_NUMBER = "map_number"; + @SerializedName(SERIALIZED_NAME_MAP_NUMBER) + @javax.annotation.Nullable + private Map mapNumber = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_INTEGER = "map_integer"; + @SerializedName(SERIALIZED_NAME_MAP_INTEGER) + @javax.annotation.Nullable + private Map mapInteger = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_BOOLEAN = "map_boolean"; + @SerializedName(SERIALIZED_NAME_MAP_BOOLEAN) + @javax.annotation.Nullable + private Map mapBoolean = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_ARRAY_INTEGER = "map_array_integer"; + @SerializedName(SERIALIZED_NAME_MAP_ARRAY_INTEGER) + @javax.annotation.Nullable + private Map> mapArrayInteger = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_ARRAY_ANYTYPE = "map_array_anytype"; + @SerializedName(SERIALIZED_NAME_MAP_ARRAY_ANYTYPE) + @javax.annotation.Nullable + private Map> mapArrayAnytype = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_MAP_STRING = "map_map_string"; + @SerializedName(SERIALIZED_NAME_MAP_MAP_STRING) + @javax.annotation.Nullable + private Map> mapMapString = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_MAP_ANYTYPE = "map_map_anytype"; + @SerializedName(SERIALIZED_NAME_MAP_MAP_ANYTYPE) + @javax.annotation.Nullable + private Map> mapMapAnytype = new HashMap<>(); + + public static final String SERIALIZED_NAME_ANYTYPE1 = "anytype_1"; + @SerializedName(SERIALIZED_NAME_ANYTYPE1) + @javax.annotation.Nullable + private Object anytype1; + + public static final String SERIALIZED_NAME_ANYTYPE2 = "anytype_2"; + @SerializedName(SERIALIZED_NAME_ANYTYPE2) + @javax.annotation.Nullable + private Object anytype2; + + public static final String SERIALIZED_NAME_ANYTYPE3 = "anytype_3"; + @SerializedName(SERIALIZED_NAME_ANYTYPE3) + @javax.annotation.Nullable + private Object anytype3; + + public AdditionalPropertiesClass() { + } + + public AdditionalPropertiesClass mapString(@javax.annotation.Nullable Map mapString) { + this.mapString = mapString; + return this; + } + + public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { + if (this.mapString == null) { + this.mapString = new HashMap<>(); + } + this.mapString.put(key, mapStringItem); + return this; + } + + /** + * Get mapString + * @return mapString + */ + @javax.annotation.Nullable + + public Map getMapString() { + return mapString; + } + + public void setMapString(@javax.annotation.Nullable Map mapString) { + this.mapString = mapString; + } + + + public AdditionalPropertiesClass mapNumber(@javax.annotation.Nullable Map mapNumber) { + this.mapNumber = mapNumber; + return this; + } + + public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { + if (this.mapNumber == null) { + this.mapNumber = new HashMap<>(); + } + this.mapNumber.put(key, mapNumberItem); + return this; + } + + /** + * Get mapNumber + * @return mapNumber + */ + @javax.annotation.Nullable + + public Map getMapNumber() { + return mapNumber; + } + + public void setMapNumber(@javax.annotation.Nullable Map mapNumber) { + this.mapNumber = mapNumber; + } + + + public AdditionalPropertiesClass mapInteger(@javax.annotation.Nullable Map mapInteger) { + this.mapInteger = mapInteger; + return this; + } + + public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { + if (this.mapInteger == null) { + this.mapInteger = new HashMap<>(); + } + this.mapInteger.put(key, mapIntegerItem); + return this; + } + + /** + * Get mapInteger + * @return mapInteger + */ + @javax.annotation.Nullable + + public Map getMapInteger() { + return mapInteger; + } + + public void setMapInteger(@javax.annotation.Nullable Map mapInteger) { + this.mapInteger = mapInteger; + } + + + public AdditionalPropertiesClass mapBoolean(@javax.annotation.Nullable Map mapBoolean) { + this.mapBoolean = mapBoolean; + return this; + } + + public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { + if (this.mapBoolean == null) { + this.mapBoolean = new HashMap<>(); + } + this.mapBoolean.put(key, mapBooleanItem); + return this; + } + + /** + * Get mapBoolean + * @return mapBoolean + */ + @javax.annotation.Nullable + + public Map getMapBoolean() { + return mapBoolean; + } + + public void setMapBoolean(@javax.annotation.Nullable Map mapBoolean) { + this.mapBoolean = mapBoolean; + } + + + public AdditionalPropertiesClass mapArrayInteger(@javax.annotation.Nullable Map> mapArrayInteger) { + this.mapArrayInteger = mapArrayInteger; + return this; + } + + public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { + if (this.mapArrayInteger == null) { + this.mapArrayInteger = new HashMap<>(); + } + this.mapArrayInteger.put(key, mapArrayIntegerItem); + return this; + } + + /** + * Get mapArrayInteger + * @return mapArrayInteger + */ + @javax.annotation.Nullable + + public Map> getMapArrayInteger() { + return mapArrayInteger; + } + + public void setMapArrayInteger(@javax.annotation.Nullable Map> mapArrayInteger) { + this.mapArrayInteger = mapArrayInteger; + } + + + public AdditionalPropertiesClass mapArrayAnytype(@javax.annotation.Nullable Map> mapArrayAnytype) { + this.mapArrayAnytype = mapArrayAnytype; + return this; + } + + public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { + if (this.mapArrayAnytype == null) { + this.mapArrayAnytype = new HashMap<>(); + } + this.mapArrayAnytype.put(key, mapArrayAnytypeItem); + return this; + } + + /** + * Get mapArrayAnytype + * @return mapArrayAnytype + */ + @javax.annotation.Nullable + + public Map> getMapArrayAnytype() { + return mapArrayAnytype; + } + + public void setMapArrayAnytype(@javax.annotation.Nullable Map> mapArrayAnytype) { + this.mapArrayAnytype = mapArrayAnytype; + } + + + public AdditionalPropertiesClass mapMapString(@javax.annotation.Nullable Map> mapMapString) { + this.mapMapString = mapMapString; + return this; + } + + public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { + if (this.mapMapString == null) { + this.mapMapString = new HashMap<>(); + } + this.mapMapString.put(key, mapMapStringItem); + return this; + } + + /** + * Get mapMapString + * @return mapMapString + */ + @javax.annotation.Nullable + + public Map> getMapMapString() { + return mapMapString; + } + + public void setMapMapString(@javax.annotation.Nullable Map> mapMapString) { + this.mapMapString = mapMapString; + } + + + public AdditionalPropertiesClass mapMapAnytype(@javax.annotation.Nullable Map> mapMapAnytype) { + this.mapMapAnytype = mapMapAnytype; + return this; + } + + public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { + if (this.mapMapAnytype == null) { + this.mapMapAnytype = new HashMap<>(); + } + this.mapMapAnytype.put(key, mapMapAnytypeItem); + return this; + } + + /** + * Get mapMapAnytype + * @return mapMapAnytype + */ + @javax.annotation.Nullable + + public Map> getMapMapAnytype() { + return mapMapAnytype; + } + + public void setMapMapAnytype(@javax.annotation.Nullable Map> mapMapAnytype) { + this.mapMapAnytype = mapMapAnytype; + } + + + public AdditionalPropertiesClass anytype1(@javax.annotation.Nullable Object anytype1) { + this.anytype1 = anytype1; + return this; + } + + /** + * Get anytype1 + * @return anytype1 + */ + @javax.annotation.Nullable + + public Object getAnytype1() { + return anytype1; + } + + public void setAnytype1(@javax.annotation.Nullable Object anytype1) { + this.anytype1 = anytype1; + } + + + public AdditionalPropertiesClass anytype2(@javax.annotation.Nullable Object anytype2) { + this.anytype2 = anytype2; + return this; + } + + /** + * Get anytype2 + * @return anytype2 + */ + @javax.annotation.Nullable + + public Object getAnytype2() { + return anytype2; + } + + public void setAnytype2(@javax.annotation.Nullable Object anytype2) { + this.anytype2 = anytype2; + } + + + public AdditionalPropertiesClass anytype3(@javax.annotation.Nullable Object anytype3) { + this.anytype3 = anytype3; + return this; + } + + /** + * Get anytype3 + * @return anytype3 + */ + @javax.annotation.Nullable + + public Object getAnytype3() { + return anytype3; + } + + public void setAnytype3(@javax.annotation.Nullable Object anytype3) { + this.anytype3 = anytype3; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesClass instance itself + */ + public AdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapString, additionalPropertiesClass.mapString) && + Objects.equals(this.mapNumber, additionalPropertiesClass.mapNumber) && + Objects.equals(this.mapInteger, additionalPropertiesClass.mapInteger) && + Objects.equals(this.mapBoolean, additionalPropertiesClass.mapBoolean) && + Objects.equals(this.mapArrayInteger, additionalPropertiesClass.mapArrayInteger) && + Objects.equals(this.mapArrayAnytype, additionalPropertiesClass.mapArrayAnytype) && + Objects.equals(this.mapMapString, additionalPropertiesClass.mapMapString) && + Objects.equals(this.mapMapAnytype, additionalPropertiesClass.mapMapAnytype) && + Objects.equals(this.anytype1, additionalPropertiesClass.anytype1) && + Objects.equals(this.anytype2, additionalPropertiesClass.anytype2) && + Objects.equals(this.anytype3, additionalPropertiesClass.anytype3)&& + Objects.equals(this.additionalProperties, additionalPropertiesClass.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + sb.append(" mapString: ").append(toIndentedString(mapString)).append("\n"); + sb.append(" mapNumber: ").append(toIndentedString(mapNumber)).append("\n"); + sb.append(" mapInteger: ").append(toIndentedString(mapInteger)).append("\n"); + sb.append(" mapBoolean: ").append(toIndentedString(mapBoolean)).append("\n"); + sb.append(" mapArrayInteger: ").append(toIndentedString(mapArrayInteger)).append("\n"); + sb.append(" mapArrayAnytype: ").append(toIndentedString(mapArrayAnytype)).append("\n"); + sb.append(" mapMapString: ").append(toIndentedString(mapMapString)).append("\n"); + sb.append(" mapMapAnytype: ").append(toIndentedString(mapMapAnytype)).append("\n"); + sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n"); + sb.append(" anytype2: ").append(toIndentedString(anytype2)).append("\n"); + sb.append(" anytype3: ").append(toIndentedString(anytype3)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("map_string", "map_number", "map_integer", "map_boolean", "map_array_integer", "map_array_anytype", "map_map_string", "map_map_anytype", "anytype_1", "anytype_2", "anytype_3")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesClass + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesClass is not found in the empty JSON string", AdditionalPropertiesClass.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesClass.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesClass value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesClass read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesClass + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesClass + */ + public static AdditionalPropertiesClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesClass.class); + } + + /** + * Convert an instance of AdditionalPropertiesClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java new file mode 100644 index 000000000000..b6ad65a3d93b --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -0,0 +1,284 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesInteger + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesInteger { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesInteger() { + } + + public AdditionalPropertiesInteger name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesInteger instance itself + */ + public AdditionalPropertiesInteger putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesInteger additionalPropertiesInteger = (AdditionalPropertiesInteger) o; + return Objects.equals(this.name, additionalPropertiesInteger.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesInteger.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesInteger {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesInteger + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesInteger.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesInteger is not found in the empty JSON string", AdditionalPropertiesInteger.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesInteger.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesInteger' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesInteger.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesInteger value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesInteger read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesInteger instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesInteger given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesInteger + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesInteger + */ + public static AdditionalPropertiesInteger fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesInteger.class); + } + + /** + * Convert an instance of AdditionalPropertiesInteger to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java new file mode 100644 index 000000000000..e7e8fb3e2d97 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -0,0 +1,285 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesNumber + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesNumber { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesNumber() { + } + + public AdditionalPropertiesNumber name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesNumber instance itself + */ + public AdditionalPropertiesNumber putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesNumber additionalPropertiesNumber = (AdditionalPropertiesNumber) o; + return Objects.equals(this.name, additionalPropertiesNumber.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesNumber.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesNumber {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesNumber + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesNumber.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesNumber is not found in the empty JSON string", AdditionalPropertiesNumber.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesNumber.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesNumber' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesNumber.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesNumber value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesNumber read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesNumber instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesNumber given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesNumber + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesNumber + */ + public static AdditionalPropertiesNumber fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesNumber.class); + } + + /** + * Convert an instance of AdditionalPropertiesNumber to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java new file mode 100644 index 000000000000..e6c30e208bcb --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -0,0 +1,285 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesObject + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesObject { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesObject() { + } + + public AdditionalPropertiesObject name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesObject instance itself + */ + public AdditionalPropertiesObject putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesObject additionalPropertiesObject = (AdditionalPropertiesObject) o; + return Objects.equals(this.name, additionalPropertiesObject.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesObject.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesObject {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesObject + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesObject.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesObject is not found in the empty JSON string", AdditionalPropertiesObject.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesObject.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesObject' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesObject.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesObject value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesObject read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesObject instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesObject given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesObject + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesObject + */ + public static AdditionalPropertiesObject fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesObject.class); + } + + /** + * Convert an instance of AdditionalPropertiesObject to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java new file mode 100644 index 000000000000..602531acecbd --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -0,0 +1,284 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesString + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesString { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesString() { + } + + public AdditionalPropertiesString name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesString instance itself + */ + public AdditionalPropertiesString putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesString additionalPropertiesString = (AdditionalPropertiesString) o; + return Objects.equals(this.name, additionalPropertiesString.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesString.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesString {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesString + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesString.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesString is not found in the empty JSON string", AdditionalPropertiesString.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesString.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesString' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesString.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesString value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesString read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesString instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesString given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesString + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesString + */ + public static AdditionalPropertiesString fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesString.class); + } + + /** + * Convert an instance of AdditionalPropertiesString to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 000000000000..863dc4f2c6af --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java @@ -0,0 +1,252 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Animal + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Animal { + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @SerializedName(SERIALIZED_NAME_CLASS_NAME) + @javax.annotation.Nonnull + protected String className; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + @javax.annotation.Nullable + private String color = "red"; + + public Animal() { + this.className = this.getClass().getSimpleName(); + } + + public Animal className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + + public String getClassName() { + return className; + } + + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + + public Animal color(@javax.annotation.Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @javax.annotation.Nullable + + public String getColor() { + return color; + } + + public void setColor(@javax.annotation.Nullable String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Animal instance itself + */ + public Animal putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, animal.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(className, color, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Animal + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Animal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Animal is not found in the empty JSON string", Animal.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("className").getAsString(); + switch (discriminatorValue) { + case "BigCat": + BigCat.validateJsonElement(jsonElement); + break; + case "Cat": + Cat.validateJsonElement(jsonElement); + break; + case "Dog": + Dog.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The value of the `className` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Animal given an JSON string + * + * @param jsonString JSON string + * @return An instance of Animal + * @throws IOException if the JSON string is invalid with respect to Animal + */ + public static Animal fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Animal.class); + } + + /** + * Convert an instance of Animal to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..9fa11c1dec04 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,297 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfArrayOfNumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOfArrayOfNumberOnly { + public static final String SERIALIZED_NAME_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_NUMBER) + @javax.annotation.Nullable + private List> arrayArrayNumber = new ArrayList<>(); + + public ArrayOfArrayOfNumberOnly() { + } + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(@javax.annotation.Nullable 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 + + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + public void setArrayArrayNumber(@javax.annotation.Nullable List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfArrayOfNumberOnly instance itself + */ + public ArrayOfArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, arrayOfArrayOfNumberOnly.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ArrayArrayNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayOfArrayOfNumberOnly + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayOfArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayOfArrayOfNumberOnly is not found in the empty JSON string", ArrayOfArrayOfNumberOnly.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("ArrayArrayNumber") != null && !jsonObj.get("ArrayArrayNumber").isJsonNull() && !jsonObj.get("ArrayArrayNumber").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `ArrayArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayArrayNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayOfArrayOfNumberOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayOfArrayOfNumberOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayOfArrayOfNumberOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayOfArrayOfNumberOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ArrayOfArrayOfNumberOnly read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayOfArrayOfNumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayOfArrayOfNumberOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayOfArrayOfNumberOnly + * @throws IOException if the JSON string is invalid with respect to ArrayOfArrayOfNumberOnly + */ + public static ArrayOfArrayOfNumberOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayOfArrayOfNumberOnly.class); + } + + /** + * Convert an instance of ArrayOfArrayOfNumberOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..54bc3dab245c --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -0,0 +1,297 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfNumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOfNumberOnly { + public static final String SERIALIZED_NAME_ARRAY_NUMBER = "ArrayNumber"; + @SerializedName(SERIALIZED_NAME_ARRAY_NUMBER) + @javax.annotation.Nullable + private List arrayNumber = new ArrayList<>(); + + public ArrayOfNumberOnly() { + } + + public ArrayOfNumberOnly arrayNumber(@javax.annotation.Nullable 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 + + public List getArrayNumber() { + return arrayNumber; + } + + public void setArrayNumber(@javax.annotation.Nullable List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfNumberOnly instance itself + */ + public ArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, arrayOfNumberOnly.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ArrayNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayOfNumberOnly + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayOfNumberOnly is not found in the empty JSON string", ArrayOfNumberOnly.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("ArrayNumber") != null && !jsonObj.get("ArrayNumber").isJsonNull() && !jsonObj.get("ArrayNumber").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `ArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayOfNumberOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayOfNumberOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayOfNumberOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayOfNumberOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ArrayOfNumberOnly read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayOfNumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayOfNumberOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayOfNumberOnly + * @throws IOException if the JSON string is invalid with respect to ArrayOfNumberOnly + */ + public static ArrayOfNumberOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayOfNumberOnly.class); + } + + /** + * Convert an instance of ArrayOfNumberOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java new file mode 100644 index 000000000000..0b15754916be --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -0,0 +1,375 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayTest { + public static final String SERIALIZED_NAME_ARRAY_OF_STRING = "array_of_string"; + @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRING) + @javax.annotation.Nullable + private List arrayOfString = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_OF_INTEGER) + @javax.annotation.Nullable + private List> arrayArrayOfInteger = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL) + @javax.annotation.Nullable + private List> arrayArrayOfModel = new ArrayList<>(); + + public ArrayTest() { + } + + public ArrayTest arrayOfString(@javax.annotation.Nullable 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 + + public List getArrayOfString() { + return arrayOfString; + } + + public void setArrayOfString(@javax.annotation.Nullable List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + + public ArrayTest arrayArrayOfInteger(@javax.annotation.Nullable 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 + + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + public void setArrayArrayOfInteger(@javax.annotation.Nullable List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + + public ArrayTest arrayArrayOfModel(@javax.annotation.Nullable 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 + + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + public void setArrayArrayOfModel(@javax.annotation.Nullable List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayTest instance itself + */ + public ArrayTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, arrayTest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("array_of_string", "array_array_of_integer", "array_array_of_model")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayTest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayTest is not found in the empty JSON string", ArrayTest.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("array_of_string") != null && !jsonObj.get("array_of_string").isJsonNull() && !jsonObj.get("array_of_string").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_of_string` to be an array in the JSON string but got `%s`", jsonObj.get("array_of_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_array_of_integer") != null && !jsonObj.get("array_array_of_integer").isJsonNull() && !jsonObj.get("array_array_of_integer").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_array_of_integer` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_integer").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_array_of_model") != null && !jsonObj.get("array_array_of_model").isJsonNull() && !jsonObj.get("array_array_of_model").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_array_of_model` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_model").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayTest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayTest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayTest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayTest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ArrayTest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayTest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayTest + * @throws IOException if the JSON string is invalid with respect to ArrayTest + */ + public static ArrayTest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayTest.class); + } + + /** + * Convert an instance of ArrayTest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 000000000000..86dde9e1b54a --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,347 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Cat; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BigCat + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nullable + private KindEnum kind; + + public BigCat() { + this.className = this.getClass().getSimpleName(); + } + + public BigCat kind(@javax.annotation.Nullable KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nullable + + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nullable KindEnum kind) { + this.kind = kind; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BigCat instance itself + */ + public BigCat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind)&& + Objects.equals(this.additionalProperties, bigCat.additionalProperties) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode(), additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "declawed", "kind")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BigCat + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BigCat.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in BigCat is not found in the empty JSON string", BigCat.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BigCat.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BigCat.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BigCat' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BigCat.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BigCat value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BigCat read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BigCat instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BigCat given an JSON string + * + * @param jsonString JSON string + * @return An instance of BigCat + * @throws IOException if the JSON string is invalid with respect to BigCat + */ + public static BigCat fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BigCat.class); + } + + /** + * Convert an instance of BigCat to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java new file mode 100644 index 000000000000..291bb7beb6f7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java @@ -0,0 +1,434 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Capitalization + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Capitalization { + public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; + @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) + @javax.annotation.Nullable + private String smallCamel; + + public static final String SERIALIZED_NAME_CAPITAL_CAMEL = "CapitalCamel"; + @SerializedName(SERIALIZED_NAME_CAPITAL_CAMEL) + @javax.annotation.Nullable + private String capitalCamel; + + public static final String SERIALIZED_NAME_SMALL_SNAKE = "small_Snake"; + @SerializedName(SERIALIZED_NAME_SMALL_SNAKE) + @javax.annotation.Nullable + private String smallSnake; + + public static final String SERIALIZED_NAME_CAPITAL_SNAKE = "Capital_Snake"; + @SerializedName(SERIALIZED_NAME_CAPITAL_SNAKE) + @javax.annotation.Nullable + private String capitalSnake; + + public static final String SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + @SerializedName(SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS) + @javax.annotation.Nullable + private String scAETHFlowPoints; + + public static final String SERIALIZED_NAME_A_T_T_N_A_M_E = "ATT_NAME"; + @SerializedName(SERIALIZED_NAME_A_T_T_N_A_M_E) + @javax.annotation.Nullable + private String ATT_NAME; + + public Capitalization() { + } + + public Capitalization smallCamel(@javax.annotation.Nullable String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + */ + @javax.annotation.Nullable + + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(@javax.annotation.Nullable String smallCamel) { + this.smallCamel = smallCamel; + } + + + public Capitalization capitalCamel(@javax.annotation.Nullable String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + */ + @javax.annotation.Nullable + + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(@javax.annotation.Nullable String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + + public Capitalization smallSnake(@javax.annotation.Nullable String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + */ + @javax.annotation.Nullable + + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(@javax.annotation.Nullable String smallSnake) { + this.smallSnake = smallSnake; + } + + + public Capitalization capitalSnake(@javax.annotation.Nullable String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + */ + @javax.annotation.Nullable + + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(@javax.annotation.Nullable String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + + public Capitalization scAETHFlowPoints(@javax.annotation.Nullable String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + */ + @javax.annotation.Nullable + + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(@javax.annotation.Nullable String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + + public Capitalization ATT_NAME(@javax.annotation.Nullable String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + */ + @javax.annotation.Nullable + + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(@javax.annotation.Nullable String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Capitalization instance itself + */ + public Capitalization putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, capitalization.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Capitalization + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Capitalization.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Capitalization is not found in the empty JSON string", Capitalization.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("smallCamel") != null && !jsonObj.get("smallCamel").isJsonNull()) && !jsonObj.get("smallCamel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `smallCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("smallCamel").toString())); + } + if ((jsonObj.get("CapitalCamel") != null && !jsonObj.get("CapitalCamel").isJsonNull()) && !jsonObj.get("CapitalCamel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `CapitalCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("CapitalCamel").toString())); + } + if ((jsonObj.get("small_Snake") != null && !jsonObj.get("small_Snake").isJsonNull()) && !jsonObj.get("small_Snake").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `small_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("small_Snake").toString())); + } + if ((jsonObj.get("Capital_Snake") != null && !jsonObj.get("Capital_Snake").isJsonNull()) && !jsonObj.get("Capital_Snake").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `Capital_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Capital_Snake").toString())); + } + if ((jsonObj.get("SCA_ETH_Flow_Points") != null && !jsonObj.get("SCA_ETH_Flow_Points").isJsonNull()) && !jsonObj.get("SCA_ETH_Flow_Points").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `SCA_ETH_Flow_Points` to be a primitive type in the JSON string but got `%s`", jsonObj.get("SCA_ETH_Flow_Points").toString())); + } + if ((jsonObj.get("ATT_NAME") != null && !jsonObj.get("ATT_NAME").isJsonNull()) && !jsonObj.get("ATT_NAME").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `ATT_NAME` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ATT_NAME").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Capitalization.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Capitalization' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Capitalization.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Capitalization value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Capitalization read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Capitalization instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Capitalization given an JSON string + * + * @param jsonString JSON string + * @return An instance of Capitalization + * @throws IOException if the JSON string is invalid with respect to Capitalization + */ + public static Capitalization fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Capitalization.class); + } + + /** + * Convert an instance of Capitalization to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 000000000000..e4cfbd7ad1a4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,222 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Cat + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Cat extends Animal { + public static final String SERIALIZED_NAME_DECLAWED = "declawed"; + @SerializedName(SERIALIZED_NAME_DECLAWED) + @javax.annotation.Nullable + private Boolean declawed; + + public Cat() { + this.className = this.getClass().getSimpleName(); + } + + public Cat declawed(@javax.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + */ + @javax.annotation.Nullable + + public Boolean getDeclawed() { + return declawed; + } + + public void setDeclawed(@javax.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Cat instance itself + */ + public Cat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, cat.additionalProperties) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode(), additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "declawed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Cat + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Cat.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Cat is not found in the empty JSON string", Cat.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("className").getAsString(); + switch (discriminatorValue) { + case "BigCat": + BigCat.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The value of the `className` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Cat given an JSON string + * + * @param jsonString JSON string + * @return An instance of Cat + * @throws IOException if the JSON string is invalid with respect to Cat + */ + public static Cat fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Cat.class); + } + + /** + * Convert an instance of Cat to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..cdcca238f7dd --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,318 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Category + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Category { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name = "default-name"; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, category.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Category + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Category.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Category.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Category' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Category.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Category value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Category read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Category given an JSON string + * + * @param jsonString JSON string + * @return An instance of Category + * @throws IOException if the JSON string is invalid with respect to Category + */ + public static Category fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Category.class); + } + + /** + * Convert an instance of Category to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java new file mode 100644 index 000000000000..6fae629ac3a7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java @@ -0,0 +1,284 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model with \"_class\" property + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ClassModel { + public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; + @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) + @javax.annotation.Nullable + private String propertyClass; + + public ClassModel() { + } + + public ClassModel propertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @javax.annotation.Nullable + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ClassModel instance itself + */ + public ClassModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, classModel.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("_class")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ClassModel is not found in the empty JSON string", ClassModel.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("_class") != null && !jsonObj.get("_class").isJsonNull()) && !jsonObj.get("_class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `_class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_class").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ClassModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ClassModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassModel + * @throws IOException if the JSON string is invalid with respect to ClassModel + */ + public static ClassModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassModel.class); + } + + /** + * Convert an instance of ClassModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java new file mode 100644 index 000000000000..62f069e6fd3d --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java @@ -0,0 +1,284 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Client { + public static final String SERIALIZED_NAME_CLIENT = "client"; + @SerializedName(SERIALIZED_NAME_CLIENT) + @javax.annotation.Nullable + private String client; + + public Client() { + } + + public Client client(@javax.annotation.Nullable String client) { + this.client = client; + return this; + } + + /** + * Get client + * @return client + */ + @javax.annotation.Nullable + + public String getClient() { + return client; + } + + public void setClient(@javax.annotation.Nullable String client) { + this.client = client; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Client instance itself + */ + public Client putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, client.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(client, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("client")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Client + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Client.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Client is not found in the empty JSON string", Client.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("client") != null && !jsonObj.get("client").isJsonNull()) && !jsonObj.get("client").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `client` to be a primitive type in the JSON string but got `%s`", jsonObj.get("client").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Client.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Client' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Client.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Client value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Client read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Client instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Client given an JSON string + * + * @param jsonString JSON string + * @return An instance of Client + * @throws IOException if the JSON string is invalid with respect to Client + */ + public static Client fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Client.class); + } + + /** + * Convert an instance of Client to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 000000000000..d4eea59a7489 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,291 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Dog + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Dog extends Animal { + public static final String SERIALIZED_NAME_BREED = "breed"; + @SerializedName(SERIALIZED_NAME_BREED) + @javax.annotation.Nullable + private String breed; + + public Dog() { + this.className = this.getClass().getSimpleName(); + } + + public Dog breed(@javax.annotation.Nullable String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + */ + @javax.annotation.Nullable + + public String getBreed() { + return breed; + } + + public void setBreed(@javax.annotation.Nullable String breed) { + this.breed = breed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Dog instance itself + */ + public Dog putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, dog.additionalProperties) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode(), additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "breed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Dog + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Dog.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Dog is not found in the empty JSON string", Dog.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Dog.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Dog.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Dog' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Dog.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Dog value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Dog read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Dog instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Dog given an JSON string + * + * @param jsonString JSON string + * @return An instance of Dog + * @throws IOException if the JSON string is invalid with respect to Dog + */ + public static Dog fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Dog.class); + } + + /** + * Convert an instance of Dog to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java new file mode 100644 index 000000000000..47f4070936e1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -0,0 +1,434 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EnumArrays + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + @JsonAdapter(JustSymbolEnum.Adapter.class) + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final JustSymbolEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public JustSymbolEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return JustSymbolEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + JustSymbolEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_JUST_SYMBOL = "just_symbol"; + @SerializedName(SERIALIZED_NAME_JUST_SYMBOL) + @javax.annotation.Nullable + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + @JsonAdapter(ArrayEnumEnum.Adapter.class) + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ArrayEnumEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ArrayEnumEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ArrayEnumEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ArrayEnumEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ARRAY_ENUM = "array_enum"; + @SerializedName(SERIALIZED_NAME_ARRAY_ENUM) + @javax.annotation.Nullable + private List arrayEnum = new ArrayList<>(); + + public EnumArrays() { + } + + public EnumArrays justSymbol(@javax.annotation.Nullable JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + */ + @javax.annotation.Nullable + + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + public void setJustSymbol(@javax.annotation.Nullable JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + + public EnumArrays arrayEnum(@javax.annotation.Nullable 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 + + public List getArrayEnum() { + return arrayEnum; + } + + public void setArrayEnum(@javax.annotation.Nullable List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumArrays instance itself + */ + public EnumArrays putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, enumArrays.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("just_symbol", "array_enum")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EnumArrays + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EnumArrays.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in EnumArrays is not found in the empty JSON string", EnumArrays.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonNull()) && !jsonObj.get("just_symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `just_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("just_symbol").toString())); + } + // validate the optional field `just_symbol` + if (jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonNull()) { + JustSymbolEnum.validateJsonElement(jsonObj.get("just_symbol")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_enum") != null && !jsonObj.get("array_enum").isJsonNull() && !jsonObj.get("array_enum").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_enum` to be an array in the JSON string but got `%s`", jsonObj.get("array_enum").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EnumArrays.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EnumArrays' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EnumArrays.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EnumArrays value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EnumArrays read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EnumArrays instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EnumArrays given an JSON string + * + * @param jsonString JSON string + * @return An instance of EnumArrays + * @throws IOException if the JSON string is invalid with respect to EnumArrays + */ + public static EnumArrays fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EnumArrays.class); + } + + /** + * Convert an instance of EnumArrays to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumClass.java new file mode 100644 index 000000000000..c2dfd3aecd7c --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumClass.java @@ -0,0 +1,80 @@ +/* + * 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 com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets EnumClass + */ +@JsonAdapter(EnumClass.Adapter.class) +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EnumClass fromValue(String value) { + for (EnumClass b : EnumClass.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumClass enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumClass read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumClass.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EnumClass.fromValue(value); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java new file mode 100644 index 000000000000..a9447d6d0f4c --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java @@ -0,0 +1,633 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.OuterEnum; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EnumTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class EnumTest { + /** + * Gets or Sets enumString + */ + @JsonAdapter(EnumStringEnum.Adapter.class) + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumStringEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumStringEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumStringEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EnumStringEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_STRING = "enum_string"; + @SerializedName(SERIALIZED_NAME_ENUM_STRING) + @javax.annotation.Nullable + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + @JsonAdapter(EnumStringRequiredEnum.Adapter.class) + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumStringRequiredEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumStringRequiredEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumStringRequiredEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EnumStringRequiredEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_STRING_REQUIRED = "enum_string_required"; + @SerializedName(SERIALIZED_NAME_ENUM_STRING_REQUIRED) + @javax.annotation.Nonnull + private EnumStringRequiredEnum enumStringRequired; + + /** + * Gets or Sets enumInteger + */ + @JsonAdapter(EnumIntegerEnum.Adapter.class) + public enum EnumIntegerEnum { + NUMBER_1(1), + + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumIntegerEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumIntegerEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return EnumIntegerEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + EnumIntegerEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_INTEGER = "enum_integer"; + @SerializedName(SERIALIZED_NAME_ENUM_INTEGER) + @javax.annotation.Nullable + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumNumber + */ + @JsonAdapter(EnumNumberEnum.Adapter.class) + 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; + } + + public Double getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumNumberEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumNumberEnum read(final JsonReader jsonReader) throws IOException { + Double value = jsonReader.nextDouble(); + return EnumNumberEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Double value = jsonElement.getAsDouble(); + EnumNumberEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_NUMBER = "enum_number"; + @SerializedName(SERIALIZED_NAME_ENUM_NUMBER) + @javax.annotation.Nullable + private EnumNumberEnum enumNumber; + + public static final String SERIALIZED_NAME_OUTER_ENUM = "outerEnum"; + @SerializedName(SERIALIZED_NAME_OUTER_ENUM) + @javax.annotation.Nullable + private OuterEnum outerEnum; + + public EnumTest() { + } + + public EnumTest enumString(@javax.annotation.Nullable EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + */ + @javax.annotation.Nullable + + public EnumStringEnum getEnumString() { + return enumString; + } + + public void setEnumString(@javax.annotation.Nullable EnumStringEnum enumString) { + this.enumString = enumString; + } + + + public EnumTest enumStringRequired(@javax.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + */ + @javax.annotation.Nonnull + + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(@javax.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + + public EnumTest enumInteger(@javax.annotation.Nullable EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + */ + @javax.annotation.Nullable + + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + public void setEnumInteger(@javax.annotation.Nullable EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + public EnumTest enumNumber(@javax.annotation.Nullable EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + */ + @javax.annotation.Nullable + + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + public void setEnumNumber(@javax.annotation.Nullable EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + public EnumTest outerEnum(@javax.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + */ + @javax.annotation.Nullable + + public OuterEnum getOuterEnum() { + return outerEnum; + } + + public void setOuterEnum(@javax.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumTest instance itself + */ + public EnumTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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.additionalProperties, enumTest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("enum_string", "enum_string_required", "enum_integer", "enum_number", "outerEnum")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("enum_string_required")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EnumTest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EnumTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in EnumTest is not found in the empty JSON string", EnumTest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EnumTest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonNull()) && !jsonObj.get("enum_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `enum_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string").toString())); + } + // validate the optional field `enum_string` + if (jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonNull()) { + EnumStringEnum.validateJsonElement(jsonObj.get("enum_string")); + } + if (!jsonObj.get("enum_string_required").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `enum_string_required` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string_required").toString())); + } + // validate the required field `enum_string_required` + EnumStringRequiredEnum.validateJsonElement(jsonObj.get("enum_string_required")); + // validate the optional field `enum_integer` + if (jsonObj.get("enum_integer") != null && !jsonObj.get("enum_integer").isJsonNull()) { + EnumIntegerEnum.validateJsonElement(jsonObj.get("enum_integer")); + } + // validate the optional field `enum_number` + if (jsonObj.get("enum_number") != null && !jsonObj.get("enum_number").isJsonNull()) { + EnumNumberEnum.validateJsonElement(jsonObj.get("enum_number")); + } + // validate the optional field `outerEnum` + if (jsonObj.get("outerEnum") != null && !jsonObj.get("outerEnum").isJsonNull()) { + OuterEnum.validateJsonElement(jsonObj.get("outerEnum")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EnumTest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EnumTest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EnumTest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EnumTest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EnumTest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EnumTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EnumTest given an JSON string + * + * @param jsonString JSON string + * @return An instance of EnumTest + * @throws IOException if the JSON string is invalid with respect to EnumTest + */ + public static EnumTest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EnumTest.class); + } + + /** + * Convert an instance of EnumTest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..0219e702328f --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,338 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FileSchemaTestClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FileSchemaTestClass { + public static final String SERIALIZED_NAME_FILE = "file"; + @SerializedName(SERIALIZED_NAME_FILE) + @javax.annotation.Nullable + private ModelFile _file; + + public static final String SERIALIZED_NAME_FILES = "files"; + @SerializedName(SERIALIZED_NAME_FILES) + @javax.annotation.Nullable + private List files = new ArrayList<>(); + + public FileSchemaTestClass() { + } + + public FileSchemaTestClass _file(@javax.annotation.Nullable ModelFile _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + @javax.annotation.Nullable + + public ModelFile getFile() { + return _file; + } + + public void setFile(@javax.annotation.Nullable ModelFile _file) { + this._file = _file; + } + + + public FileSchemaTestClass files(@javax.annotation.Nullable List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(ModelFile filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + */ + @javax.annotation.Nullable + + public List getFiles() { + return files; + } + + public void setFiles(@javax.annotation.Nullable List files) { + this.files = files; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FileSchemaTestClass instance itself + */ + public FileSchemaTestClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, fileSchemaTestClass.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(_file, files, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("file", "files")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FileSchemaTestClass + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FileSchemaTestClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FileSchemaTestClass is not found in the empty JSON string", FileSchemaTestClass.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `file` + if (jsonObj.get("file") != null && !jsonObj.get("file").isJsonNull()) { + ModelFile.validateJsonElement(jsonObj.get("file")); + } + if (jsonObj.get("files") != null && !jsonObj.get("files").isJsonNull()) { + JsonArray jsonArrayfiles = jsonObj.getAsJsonArray("files"); + if (jsonArrayfiles != null) { + // ensure the json data is an array + if (!jsonObj.get("files").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `files` to be an array in the JSON string but got `%s`", jsonObj.get("files").toString())); + } + + // validate the optional field `files` (array) + for (int i = 0; i < jsonArrayfiles.size(); i++) { + ModelFile.validateJsonElement(jsonArrayfiles.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FileSchemaTestClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FileSchemaTestClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FileSchemaTestClass.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FileSchemaTestClass value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FileSchemaTestClass read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FileSchemaTestClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FileSchemaTestClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of FileSchemaTestClass + * @throws IOException if the JSON string is invalid with respect to FileSchemaTestClass + */ + public static FileSchemaTestClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FileSchemaTestClass.class); + } + + /** + * Convert an instance of FileSchemaTestClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java new file mode 100644 index 000000000000..2fff3e2bbf72 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java @@ -0,0 +1,663 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.File; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FormatTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FormatTest { + public static final String SERIALIZED_NAME_INTEGER = "integer"; + @SerializedName(SERIALIZED_NAME_INTEGER) + @javax.annotation.Nullable + private Integer integer; + + public static final String SERIALIZED_NAME_INT32 = "int32"; + @SerializedName(SERIALIZED_NAME_INT32) + @javax.annotation.Nullable + private Integer int32; + + public static final String SERIALIZED_NAME_INT64 = "int64"; + @SerializedName(SERIALIZED_NAME_INT64) + @javax.annotation.Nullable + private Long int64; + + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) + @javax.annotation.Nonnull + private BigDecimal number; + + public static final String SERIALIZED_NAME_FLOAT = "float"; + @SerializedName(SERIALIZED_NAME_FLOAT) + @javax.annotation.Nullable + private Float _float; + + public static final String SERIALIZED_NAME_DOUBLE = "double"; + @SerializedName(SERIALIZED_NAME_DOUBLE) + @javax.annotation.Nullable + private Double _double; + + public static final String SERIALIZED_NAME_STRING = "string"; + @SerializedName(SERIALIZED_NAME_STRING) + @javax.annotation.Nullable + private String string; + + public static final String SERIALIZED_NAME_BYTE = "byte"; + @SerializedName(SERIALIZED_NAME_BYTE) + @javax.annotation.Nonnull + private byte[] _byte; + + public static final String SERIALIZED_NAME_BINARY = "binary"; + @SerializedName(SERIALIZED_NAME_BINARY) + @javax.annotation.Nullable + private File binary; + + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) + @javax.annotation.Nonnull + private LocalDate date; + + public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; + @SerializedName(SERIALIZED_NAME_DATE_TIME) + @javax.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String SERIALIZED_NAME_UUID = "uuid"; + @SerializedName(SERIALIZED_NAME_UUID) + @javax.annotation.Nullable + private UUID uuid; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nonnull + private String password; + + public static final String SERIALIZED_NAME_BIG_DECIMAL = "BigDecimal"; + @SerializedName(SERIALIZED_NAME_BIG_DECIMAL) + @javax.annotation.Nullable + private BigDecimal bigDecimal; + + public FormatTest() { + } + + public FormatTest integer(@javax.annotation.Nullable Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + */ + @javax.annotation.Nullable + + public Integer getInteger() { + return integer; + } + + public void setInteger(@javax.annotation.Nullable Integer integer) { + this.integer = integer; + } + + + public FormatTest int32(@javax.annotation.Nullable Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + */ + @javax.annotation.Nullable + + public Integer getInt32() { + return int32; + } + + public void setInt32(@javax.annotation.Nullable Integer int32) { + this.int32 = int32; + } + + + public FormatTest int64(@javax.annotation.Nullable Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + */ + @javax.annotation.Nullable + + public Long getInt64() { + return int64; + } + + public void setInt64(@javax.annotation.Nullable Long int64) { + this.int64 = int64; + } + + + public FormatTest number(@javax.annotation.Nonnull BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + */ + @javax.annotation.Nonnull + + public BigDecimal getNumber() { + return number; + } + + public void setNumber(@javax.annotation.Nonnull BigDecimal number) { + this.number = number; + } + + + public FormatTest _float(@javax.annotation.Nullable Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + */ + @javax.annotation.Nullable + + public Float getFloat() { + return _float; + } + + public void setFloat(@javax.annotation.Nullable Float _float) { + this._float = _float; + } + + + public FormatTest _double(@javax.annotation.Nullable Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + */ + @javax.annotation.Nullable + + public Double getDouble() { + return _double; + } + + public void setDouble(@javax.annotation.Nullable Double _double) { + this._double = _double; + } + + + public FormatTest string(@javax.annotation.Nullable String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + */ + @javax.annotation.Nullable + + public String getString() { + return string; + } + + public void setString(@javax.annotation.Nullable String string) { + this.string = string; + } + + + public FormatTest _byte(@javax.annotation.Nonnull byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + */ + @javax.annotation.Nonnull + + public byte[] getByte() { + return _byte; + } + + public void setByte(@javax.annotation.Nonnull byte[] _byte) { + this._byte = _byte; + } + + + public FormatTest binary(@javax.annotation.Nullable File binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + */ + @javax.annotation.Nullable + + public File getBinary() { + return binary; + } + + public void setBinary(@javax.annotation.Nullable File binary) { + this.binary = binary; + } + + + public FormatTest date(@javax.annotation.Nonnull LocalDate date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + */ + @javax.annotation.Nonnull + + public LocalDate getDate() { + return date; + } + + public void setDate(@javax.annotation.Nonnull LocalDate date) { + this.date = date; + } + + + public FormatTest dateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @javax.annotation.Nullable + + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public FormatTest uuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + + public UUID getUuid() { + return uuid; + } + + public void setUuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + + public FormatTest password(@javax.annotation.Nonnull String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nonnull + + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nonnull String password) { + this.password = password; + } + + + public FormatTest bigDecimal(@javax.annotation.Nullable BigDecimal bigDecimal) { + this.bigDecimal = bigDecimal; + return this; + } + + /** + * Get bigDecimal + * @return bigDecimal + */ + @javax.annotation.Nullable + + public BigDecimal getBigDecimal() { + return bigDecimal; + } + + public void setBigDecimal(@javax.annotation.Nullable BigDecimal bigDecimal) { + this.bigDecimal = bigDecimal; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FormatTest instance itself + */ + public FormatTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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.bigDecimal, formatTest.bigDecimal)&& + Objects.equals(this.additionalProperties, formatTest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal, additionalProperties); + } + + @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("*").append("\n"); + sb.append(" bigDecimal: ").append(toIndentedString(bigDecimal)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer", "int32", "int64", "number", "float", "double", "string", "byte", "binary", "date", "dateTime", "uuid", "password", "BigDecimal")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("number", "byte", "date", "password")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FormatTest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FormatTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FormatTest is not found in the empty JSON string", FormatTest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FormatTest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("string") != null && !jsonObj.get("string").isJsonNull()) && !jsonObj.get("string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string").toString())); + } + if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } + if (!jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FormatTest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FormatTest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FormatTest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FormatTest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FormatTest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FormatTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FormatTest given an JSON string + * + * @param jsonString JSON string + * @return An instance of FormatTest + * @throws IOException if the JSON string is invalid with respect to FormatTest + */ + public static FormatTest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FormatTest.class); + } + + /** + * Convert an instance of FormatTest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..df196bd860ad --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -0,0 +1,307 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * HasOnlyReadOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class HasOnlyReadOnly { + public static final String SERIALIZED_NAME_BAR = "bar"; + @SerializedName(SERIALIZED_NAME_BAR) + @javax.annotation.Nullable + private String bar; + + public static final String SERIALIZED_NAME_FOO = "foo"; + @SerializedName(SERIALIZED_NAME_FOO) + @javax.annotation.Nullable + private String foo; + + public HasOnlyReadOnly() { + } + + public HasOnlyReadOnly( + String bar, + String foo + ) { + this(); + this.bar = bar; + this.foo = foo; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + + public String getBar() { + return bar; + } + + + + /** + * Get foo + * @return foo + */ + @javax.annotation.Nullable + + public String getFoo() { + return foo; + } + + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the HasOnlyReadOnly instance itself + */ + public HasOnlyReadOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, hasOnlyReadOnly.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar", "foo")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HasOnlyReadOnly + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HasOnlyReadOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in HasOnlyReadOnly is not found in the empty JSON string", HasOnlyReadOnly.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonNull()) && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } + if ((jsonObj.get("foo") != null && !jsonObj.get("foo").isJsonNull()) && !jsonObj.get("foo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `foo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("foo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HasOnlyReadOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HasOnlyReadOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HasOnlyReadOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HasOnlyReadOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public HasOnlyReadOnly read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + HasOnlyReadOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HasOnlyReadOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of HasOnlyReadOnly + * @throws IOException if the JSON string is invalid with respect to HasOnlyReadOnly + */ + public static HasOnlyReadOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HasOnlyReadOnly.class); + } + + /** + * Convert an instance of HasOnlyReadOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java new file mode 100644 index 000000000000..1fc4162a1ce4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,448 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * MapTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class MapTest { + public static final String SERIALIZED_NAME_MAP_MAP_OF_STRING = "map_map_of_string"; + @SerializedName(SERIALIZED_NAME_MAP_MAP_OF_STRING) + @javax.annotation.Nullable + private Map> mapMapOfString = new HashMap<>(); + + /** + * Gets or Sets inner + */ + @JsonAdapter(InnerEnum.Adapter.class) + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final InnerEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public InnerEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return InnerEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + InnerEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_MAP_OF_ENUM_STRING = "map_of_enum_string"; + @SerializedName(SERIALIZED_NAME_MAP_OF_ENUM_STRING) + @javax.annotation.Nullable + private Map mapOfEnumString = new HashMap<>(); + + public static final String SERIALIZED_NAME_DIRECT_MAP = "direct_map"; + @SerializedName(SERIALIZED_NAME_DIRECT_MAP) + @javax.annotation.Nullable + private Map directMap = new HashMap<>(); + + public static final String SERIALIZED_NAME_INDIRECT_MAP = "indirect_map"; + @SerializedName(SERIALIZED_NAME_INDIRECT_MAP) + @javax.annotation.Nullable + private Map indirectMap = new HashMap<>(); + + public MapTest() { + } + + public MapTest mapMapOfString(@javax.annotation.Nullable 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 + + public Map> getMapMapOfString() { + return mapMapOfString; + } + + public void setMapMapOfString(@javax.annotation.Nullable Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + + public MapTest mapOfEnumString(@javax.annotation.Nullable 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 + + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + public void setMapOfEnumString(@javax.annotation.Nullable Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + + public MapTest directMap(@javax.annotation.Nullable 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 + + public Map getDirectMap() { + return directMap; + } + + public void setDirectMap(@javax.annotation.Nullable Map directMap) { + this.directMap = directMap; + } + + + public MapTest indirectMap(@javax.annotation.Nullable 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 + + public Map getIndirectMap() { + return indirectMap; + } + + public void setIndirectMap(@javax.annotation.Nullable Map indirectMap) { + this.indirectMap = indirectMap; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MapTest instance itself + */ + public MapTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, mapTest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MapTest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MapTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in MapTest is not found in the empty JSON string", MapTest.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MapTest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MapTest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MapTest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MapTest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MapTest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MapTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MapTest given an JSON string + * + * @param jsonString JSON string + * @return An instance of MapTest + * @throws IOException if the JSON string is invalid with respect to MapTest + */ + public static MapTest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MapTest.class); + } + + /** + * Convert an instance of MapTest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..8bc28a991837 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,351 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class MixedPropertiesAndAdditionalPropertiesClass { + public static final String SERIALIZED_NAME_UUID = "uuid"; + @SerializedName(SERIALIZED_NAME_UUID) + @javax.annotation.Nullable + private UUID uuid; + + public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; + @SerializedName(SERIALIZED_NAME_DATE_TIME) + @javax.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String SERIALIZED_NAME_MAP = "map"; + @SerializedName(SERIALIZED_NAME_MAP) + @javax.annotation.Nullable + private Map map = new HashMap<>(); + + public MixedPropertiesAndAdditionalPropertiesClass() { + } + + public MixedPropertiesAndAdditionalPropertiesClass uuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + + public UUID getUuid() { + return uuid; + } + + public void setUuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @javax.annotation.Nullable + + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public MixedPropertiesAndAdditionalPropertiesClass map(@javax.annotation.Nullable 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 + + public Map getMap() { + return map; + } + + public void setMap(@javax.annotation.Nullable Map map) { + this.map = map; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MixedPropertiesAndAdditionalPropertiesClass instance itself + */ + public MixedPropertiesAndAdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, mixedPropertiesAndAdditionalPropertiesClass.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("uuid", "dateTime", "map")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MixedPropertiesAndAdditionalPropertiesClass + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in MixedPropertiesAndAdditionalPropertiesClass is not found in the empty JSON string", MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MixedPropertiesAndAdditionalPropertiesClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MixedPropertiesAndAdditionalPropertiesClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MixedPropertiesAndAdditionalPropertiesClass.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MixedPropertiesAndAdditionalPropertiesClass value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MixedPropertiesAndAdditionalPropertiesClass read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MixedPropertiesAndAdditionalPropertiesClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MixedPropertiesAndAdditionalPropertiesClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of MixedPropertiesAndAdditionalPropertiesClass + * @throws IOException if the JSON string is invalid with respect to MixedPropertiesAndAdditionalPropertiesClass + */ + public static MixedPropertiesAndAdditionalPropertiesClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MixedPropertiesAndAdditionalPropertiesClass.class); + } + + /** + * Convert an instance of MixedPropertiesAndAdditionalPropertiesClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java new file mode 100644 index 000000000000..9d77344b1312 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java @@ -0,0 +1,311 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model name starting with number + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Model200Response { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private Integer name; + + public static final String SERIALIZED_NAME_PROPERTY_CLASS = "class"; + @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) + @javax.annotation.Nullable + private String propertyClass; + + public Model200Response() { + } + + public Model200Response name(@javax.annotation.Nullable Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public Integer getName() { + return name; + } + + public void setName(@javax.annotation.Nullable Integer name) { + this.name = name; + } + + + public Model200Response propertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @javax.annotation.Nullable + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Model200Response instance itself + */ + public Model200Response putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, _200response.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "class")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Model200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Model200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Model200Response is not found in the empty JSON string", Model200Response.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("class") != null && !jsonObj.get("class").isJsonNull()) && !jsonObj.get("class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("class").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Model200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Model200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Model200Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Model200Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Model200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Model200Response instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Model200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of Model200Response + * @throws IOException if the JSON string is invalid with respect to Model200Response + */ + public static Model200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Model200Response.class); + } + + /** + * Convert an instance of Model200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..0226b8d4f78a --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,341 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelApiResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelApiResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + + public Integer getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, _apiResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("code", "type", "message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelApiResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelApiResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelApiResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelApiResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelApiResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelApiResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelApiResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelApiResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelApiResponse + * @throws IOException if the JSON string is invalid with respect to ModelApiResponse + */ + public static ModelApiResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelApiResponse.class); + } + + /** + * Convert an instance of ModelApiResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java new file mode 100644 index 000000000000..76effe548439 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java @@ -0,0 +1,284 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Must be named `File` for test. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelFile { + public static final String SERIALIZED_NAME_SOURCE_U_R_I = "sourceURI"; + @SerializedName(SERIALIZED_NAME_SOURCE_U_R_I) + @javax.annotation.Nullable + private String sourceURI; + + public ModelFile() { + } + + public ModelFile sourceURI(@javax.annotation.Nullable String sourceURI) { + this.sourceURI = sourceURI; + return this; + } + + /** + * Test capitalization + * @return sourceURI + */ + @javax.annotation.Nullable + + public String getSourceURI() { + return sourceURI; + } + + public void setSourceURI(@javax.annotation.Nullable String sourceURI) { + this.sourceURI = sourceURI; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelFile instance itself + */ + public ModelFile putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelFile _file = (ModelFile) o; + return Objects.equals(this.sourceURI, _file.sourceURI)&& + Objects.equals(this.additionalProperties, _file.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(sourceURI, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelFile {\n"); + sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("sourceURI")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelFile + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelFile.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelFile is not found in the empty JSON string", ModelFile.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("sourceURI") != null && !jsonObj.get("sourceURI").isJsonNull()) && !jsonObj.get("sourceURI").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `sourceURI` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceURI").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelFile.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelFile' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelFile.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelFile value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelFile read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelFile instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelFile given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelFile + * @throws IOException if the JSON string is invalid with respect to ModelFile + */ + public static ModelFile fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelFile.class); + } + + /** + * Convert an instance of ModelFile to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java new file mode 100644 index 000000000000..928e9aff0df6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java @@ -0,0 +1,284 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelList { + public static final String SERIALIZED_NAME_123LIST = "123-list"; + @SerializedName(SERIALIZED_NAME_123LIST) + @javax.annotation.Nullable + private String _123list; + + public ModelList() { + } + + public ModelList _123list(@javax.annotation.Nullable String _123list) { + this._123list = _123list; + return this; + } + + /** + * Get _123list + * @return _123list + */ + @javax.annotation.Nullable + + public String get123list() { + return _123list; + } + + public void set123list(@javax.annotation.Nullable String _123list) { + this._123list = _123list; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelList instance itself + */ + public ModelList putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelList _list = (ModelList) o; + return Objects.equals(this._123list, _list._123list)&& + Objects.equals(this.additionalProperties, _list.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(_123list, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelList {\n"); + sb.append(" _123list: ").append(toIndentedString(_123list)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("123-list")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelList is not found in the empty JSON string", ModelList.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("123-list") != null && !jsonObj.get("123-list").isJsonNull()) && !jsonObj.get("123-list").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `123-list` to be a primitive type in the JSON string but got `%s`", jsonObj.get("123-list").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelList instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelList given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelList + * @throws IOException if the JSON string is invalid with respect to ModelList + */ + public static ModelList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelList.class); + } + + /** + * Convert an instance of ModelList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java new file mode 100644 index 000000000000..63b1f166ea3d --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -0,0 +1,281 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing reserved words + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelReturn { + public static final String SERIALIZED_NAME_RETURN = "return"; + @SerializedName(SERIALIZED_NAME_RETURN) + @javax.annotation.Nullable + private Integer _return; + + public ModelReturn() { + } + + public ModelReturn _return(@javax.annotation.Nullable Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + */ + @javax.annotation.Nullable + + public Integer getReturn() { + return _return; + } + + public void setReturn(@javax.annotation.Nullable Integer _return) { + this._return = _return; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelReturn instance itself + */ + public ModelReturn putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, _return.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(_return, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("return")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelReturn + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelReturn.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelReturn is not found in the empty JSON string", ModelReturn.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelReturn.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelReturn' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelReturn.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelReturn value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelReturn read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelReturn instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelReturn given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelReturn + * @throws IOException if the JSON string is invalid with respect to ModelReturn + */ + public static ModelReturn fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelReturn.class); + } + + /** + * Convert an instance of ModelReturn to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java new file mode 100644 index 000000000000..de9280ee45a0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java @@ -0,0 +1,365 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model name same as property name + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Name { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private Integer name; + + public static final String SERIALIZED_NAME_SNAKE_CASE = "snake_case"; + @SerializedName(SERIALIZED_NAME_SNAKE_CASE) + @javax.annotation.Nullable + private Integer snakeCase; + + public static final String SERIALIZED_NAME_PROPERTY = "property"; + @SerializedName(SERIALIZED_NAME_PROPERTY) + @javax.annotation.Nullable + private String property; + + public static final String SERIALIZED_NAME_123NUMBER = "123Number"; + @SerializedName(SERIALIZED_NAME_123NUMBER) + @javax.annotation.Nullable + private Integer _123number; + + public Name() { + } + + public Name( + Integer snakeCase, + Integer _123number + ) { + this(); + this.snakeCase = snakeCase; + this._123number = _123number; + } + + public Name name(@javax.annotation.Nonnull Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public Integer getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull Integer name) { + this.name = name; + } + + + /** + * Get snakeCase + * @return snakeCase + */ + @javax.annotation.Nullable + + public Integer getSnakeCase() { + return snakeCase; + } + + + + public Name property(@javax.annotation.Nullable String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + */ + @javax.annotation.Nullable + + public String getProperty() { + return property; + } + + public void setProperty(@javax.annotation.Nullable String property) { + this.property = property; + } + + + /** + * Get _123number + * @return _123number + */ + @javax.annotation.Nullable + + public Integer get123number() { + return _123number; + } + + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Name instance itself + */ + public Name putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, name.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "snake_case", "property", "123Number")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Name + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Name.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Name is not found in the empty JSON string", Name.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Name.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("property") != null && !jsonObj.get("property").isJsonNull()) && !jsonObj.get("property").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `property` to be a primitive type in the JSON string but got `%s`", jsonObj.get("property").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Name.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Name' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Name.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Name value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Name read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Name instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Name given an JSON string + * + * @param jsonString JSON string + * @return An instance of Name + * @throws IOException if the JSON string is invalid with respect to Name + */ + public static Name fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Name.class); + } + + /** + * Convert an instance of Name to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java new file mode 100644 index 000000000000..da3981561f21 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -0,0 +1,282 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NumberOnly { + public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; + @SerializedName(SERIALIZED_NAME_JUST_NUMBER) + @javax.annotation.Nullable + private BigDecimal justNumber; + + public NumberOnly() { + } + + public NumberOnly justNumber(@javax.annotation.Nullable BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + */ + @javax.annotation.Nullable + + public BigDecimal getJustNumber() { + return justNumber; + } + + public void setJustNumber(@javax.annotation.Nullable BigDecimal justNumber) { + this.justNumber = justNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NumberOnly instance itself + */ + public NumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, numberOnly.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("JustNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NumberOnly + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NumberOnly is not found in the empty JSON string", NumberOnly.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NumberOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NumberOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NumberOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NumberOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NumberOnly read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NumberOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of NumberOnly + * @throws IOException if the JSON string is invalid with respect to NumberOnly + */ + public static NumberOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NumberOnly.class); + } + + /** + * Convert an instance of NumberOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..452fc17cdf89 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,478 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Order + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Order { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_PET_ID = "petId"; + @SerializedName(SERIALIZED_NAME_PET_ID) + @javax.annotation.Nullable + private Long petId; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; + @SerializedName(SERIALIZED_NAME_SHIP_DATE) + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_COMPLETE = "complete"; + @SerializedName(SERIALIZED_NAME_COMPLETE) + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + + public Long getPetId() { + return petId; + } + + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + + public OffsetDateTime getShipDate() { + return shipDate; + } + + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + + public Boolean getComplete() { + return complete; + } + + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, order.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "petId", "quantity", "shipDate", "status", "complete")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Order + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Order.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Order' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Order.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Order value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Order read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Order instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Order given an JSON string + * + * @param jsonString JSON string + * @return An instance of Order + * @throws IOException if the JSON string is invalid with respect to Order + */ + public static Order fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Order.class); + } + + /** + * Convert an instance of Order to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java new file mode 100644 index 000000000000..5beecae7b654 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -0,0 +1,339 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OuterComposite + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OuterComposite { + public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; + @SerializedName(SERIALIZED_NAME_MY_NUMBER) + @javax.annotation.Nullable + private BigDecimal myNumber; + + public static final String SERIALIZED_NAME_MY_STRING = "my_string"; + @SerializedName(SERIALIZED_NAME_MY_STRING) + @javax.annotation.Nullable + private String myString; + + public static final String SERIALIZED_NAME_MY_BOOLEAN = "my_boolean"; + @SerializedName(SERIALIZED_NAME_MY_BOOLEAN) + @javax.annotation.Nullable + private Boolean myBoolean; + + public OuterComposite() { + } + + public OuterComposite myNumber(@javax.annotation.Nullable BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + */ + @javax.annotation.Nullable + + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(@javax.annotation.Nullable BigDecimal myNumber) { + this.myNumber = myNumber; + } + + + public OuterComposite myString(@javax.annotation.Nullable String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + */ + @javax.annotation.Nullable + + public String getMyString() { + return myString; + } + + public void setMyString(@javax.annotation.Nullable String myString) { + this.myString = myString; + } + + + public OuterComposite myBoolean(@javax.annotation.Nullable Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + */ + @javax.annotation.Nullable + + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(@javax.annotation.Nullable Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OuterComposite instance itself + */ + public OuterComposite putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, outerComposite.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("my_number", "my_string", "my_boolean")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OuterComposite + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OuterComposite.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in OuterComposite is not found in the empty JSON string", OuterComposite.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("my_string") != null && !jsonObj.get("my_string").isJsonNull()) && !jsonObj.get("my_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `my_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("my_string").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OuterComposite.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OuterComposite' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OuterComposite.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OuterComposite value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OuterComposite read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OuterComposite instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OuterComposite given an JSON string + * + * @param jsonString JSON string + * @return An instance of OuterComposite + * @throws IOException if the JSON string is invalid with respect to OuterComposite + */ + public static OuterComposite fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OuterComposite.class); + } + + /** + * Convert an instance of OuterComposite to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/OuterEnum.java new file mode 100644 index 000000000000..7f2bd742d75e --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -0,0 +1,80 @@ +/* + * 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 com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets OuterEnum + */ +@JsonAdapter(OuterEnum.Adapter.class) +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OuterEnum fromValue(String value) { + for (OuterEnum b : OuterEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OuterEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OuterEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OuterEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OuterEnum.fromValue(value); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..d8d49aa73aa7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,534 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pet { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private Set photoUrls = new LinkedHashSet<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull Set photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new LinkedHashSet<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public Set getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull Set photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable 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 + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, pet.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Pet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Pet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Pet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Pet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Pet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Pet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Pet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Pet given an JSON string + * + * @param jsonString JSON string + * @return An instance of Pet + * @throws IOException if the JSON string is invalid with respect to Pet + */ + public static Pet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Pet.class); + } + + /** + * Convert an instance of Pet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..36b08b00c770 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -0,0 +1,313 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReadOnlyFirst + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ReadOnlyFirst { + public static final String SERIALIZED_NAME_BAR = "bar"; + @SerializedName(SERIALIZED_NAME_BAR) + @javax.annotation.Nullable + private String bar; + + public static final String SERIALIZED_NAME_BAZ = "baz"; + @SerializedName(SERIALIZED_NAME_BAZ) + @javax.annotation.Nullable + private String baz; + + public ReadOnlyFirst() { + } + + public ReadOnlyFirst( + String bar + ) { + this(); + this.bar = bar; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + + public String getBar() { + return bar; + } + + + + public ReadOnlyFirst baz(@javax.annotation.Nullable String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + */ + @javax.annotation.Nullable + + public String getBaz() { + return baz; + } + + public void setBaz(@javax.annotation.Nullable String baz) { + this.baz = baz; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ReadOnlyFirst instance itself + */ + public ReadOnlyFirst putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, readOnlyFirst.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar", "baz")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReadOnlyFirst + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReadOnlyFirst.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReadOnlyFirst is not found in the empty JSON string", ReadOnlyFirst.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonNull()) && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } + if ((jsonObj.get("baz") != null && !jsonObj.get("baz").isJsonNull()) && !jsonObj.get("baz").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `baz` to be a primitive type in the JSON string but got `%s`", jsonObj.get("baz").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReadOnlyFirst.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReadOnlyFirst' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReadOnlyFirst.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReadOnlyFirst value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ReadOnlyFirst read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReadOnlyFirst instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReadOnlyFirst given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReadOnlyFirst + * @throws IOException if the JSON string is invalid with respect to ReadOnlyFirst + */ + public static ReadOnlyFirst fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReadOnlyFirst.class); + } + + /** + * Convert an instance of ReadOnlyFirst to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java new file mode 100644 index 000000000000..337e39c20b3e --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -0,0 +1,281 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SpecialModelName + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class SpecialModelName { + public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) + @javax.annotation.Nullable + private Long $specialPropertyName; + + public SpecialModelName() { + } + + public SpecialModelName $specialPropertyName(@javax.annotation.Nullable Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + */ + @javax.annotation.Nullable + + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + public void set$SpecialPropertyName(@javax.annotation.Nullable Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SpecialModelName instance itself + */ + public SpecialModelName putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, $specialModelName.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("$special[property.name]")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SpecialModelName + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SpecialModelName.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SpecialModelName is not found in the empty JSON string", SpecialModelName.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SpecialModelName.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SpecialModelName' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SpecialModelName.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SpecialModelName value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SpecialModelName read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SpecialModelName instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SpecialModelName given an JSON string + * + * @param jsonString JSON string + * @return An instance of SpecialModelName + * @throws IOException if the JSON string is invalid with respect to SpecialModelName + */ + public static SpecialModelName fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SpecialModelName.class); + } + + /** + * Convert an instance of SpecialModelName to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..fce033bea795 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,311 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Tag + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Tag { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Tag + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Tag.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Tag' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Tag value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Tag read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Tag given an JSON string + * + * @param jsonString JSON string + * @return An instance of Tag + * @throws IOException if the JSON string is invalid with respect to Tag + */ + public static Tag fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Tag.class); + } + + /** + * Convert an instance of Tag to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java new file mode 100644 index 000000000000..4540730ac5c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -0,0 +1,417 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TypeHolderDefault + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class TypeHolderDefault { + public static final String SERIALIZED_NAME_STRING_ITEM = "string_item"; + @SerializedName(SERIALIZED_NAME_STRING_ITEM) + @javax.annotation.Nonnull + private String stringItem = "what"; + + public static final String SERIALIZED_NAME_NUMBER_ITEM = "number_item"; + @SerializedName(SERIALIZED_NAME_NUMBER_ITEM) + @javax.annotation.Nonnull + private BigDecimal numberItem; + + public static final String SERIALIZED_NAME_INTEGER_ITEM = "integer_item"; + @SerializedName(SERIALIZED_NAME_INTEGER_ITEM) + @javax.annotation.Nonnull + private Integer integerItem; + + public static final String SERIALIZED_NAME_BOOL_ITEM = "bool_item"; + @SerializedName(SERIALIZED_NAME_BOOL_ITEM) + @javax.annotation.Nonnull + private Boolean boolItem = true; + + public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; + @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) + @javax.annotation.Nonnull + private List arrayItem = new ArrayList<>(); + + public TypeHolderDefault() { + } + + public TypeHolderDefault stringItem(@javax.annotation.Nonnull String stringItem) { + this.stringItem = stringItem; + return this; + } + + /** + * Get stringItem + * @return stringItem + */ + @javax.annotation.Nonnull + + public String getStringItem() { + return stringItem; + } + + public void setStringItem(@javax.annotation.Nonnull String stringItem) { + this.stringItem = stringItem; + } + + + public TypeHolderDefault numberItem(@javax.annotation.Nonnull BigDecimal numberItem) { + this.numberItem = numberItem; + return this; + } + + /** + * Get numberItem + * @return numberItem + */ + @javax.annotation.Nonnull + + public BigDecimal getNumberItem() { + return numberItem; + } + + public void setNumberItem(@javax.annotation.Nonnull BigDecimal numberItem) { + this.numberItem = numberItem; + } + + + public TypeHolderDefault integerItem(@javax.annotation.Nonnull Integer integerItem) { + this.integerItem = integerItem; + return this; + } + + /** + * Get integerItem + * @return integerItem + */ + @javax.annotation.Nonnull + + public Integer getIntegerItem() { + return integerItem; + } + + public void setIntegerItem(@javax.annotation.Nonnull Integer integerItem) { + this.integerItem = integerItem; + } + + + public TypeHolderDefault boolItem(@javax.annotation.Nonnull Boolean boolItem) { + this.boolItem = boolItem; + return this; + } + + /** + * Get boolItem + * @return boolItem + */ + @javax.annotation.Nonnull + + public Boolean getBoolItem() { + return boolItem; + } + + public void setBoolItem(@javax.annotation.Nonnull Boolean boolItem) { + this.boolItem = boolItem; + } + + + public TypeHolderDefault arrayItem(@javax.annotation.Nonnull List arrayItem) { + this.arrayItem = arrayItem; + return this; + } + + public TypeHolderDefault addArrayItemItem(Integer arrayItemItem) { + if (this.arrayItem == null) { + this.arrayItem = new ArrayList<>(); + } + this.arrayItem.add(arrayItemItem); + return this; + } + + /** + * Get arrayItem + * @return arrayItem + */ + @javax.annotation.Nonnull + + public List getArrayItem() { + return arrayItem; + } + + public void setArrayItem(@javax.annotation.Nonnull List arrayItem) { + this.arrayItem = arrayItem; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TypeHolderDefault instance itself + */ + public TypeHolderDefault putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TypeHolderDefault typeHolderDefault = (TypeHolderDefault) o; + return Objects.equals(this.stringItem, typeHolderDefault.stringItem) && + Objects.equals(this.numberItem, typeHolderDefault.numberItem) && + Objects.equals(this.integerItem, typeHolderDefault.integerItem) && + Objects.equals(this.boolItem, typeHolderDefault.boolItem) && + Objects.equals(this.arrayItem, typeHolderDefault.arrayItem)&& + Objects.equals(this.additionalProperties, typeHolderDefault.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypeHolderDefault {\n"); + sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); + sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); + sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); + sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); + sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("string_item", "number_item", "integer_item", "bool_item", "array_item")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("string_item", "number_item", "integer_item", "bool_item", "array_item")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TypeHolderDefault + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TypeHolderDefault.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TypeHolderDefault is not found in the empty JSON string", TypeHolderDefault.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TypeHolderDefault.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("string_item").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `string_item` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_item").toString())); + } + // ensure the required json array is present + if (jsonObj.get("array_item") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("array_item").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_item` to be an array in the JSON string but got `%s`", jsonObj.get("array_item").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TypeHolderDefault.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TypeHolderDefault' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TypeHolderDefault.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TypeHolderDefault value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TypeHolderDefault read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TypeHolderDefault instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TypeHolderDefault given an JSON string + * + * @param jsonString JSON string + * @return An instance of TypeHolderDefault + * @throws IOException if the JSON string is invalid with respect to TypeHolderDefault + */ + public static TypeHolderDefault fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TypeHolderDefault.class); + } + + /** + * Convert an instance of TypeHolderDefault to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java new file mode 100644 index 000000000000..d81650d6c8eb --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -0,0 +1,444 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TypeHolderExample + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class TypeHolderExample { + public static final String SERIALIZED_NAME_STRING_ITEM = "string_item"; + @SerializedName(SERIALIZED_NAME_STRING_ITEM) + @javax.annotation.Nonnull + private String stringItem; + + public static final String SERIALIZED_NAME_NUMBER_ITEM = "number_item"; + @SerializedName(SERIALIZED_NAME_NUMBER_ITEM) + @javax.annotation.Nonnull + private BigDecimal numberItem; + + public static final String SERIALIZED_NAME_FLOAT_ITEM = "float_item"; + @SerializedName(SERIALIZED_NAME_FLOAT_ITEM) + @javax.annotation.Nonnull + private Float floatItem; + + public static final String SERIALIZED_NAME_INTEGER_ITEM = "integer_item"; + @SerializedName(SERIALIZED_NAME_INTEGER_ITEM) + @javax.annotation.Nonnull + private Integer integerItem; + + public static final String SERIALIZED_NAME_BOOL_ITEM = "bool_item"; + @SerializedName(SERIALIZED_NAME_BOOL_ITEM) + @javax.annotation.Nonnull + private Boolean boolItem; + + public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; + @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) + @javax.annotation.Nonnull + private List arrayItem = new ArrayList<>(); + + public TypeHolderExample() { + } + + public TypeHolderExample stringItem(@javax.annotation.Nonnull String stringItem) { + this.stringItem = stringItem; + return this; + } + + /** + * Get stringItem + * @return stringItem + */ + @javax.annotation.Nonnull + + public String getStringItem() { + return stringItem; + } + + public void setStringItem(@javax.annotation.Nonnull String stringItem) { + this.stringItem = stringItem; + } + + + public TypeHolderExample numberItem(@javax.annotation.Nonnull BigDecimal numberItem) { + this.numberItem = numberItem; + return this; + } + + /** + * Get numberItem + * @return numberItem + */ + @javax.annotation.Nonnull + + public BigDecimal getNumberItem() { + return numberItem; + } + + public void setNumberItem(@javax.annotation.Nonnull BigDecimal numberItem) { + this.numberItem = numberItem; + } + + + public TypeHolderExample floatItem(@javax.annotation.Nonnull Float floatItem) { + this.floatItem = floatItem; + return this; + } + + /** + * Get floatItem + * @return floatItem + */ + @javax.annotation.Nonnull + + public Float getFloatItem() { + return floatItem; + } + + public void setFloatItem(@javax.annotation.Nonnull Float floatItem) { + this.floatItem = floatItem; + } + + + public TypeHolderExample integerItem(@javax.annotation.Nonnull Integer integerItem) { + this.integerItem = integerItem; + return this; + } + + /** + * Get integerItem + * @return integerItem + */ + @javax.annotation.Nonnull + + public Integer getIntegerItem() { + return integerItem; + } + + public void setIntegerItem(@javax.annotation.Nonnull Integer integerItem) { + this.integerItem = integerItem; + } + + + public TypeHolderExample boolItem(@javax.annotation.Nonnull Boolean boolItem) { + this.boolItem = boolItem; + return this; + } + + /** + * Get boolItem + * @return boolItem + */ + @javax.annotation.Nonnull + + public Boolean getBoolItem() { + return boolItem; + } + + public void setBoolItem(@javax.annotation.Nonnull Boolean boolItem) { + this.boolItem = boolItem; + } + + + public TypeHolderExample arrayItem(@javax.annotation.Nonnull List arrayItem) { + this.arrayItem = arrayItem; + return this; + } + + public TypeHolderExample addArrayItemItem(Integer arrayItemItem) { + if (this.arrayItem == null) { + this.arrayItem = new ArrayList<>(); + } + this.arrayItem.add(arrayItemItem); + return this; + } + + /** + * Get arrayItem + * @return arrayItem + */ + @javax.annotation.Nonnull + + public List getArrayItem() { + return arrayItem; + } + + public void setArrayItem(@javax.annotation.Nonnull List arrayItem) { + this.arrayItem = arrayItem; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TypeHolderExample instance itself + */ + public TypeHolderExample putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TypeHolderExample typeHolderExample = (TypeHolderExample) o; + return Objects.equals(this.stringItem, typeHolderExample.stringItem) && + Objects.equals(this.numberItem, typeHolderExample.numberItem) && + Objects.equals(this.floatItem, typeHolderExample.floatItem) && + Objects.equals(this.integerItem, typeHolderExample.integerItem) && + Objects.equals(this.boolItem, typeHolderExample.boolItem) && + Objects.equals(this.arrayItem, typeHolderExample.arrayItem)&& + Objects.equals(this.additionalProperties, typeHolderExample.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypeHolderExample {\n"); + sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); + sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); + sb.append(" floatItem: ").append(toIndentedString(floatItem)).append("\n"); + sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); + sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); + sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("string_item", "number_item", "float_item", "integer_item", "bool_item", "array_item")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("string_item", "number_item", "float_item", "integer_item", "bool_item", "array_item")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TypeHolderExample + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TypeHolderExample.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TypeHolderExample is not found in the empty JSON string", TypeHolderExample.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TypeHolderExample.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("string_item").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `string_item` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_item").toString())); + } + // ensure the required json array is present + if (jsonObj.get("array_item") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("array_item").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_item` to be an array in the JSON string but got `%s`", jsonObj.get("array_item").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TypeHolderExample.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TypeHolderExample' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TypeHolderExample.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TypeHolderExample value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TypeHolderExample read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TypeHolderExample instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TypeHolderExample given an JSON string + * + * @param jsonString JSON string + * @return An instance of TypeHolderExample + * @throws IOException if the JSON string is invalid with respect to TypeHolderExample + */ + public static TypeHolderExample fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TypeHolderExample.class); + } + + /** + * Convert an instance of TypeHolderExample to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..f4f1f2701843 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,488 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * User + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class User { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nullable + private String username; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nullable + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nullable + private String lastName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nullable + private String password; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nullable + private String phone; + + public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; + @SerializedName(SERIALIZED_NAME_USER_STATUS) + @javax.annotation.Nullable + private Integer userStatus; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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.additionalProperties, user.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to User + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) && !jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!User.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'User' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(User.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, User value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public User read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of User given an JSON string + * + * @param jsonString JSON string + * @return An instance of User + * @throws IOException if the JSON string is invalid with respect to User + */ + public static User fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, User.class); + } + + /** + * Convert an instance of User to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java new file mode 100644 index 000000000000..a5c8c84ad08d --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java @@ -0,0 +1,1164 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * XmlItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class XmlItem { + public static final String SERIALIZED_NAME_ATTRIBUTE_STRING = "attribute_string"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_STRING) + @javax.annotation.Nullable + private String attributeString; + + public static final String SERIALIZED_NAME_ATTRIBUTE_NUMBER = "attribute_number"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_NUMBER) + @javax.annotation.Nullable + private BigDecimal attributeNumber; + + public static final String SERIALIZED_NAME_ATTRIBUTE_INTEGER = "attribute_integer"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_INTEGER) + @javax.annotation.Nullable + private Integer attributeInteger; + + public static final String SERIALIZED_NAME_ATTRIBUTE_BOOLEAN = "attribute_boolean"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_BOOLEAN) + @javax.annotation.Nullable + private Boolean attributeBoolean; + + public static final String SERIALIZED_NAME_WRAPPED_ARRAY = "wrapped_array"; + @SerializedName(SERIALIZED_NAME_WRAPPED_ARRAY) + @javax.annotation.Nullable + private List wrappedArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAME_STRING = "name_string"; + @SerializedName(SERIALIZED_NAME_NAME_STRING) + @javax.annotation.Nullable + private String nameString; + + public static final String SERIALIZED_NAME_NAME_NUMBER = "name_number"; + @SerializedName(SERIALIZED_NAME_NAME_NUMBER) + @javax.annotation.Nullable + private BigDecimal nameNumber; + + public static final String SERIALIZED_NAME_NAME_INTEGER = "name_integer"; + @SerializedName(SERIALIZED_NAME_NAME_INTEGER) + @javax.annotation.Nullable + private Integer nameInteger; + + public static final String SERIALIZED_NAME_NAME_BOOLEAN = "name_boolean"; + @SerializedName(SERIALIZED_NAME_NAME_BOOLEAN) + @javax.annotation.Nullable + private Boolean nameBoolean; + + public static final String SERIALIZED_NAME_NAME_ARRAY = "name_array"; + @SerializedName(SERIALIZED_NAME_NAME_ARRAY) + @javax.annotation.Nullable + private List nameArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAME_WRAPPED_ARRAY = "name_wrapped_array"; + @SerializedName(SERIALIZED_NAME_NAME_WRAPPED_ARRAY) + @javax.annotation.Nullable + private List nameWrappedArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX_STRING = "prefix_string"; + @SerializedName(SERIALIZED_NAME_PREFIX_STRING) + @javax.annotation.Nullable + private String prefixString; + + public static final String SERIALIZED_NAME_PREFIX_NUMBER = "prefix_number"; + @SerializedName(SERIALIZED_NAME_PREFIX_NUMBER) + @javax.annotation.Nullable + private BigDecimal prefixNumber; + + public static final String SERIALIZED_NAME_PREFIX_INTEGER = "prefix_integer"; + @SerializedName(SERIALIZED_NAME_PREFIX_INTEGER) + @javax.annotation.Nullable + private Integer prefixInteger; + + public static final String SERIALIZED_NAME_PREFIX_BOOLEAN = "prefix_boolean"; + @SerializedName(SERIALIZED_NAME_PREFIX_BOOLEAN) + @javax.annotation.Nullable + private Boolean prefixBoolean; + + public static final String SERIALIZED_NAME_PREFIX_ARRAY = "prefix_array"; + @SerializedName(SERIALIZED_NAME_PREFIX_ARRAY) + @javax.annotation.Nullable + private List prefixArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX_WRAPPED_ARRAY = "prefix_wrapped_array"; + @SerializedName(SERIALIZED_NAME_PREFIX_WRAPPED_ARRAY) + @javax.annotation.Nullable + private List prefixWrappedArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAMESPACE_STRING = "namespace_string"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_STRING) + @javax.annotation.Nullable + private String namespaceString; + + public static final String SERIALIZED_NAME_NAMESPACE_NUMBER = "namespace_number"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_NUMBER) + @javax.annotation.Nullable + private BigDecimal namespaceNumber; + + public static final String SERIALIZED_NAME_NAMESPACE_INTEGER = "namespace_integer"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_INTEGER) + @javax.annotation.Nullable + private Integer namespaceInteger; + + public static final String SERIALIZED_NAME_NAMESPACE_BOOLEAN = "namespace_boolean"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_BOOLEAN) + @javax.annotation.Nullable + private Boolean namespaceBoolean; + + public static final String SERIALIZED_NAME_NAMESPACE_ARRAY = "namespace_array"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_ARRAY) + @javax.annotation.Nullable + private List namespaceArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAMESPACE_WRAPPED_ARRAY = "namespace_wrapped_array"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_WRAPPED_ARRAY) + @javax.annotation.Nullable + private List namespaceWrappedArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX_NS_STRING = "prefix_ns_string"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_STRING) + @javax.annotation.Nullable + private String prefixNsString; + + public static final String SERIALIZED_NAME_PREFIX_NS_NUMBER = "prefix_ns_number"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_NUMBER) + @javax.annotation.Nullable + private BigDecimal prefixNsNumber; + + public static final String SERIALIZED_NAME_PREFIX_NS_INTEGER = "prefix_ns_integer"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_INTEGER) + @javax.annotation.Nullable + private Integer prefixNsInteger; + + public static final String SERIALIZED_NAME_PREFIX_NS_BOOLEAN = "prefix_ns_boolean"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_BOOLEAN) + @javax.annotation.Nullable + private Boolean prefixNsBoolean; + + public static final String SERIALIZED_NAME_PREFIX_NS_ARRAY = "prefix_ns_array"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_ARRAY) + @javax.annotation.Nullable + private List prefixNsArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX_NS_WRAPPED_ARRAY = "prefix_ns_wrapped_array"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_WRAPPED_ARRAY) + @javax.annotation.Nullable + private List prefixNsWrappedArray = new ArrayList<>(); + + public XmlItem() { + } + + public XmlItem attributeString(@javax.annotation.Nullable String attributeString) { + this.attributeString = attributeString; + return this; + } + + /** + * Get attributeString + * @return attributeString + */ + @javax.annotation.Nullable + + public String getAttributeString() { + return attributeString; + } + + public void setAttributeString(@javax.annotation.Nullable String attributeString) { + this.attributeString = attributeString; + } + + + public XmlItem attributeNumber(@javax.annotation.Nullable BigDecimal attributeNumber) { + this.attributeNumber = attributeNumber; + return this; + } + + /** + * Get attributeNumber + * @return attributeNumber + */ + @javax.annotation.Nullable + + public BigDecimal getAttributeNumber() { + return attributeNumber; + } + + public void setAttributeNumber(@javax.annotation.Nullable BigDecimal attributeNumber) { + this.attributeNumber = attributeNumber; + } + + + public XmlItem attributeInteger(@javax.annotation.Nullable Integer attributeInteger) { + this.attributeInteger = attributeInteger; + return this; + } + + /** + * Get attributeInteger + * @return attributeInteger + */ + @javax.annotation.Nullable + + public Integer getAttributeInteger() { + return attributeInteger; + } + + public void setAttributeInteger(@javax.annotation.Nullable Integer attributeInteger) { + this.attributeInteger = attributeInteger; + } + + + public XmlItem attributeBoolean(@javax.annotation.Nullable Boolean attributeBoolean) { + this.attributeBoolean = attributeBoolean; + return this; + } + + /** + * Get attributeBoolean + * @return attributeBoolean + */ + @javax.annotation.Nullable + + public Boolean getAttributeBoolean() { + return attributeBoolean; + } + + public void setAttributeBoolean(@javax.annotation.Nullable Boolean attributeBoolean) { + this.attributeBoolean = attributeBoolean; + } + + + public XmlItem wrappedArray(@javax.annotation.Nullable List wrappedArray) { + this.wrappedArray = wrappedArray; + return this; + } + + public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { + if (this.wrappedArray == null) { + this.wrappedArray = new ArrayList<>(); + } + this.wrappedArray.add(wrappedArrayItem); + return this; + } + + /** + * Get wrappedArray + * @return wrappedArray + */ + @javax.annotation.Nullable + + public List getWrappedArray() { + return wrappedArray; + } + + public void setWrappedArray(@javax.annotation.Nullable List wrappedArray) { + this.wrappedArray = wrappedArray; + } + + + public XmlItem nameString(@javax.annotation.Nullable String nameString) { + this.nameString = nameString; + return this; + } + + /** + * Get nameString + * @return nameString + */ + @javax.annotation.Nullable + + public String getNameString() { + return nameString; + } + + public void setNameString(@javax.annotation.Nullable String nameString) { + this.nameString = nameString; + } + + + public XmlItem nameNumber(@javax.annotation.Nullable BigDecimal nameNumber) { + this.nameNumber = nameNumber; + return this; + } + + /** + * Get nameNumber + * @return nameNumber + */ + @javax.annotation.Nullable + + public BigDecimal getNameNumber() { + return nameNumber; + } + + public void setNameNumber(@javax.annotation.Nullable BigDecimal nameNumber) { + this.nameNumber = nameNumber; + } + + + public XmlItem nameInteger(@javax.annotation.Nullable Integer nameInteger) { + this.nameInteger = nameInteger; + return this; + } + + /** + * Get nameInteger + * @return nameInteger + */ + @javax.annotation.Nullable + + public Integer getNameInteger() { + return nameInteger; + } + + public void setNameInteger(@javax.annotation.Nullable Integer nameInteger) { + this.nameInteger = nameInteger; + } + + + public XmlItem nameBoolean(@javax.annotation.Nullable Boolean nameBoolean) { + this.nameBoolean = nameBoolean; + return this; + } + + /** + * Get nameBoolean + * @return nameBoolean + */ + @javax.annotation.Nullable + + public Boolean getNameBoolean() { + return nameBoolean; + } + + public void setNameBoolean(@javax.annotation.Nullable Boolean nameBoolean) { + this.nameBoolean = nameBoolean; + } + + + public XmlItem nameArray(@javax.annotation.Nullable List nameArray) { + this.nameArray = nameArray; + return this; + } + + public XmlItem addNameArrayItem(Integer nameArrayItem) { + if (this.nameArray == null) { + this.nameArray = new ArrayList<>(); + } + this.nameArray.add(nameArrayItem); + return this; + } + + /** + * Get nameArray + * @return nameArray + */ + @javax.annotation.Nullable + + public List getNameArray() { + return nameArray; + } + + public void setNameArray(@javax.annotation.Nullable List nameArray) { + this.nameArray = nameArray; + } + + + public XmlItem nameWrappedArray(@javax.annotation.Nullable List nameWrappedArray) { + this.nameWrappedArray = nameWrappedArray; + return this; + } + + public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { + if (this.nameWrappedArray == null) { + this.nameWrappedArray = new ArrayList<>(); + } + this.nameWrappedArray.add(nameWrappedArrayItem); + return this; + } + + /** + * Get nameWrappedArray + * @return nameWrappedArray + */ + @javax.annotation.Nullable + + public List getNameWrappedArray() { + return nameWrappedArray; + } + + public void setNameWrappedArray(@javax.annotation.Nullable List nameWrappedArray) { + this.nameWrappedArray = nameWrappedArray; + } + + + public XmlItem prefixString(@javax.annotation.Nullable String prefixString) { + this.prefixString = prefixString; + return this; + } + + /** + * Get prefixString + * @return prefixString + */ + @javax.annotation.Nullable + + public String getPrefixString() { + return prefixString; + } + + public void setPrefixString(@javax.annotation.Nullable String prefixString) { + this.prefixString = prefixString; + } + + + public XmlItem prefixNumber(@javax.annotation.Nullable BigDecimal prefixNumber) { + this.prefixNumber = prefixNumber; + return this; + } + + /** + * Get prefixNumber + * @return prefixNumber + */ + @javax.annotation.Nullable + + public BigDecimal getPrefixNumber() { + return prefixNumber; + } + + public void setPrefixNumber(@javax.annotation.Nullable BigDecimal prefixNumber) { + this.prefixNumber = prefixNumber; + } + + + public XmlItem prefixInteger(@javax.annotation.Nullable Integer prefixInteger) { + this.prefixInteger = prefixInteger; + return this; + } + + /** + * Get prefixInteger + * @return prefixInteger + */ + @javax.annotation.Nullable + + public Integer getPrefixInteger() { + return prefixInteger; + } + + public void setPrefixInteger(@javax.annotation.Nullable Integer prefixInteger) { + this.prefixInteger = prefixInteger; + } + + + public XmlItem prefixBoolean(@javax.annotation.Nullable Boolean prefixBoolean) { + this.prefixBoolean = prefixBoolean; + return this; + } + + /** + * Get prefixBoolean + * @return prefixBoolean + */ + @javax.annotation.Nullable + + public Boolean getPrefixBoolean() { + return prefixBoolean; + } + + public void setPrefixBoolean(@javax.annotation.Nullable Boolean prefixBoolean) { + this.prefixBoolean = prefixBoolean; + } + + + public XmlItem prefixArray(@javax.annotation.Nullable List prefixArray) { + this.prefixArray = prefixArray; + return this; + } + + public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { + if (this.prefixArray == null) { + this.prefixArray = new ArrayList<>(); + } + this.prefixArray.add(prefixArrayItem); + return this; + } + + /** + * Get prefixArray + * @return prefixArray + */ + @javax.annotation.Nullable + + public List getPrefixArray() { + return prefixArray; + } + + public void setPrefixArray(@javax.annotation.Nullable List prefixArray) { + this.prefixArray = prefixArray; + } + + + public XmlItem prefixWrappedArray(@javax.annotation.Nullable List prefixWrappedArray) { + this.prefixWrappedArray = prefixWrappedArray; + return this; + } + + public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { + if (this.prefixWrappedArray == null) { + this.prefixWrappedArray = new ArrayList<>(); + } + this.prefixWrappedArray.add(prefixWrappedArrayItem); + return this; + } + + /** + * Get prefixWrappedArray + * @return prefixWrappedArray + */ + @javax.annotation.Nullable + + public List getPrefixWrappedArray() { + return prefixWrappedArray; + } + + public void setPrefixWrappedArray(@javax.annotation.Nullable List prefixWrappedArray) { + this.prefixWrappedArray = prefixWrappedArray; + } + + + public XmlItem namespaceString(@javax.annotation.Nullable String namespaceString) { + this.namespaceString = namespaceString; + return this; + } + + /** + * Get namespaceString + * @return namespaceString + */ + @javax.annotation.Nullable + + public String getNamespaceString() { + return namespaceString; + } + + public void setNamespaceString(@javax.annotation.Nullable String namespaceString) { + this.namespaceString = namespaceString; + } + + + public XmlItem namespaceNumber(@javax.annotation.Nullable BigDecimal namespaceNumber) { + this.namespaceNumber = namespaceNumber; + return this; + } + + /** + * Get namespaceNumber + * @return namespaceNumber + */ + @javax.annotation.Nullable + + public BigDecimal getNamespaceNumber() { + return namespaceNumber; + } + + public void setNamespaceNumber(@javax.annotation.Nullable BigDecimal namespaceNumber) { + this.namespaceNumber = namespaceNumber; + } + + + public XmlItem namespaceInteger(@javax.annotation.Nullable Integer namespaceInteger) { + this.namespaceInteger = namespaceInteger; + return this; + } + + /** + * Get namespaceInteger + * @return namespaceInteger + */ + @javax.annotation.Nullable + + public Integer getNamespaceInteger() { + return namespaceInteger; + } + + public void setNamespaceInteger(@javax.annotation.Nullable Integer namespaceInteger) { + this.namespaceInteger = namespaceInteger; + } + + + public XmlItem namespaceBoolean(@javax.annotation.Nullable Boolean namespaceBoolean) { + this.namespaceBoolean = namespaceBoolean; + return this; + } + + /** + * Get namespaceBoolean + * @return namespaceBoolean + */ + @javax.annotation.Nullable + + public Boolean getNamespaceBoolean() { + return namespaceBoolean; + } + + public void setNamespaceBoolean(@javax.annotation.Nullable Boolean namespaceBoolean) { + this.namespaceBoolean = namespaceBoolean; + } + + + public XmlItem namespaceArray(@javax.annotation.Nullable List namespaceArray) { + this.namespaceArray = namespaceArray; + return this; + } + + public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { + if (this.namespaceArray == null) { + this.namespaceArray = new ArrayList<>(); + } + this.namespaceArray.add(namespaceArrayItem); + return this; + } + + /** + * Get namespaceArray + * @return namespaceArray + */ + @javax.annotation.Nullable + + public List getNamespaceArray() { + return namespaceArray; + } + + public void setNamespaceArray(@javax.annotation.Nullable List namespaceArray) { + this.namespaceArray = namespaceArray; + } + + + public XmlItem namespaceWrappedArray(@javax.annotation.Nullable List namespaceWrappedArray) { + this.namespaceWrappedArray = namespaceWrappedArray; + return this; + } + + public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { + if (this.namespaceWrappedArray == null) { + this.namespaceWrappedArray = new ArrayList<>(); + } + this.namespaceWrappedArray.add(namespaceWrappedArrayItem); + return this; + } + + /** + * Get namespaceWrappedArray + * @return namespaceWrappedArray + */ + @javax.annotation.Nullable + + public List getNamespaceWrappedArray() { + return namespaceWrappedArray; + } + + public void setNamespaceWrappedArray(@javax.annotation.Nullable List namespaceWrappedArray) { + this.namespaceWrappedArray = namespaceWrappedArray; + } + + + public XmlItem prefixNsString(@javax.annotation.Nullable String prefixNsString) { + this.prefixNsString = prefixNsString; + return this; + } + + /** + * Get prefixNsString + * @return prefixNsString + */ + @javax.annotation.Nullable + + public String getPrefixNsString() { + return prefixNsString; + } + + public void setPrefixNsString(@javax.annotation.Nullable String prefixNsString) { + this.prefixNsString = prefixNsString; + } + + + public XmlItem prefixNsNumber(@javax.annotation.Nullable BigDecimal prefixNsNumber) { + this.prefixNsNumber = prefixNsNumber; + return this; + } + + /** + * Get prefixNsNumber + * @return prefixNsNumber + */ + @javax.annotation.Nullable + + public BigDecimal getPrefixNsNumber() { + return prefixNsNumber; + } + + public void setPrefixNsNumber(@javax.annotation.Nullable BigDecimal prefixNsNumber) { + this.prefixNsNumber = prefixNsNumber; + } + + + public XmlItem prefixNsInteger(@javax.annotation.Nullable Integer prefixNsInteger) { + this.prefixNsInteger = prefixNsInteger; + return this; + } + + /** + * Get prefixNsInteger + * @return prefixNsInteger + */ + @javax.annotation.Nullable + + public Integer getPrefixNsInteger() { + return prefixNsInteger; + } + + public void setPrefixNsInteger(@javax.annotation.Nullable Integer prefixNsInteger) { + this.prefixNsInteger = prefixNsInteger; + } + + + public XmlItem prefixNsBoolean(@javax.annotation.Nullable Boolean prefixNsBoolean) { + this.prefixNsBoolean = prefixNsBoolean; + return this; + } + + /** + * Get prefixNsBoolean + * @return prefixNsBoolean + */ + @javax.annotation.Nullable + + public Boolean getPrefixNsBoolean() { + return prefixNsBoolean; + } + + public void setPrefixNsBoolean(@javax.annotation.Nullable Boolean prefixNsBoolean) { + this.prefixNsBoolean = prefixNsBoolean; + } + + + public XmlItem prefixNsArray(@javax.annotation.Nullable List prefixNsArray) { + this.prefixNsArray = prefixNsArray; + return this; + } + + public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { + if (this.prefixNsArray == null) { + this.prefixNsArray = new ArrayList<>(); + } + this.prefixNsArray.add(prefixNsArrayItem); + return this; + } + + /** + * Get prefixNsArray + * @return prefixNsArray + */ + @javax.annotation.Nullable + + public List getPrefixNsArray() { + return prefixNsArray; + } + + public void setPrefixNsArray(@javax.annotation.Nullable List prefixNsArray) { + this.prefixNsArray = prefixNsArray; + } + + + public XmlItem prefixNsWrappedArray(@javax.annotation.Nullable List prefixNsWrappedArray) { + this.prefixNsWrappedArray = prefixNsWrappedArray; + return this; + } + + public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { + if (this.prefixNsWrappedArray == null) { + this.prefixNsWrappedArray = new ArrayList<>(); + } + this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); + return this; + } + + /** + * Get prefixNsWrappedArray + * @return prefixNsWrappedArray + */ + @javax.annotation.Nullable + + public List getPrefixNsWrappedArray() { + return prefixNsWrappedArray; + } + + public void setPrefixNsWrappedArray(@javax.annotation.Nullable List prefixNsWrappedArray) { + this.prefixNsWrappedArray = prefixNsWrappedArray; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the XmlItem instance itself + */ + public XmlItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + XmlItem xmlItem = (XmlItem) o; + return Objects.equals(this.attributeString, xmlItem.attributeString) && + Objects.equals(this.attributeNumber, xmlItem.attributeNumber) && + Objects.equals(this.attributeInteger, xmlItem.attributeInteger) && + Objects.equals(this.attributeBoolean, xmlItem.attributeBoolean) && + Objects.equals(this.wrappedArray, xmlItem.wrappedArray) && + Objects.equals(this.nameString, xmlItem.nameString) && + Objects.equals(this.nameNumber, xmlItem.nameNumber) && + Objects.equals(this.nameInteger, xmlItem.nameInteger) && + Objects.equals(this.nameBoolean, xmlItem.nameBoolean) && + Objects.equals(this.nameArray, xmlItem.nameArray) && + Objects.equals(this.nameWrappedArray, xmlItem.nameWrappedArray) && + Objects.equals(this.prefixString, xmlItem.prefixString) && + Objects.equals(this.prefixNumber, xmlItem.prefixNumber) && + Objects.equals(this.prefixInteger, xmlItem.prefixInteger) && + Objects.equals(this.prefixBoolean, xmlItem.prefixBoolean) && + Objects.equals(this.prefixArray, xmlItem.prefixArray) && + Objects.equals(this.prefixWrappedArray, xmlItem.prefixWrappedArray) && + Objects.equals(this.namespaceString, xmlItem.namespaceString) && + Objects.equals(this.namespaceNumber, xmlItem.namespaceNumber) && + Objects.equals(this.namespaceInteger, xmlItem.namespaceInteger) && + Objects.equals(this.namespaceBoolean, xmlItem.namespaceBoolean) && + Objects.equals(this.namespaceArray, xmlItem.namespaceArray) && + Objects.equals(this.namespaceWrappedArray, xmlItem.namespaceWrappedArray) && + Objects.equals(this.prefixNsString, xmlItem.prefixNsString) && + Objects.equals(this.prefixNsNumber, xmlItem.prefixNsNumber) && + Objects.equals(this.prefixNsInteger, xmlItem.prefixNsInteger) && + Objects.equals(this.prefixNsBoolean, xmlItem.prefixNsBoolean) && + Objects.equals(this.prefixNsArray, xmlItem.prefixNsArray) && + Objects.equals(this.prefixNsWrappedArray, xmlItem.prefixNsWrappedArray)&& + Objects.equals(this.additionalProperties, xmlItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class XmlItem {\n"); + sb.append(" attributeString: ").append(toIndentedString(attributeString)).append("\n"); + sb.append(" attributeNumber: ").append(toIndentedString(attributeNumber)).append("\n"); + sb.append(" attributeInteger: ").append(toIndentedString(attributeInteger)).append("\n"); + sb.append(" attributeBoolean: ").append(toIndentedString(attributeBoolean)).append("\n"); + sb.append(" wrappedArray: ").append(toIndentedString(wrappedArray)).append("\n"); + sb.append(" nameString: ").append(toIndentedString(nameString)).append("\n"); + sb.append(" nameNumber: ").append(toIndentedString(nameNumber)).append("\n"); + sb.append(" nameInteger: ").append(toIndentedString(nameInteger)).append("\n"); + sb.append(" nameBoolean: ").append(toIndentedString(nameBoolean)).append("\n"); + sb.append(" nameArray: ").append(toIndentedString(nameArray)).append("\n"); + sb.append(" nameWrappedArray: ").append(toIndentedString(nameWrappedArray)).append("\n"); + sb.append(" prefixString: ").append(toIndentedString(prefixString)).append("\n"); + sb.append(" prefixNumber: ").append(toIndentedString(prefixNumber)).append("\n"); + sb.append(" prefixInteger: ").append(toIndentedString(prefixInteger)).append("\n"); + sb.append(" prefixBoolean: ").append(toIndentedString(prefixBoolean)).append("\n"); + sb.append(" prefixArray: ").append(toIndentedString(prefixArray)).append("\n"); + sb.append(" prefixWrappedArray: ").append(toIndentedString(prefixWrappedArray)).append("\n"); + sb.append(" namespaceString: ").append(toIndentedString(namespaceString)).append("\n"); + sb.append(" namespaceNumber: ").append(toIndentedString(namespaceNumber)).append("\n"); + sb.append(" namespaceInteger: ").append(toIndentedString(namespaceInteger)).append("\n"); + sb.append(" namespaceBoolean: ").append(toIndentedString(namespaceBoolean)).append("\n"); + sb.append(" namespaceArray: ").append(toIndentedString(namespaceArray)).append("\n"); + sb.append(" namespaceWrappedArray: ").append(toIndentedString(namespaceWrappedArray)).append("\n"); + sb.append(" prefixNsString: ").append(toIndentedString(prefixNsString)).append("\n"); + sb.append(" prefixNsNumber: ").append(toIndentedString(prefixNsNumber)).append("\n"); + sb.append(" prefixNsInteger: ").append(toIndentedString(prefixNsInteger)).append("\n"); + sb.append(" prefixNsBoolean: ").append(toIndentedString(prefixNsBoolean)).append("\n"); + sb.append(" prefixNsArray: ").append(toIndentedString(prefixNsArray)).append("\n"); + sb.append(" prefixNsWrappedArray: ").append(toIndentedString(prefixNsWrappedArray)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("attribute_string", "attribute_number", "attribute_integer", "attribute_boolean", "wrapped_array", "name_string", "name_number", "name_integer", "name_boolean", "name_array", "name_wrapped_array", "prefix_string", "prefix_number", "prefix_integer", "prefix_boolean", "prefix_array", "prefix_wrapped_array", "namespace_string", "namespace_number", "namespace_integer", "namespace_boolean", "namespace_array", "namespace_wrapped_array", "prefix_ns_string", "prefix_ns_number", "prefix_ns_integer", "prefix_ns_boolean", "prefix_ns_array", "prefix_ns_wrapped_array")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to XmlItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!XmlItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in XmlItem is not found in the empty JSON string", XmlItem.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("attribute_string") != null && !jsonObj.get("attribute_string").isJsonNull()) && !jsonObj.get("attribute_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `attribute_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("attribute_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("wrapped_array") != null && !jsonObj.get("wrapped_array").isJsonNull() && !jsonObj.get("wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("wrapped_array").toString())); + } + if ((jsonObj.get("name_string") != null && !jsonObj.get("name_string").isJsonNull()) && !jsonObj.get("name_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("name_array") != null && !jsonObj.get("name_array").isJsonNull() && !jsonObj.get("name_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name_array` to be an array in the JSON string but got `%s`", jsonObj.get("name_array").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("name_wrapped_array") != null && !jsonObj.get("name_wrapped_array").isJsonNull() && !jsonObj.get("name_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("name_wrapped_array").toString())); + } + if ((jsonObj.get("prefix_string") != null && !jsonObj.get("prefix_string").isJsonNull()) && !jsonObj.get("prefix_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `prefix_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prefix_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("prefix_array") != null && !jsonObj.get("prefix_array").isJsonNull() && !jsonObj.get("prefix_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `prefix_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_array").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("prefix_wrapped_array") != null && !jsonObj.get("prefix_wrapped_array").isJsonNull() && !jsonObj.get("prefix_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `prefix_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_wrapped_array").toString())); + } + if ((jsonObj.get("namespace_string") != null && !jsonObj.get("namespace_string").isJsonNull()) && !jsonObj.get("namespace_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("namespace_array") != null && !jsonObj.get("namespace_array").isJsonNull() && !jsonObj.get("namespace_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace_array` to be an array in the JSON string but got `%s`", jsonObj.get("namespace_array").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("namespace_wrapped_array") != null && !jsonObj.get("namespace_wrapped_array").isJsonNull() && !jsonObj.get("namespace_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("namespace_wrapped_array").toString())); + } + if ((jsonObj.get("prefix_ns_string") != null && !jsonObj.get("prefix_ns_string").isJsonNull()) && !jsonObj.get("prefix_ns_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `prefix_ns_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prefix_ns_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("prefix_ns_array") != null && !jsonObj.get("prefix_ns_array").isJsonNull() && !jsonObj.get("prefix_ns_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `prefix_ns_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_ns_array").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("prefix_ns_wrapped_array") != null && !jsonObj.get("prefix_ns_wrapped_array").isJsonNull() && !jsonObj.get("prefix_ns_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `prefix_ns_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_ns_wrapped_array").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!XmlItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'XmlItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(XmlItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, XmlItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public XmlItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + XmlItem instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of XmlItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of XmlItem + * @throws IOException if the JSON string is invalid with respect to XmlItem + */ + public static XmlItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, XmlItem.class); + } + + /** + * Convert an instance of XmlItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/resources/openapi/openapi.yaml b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/resources/openapi/openapi.yaml new file mode 100644 index 000000000000..426145d1685a --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/resources/openapi/openapi.yaml @@ -0,0 +1,2255 @@ +openapi: 3.0.1 +info: + description: "This spec is mainly for testing Petstore server and contains fake\ + \ endpoints, models. Please do not use this for any other purpose. Special characters:\ + \ \" \\" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- url: http://petstore.swagger.io:80/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + responses: + "200": + content: {} + description: successful operation + "405": + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + put: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + responses: + "200": + content: {} + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Pet not found + "405": + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + uniqueItems: true + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + uniqueItems: true + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + uniqueItems: true + description: successful operation + "400": + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + "200": + content: {} + description: successful operation + "400": + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + operationId: placeOrder + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - application/json + - application/xml + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: order_id + required: true + schema: + type: string + responses: + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - application/json + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + content: + '*/*': + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - application/json + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + content: + '*/*': + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - application/json + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + "400": + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + operationId: logoutUser + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + content: {} + description: Invalid user supplied + "404": + content: {} + description: User not found + summary: Updated user + tags: + - user + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - application/json + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + in: query + name: required_string_group + required: true + schema: + type: integer + - description: Required Boolean in group parameters + in: header + name: required_boolean_group + required: true + schema: + type: boolean + - description: Required Integer in group parameters + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + - description: String in group parameters + in: query + name: string_group + schema: + type: integer + - description: Boolean in group parameters + in: header + name: boolean_group + schema: + type: boolean + - description: Integer in group parameters + in: query + name: int64_group + schema: + format: int64 + type: integer + responses: + "400": + content: {} + description: Something wrong + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + x-accepts: + - application/json + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + in: header + name: enum_header_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (string array) + explode: false + in: query + name: enum_query_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + in: query + name: enum_query_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (double) + in: query + name: enum_query_integer + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + - description: Query parameter enum test (double) + in: query + name: enum_query_double + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEnumParameters_request" + responses: + "400": + content: {} + description: Invalid request + "404": + content: {} + description: Not found + summary: To test enum parameters + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test "client" model + tags: + - fake + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + post: + description: |- + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEndpointParameters_request" + required: true + responses: + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + security: + - http_basic_test: [] + summary: |- + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterNumber" + description: Input number as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterNumber" + description: Output number + tags: + - fake + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - '*/*' + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterString" + description: Input string as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterString" + description: Output string + tags: + - fake + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - '*/*' + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Input boolean as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Output boolean + tags: + - fake + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - '*/*' + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterComposite" + description: Input composite as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterComposite" + description: Output composite + tags: + - fake + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - '*/*' + /fake/jsonFormData: + get: + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testJsonFormData_request" + required: true + responses: + "200": + content: {} + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/inline-additionalProperties: + post: + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + "200": + content: {} + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-codegen-request-body-name: param + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - in: query + name: query + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + required: true + responses: + "200": + content: {} + description: Success + tags: + - fake + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + /fake/create_xml_item: + post: + description: this route creates an XmlItem + operationId: createXmlItem + requestBody: + content: + application/xml: + schema: + $ref: "#/components/schemas/XmlItem" + application/xml; charset=utf-8: + schema: + $ref: "#/components/schemas/XmlItem" + application/xml; charset=utf-16: + schema: + $ref: "#/components/schemas/XmlItem" + text/xml: + schema: + $ref: "#/components/schemas/XmlItem" + text/xml; charset=utf-8: + schema: + $ref: "#/components/schemas/XmlItem" + text/xml; charset=utf-16: + schema: + $ref: "#/components/schemas/XmlItem" + description: XmlItem Body + required: true + responses: + "200": + content: {} + description: successful operation + summary: creates an XmlItem + tags: + - fake + x-codegen-request-body-name: XmlItem + x-content-type: application/xml + x-accepts: + - application/json + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + parameters: + - description: to test uuid example value + in: header + name: uuid_test + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-file-schema: + put: + description: "For this test, the body for this request much reference a schema\ + \ named `File`." + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FileSchemaTestClass" + required: true + responses: + "200": + content: {} + description: Success + tags: + - fake + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + /fake/test-query-parameters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: false + in: query + name: pipe + required: true + schema: + items: + type: string + type: array + style: form + - in: query + name: ioutil + required: true + schema: + items: + type: string + type: array + - in: query + name: http + required: true + schema: + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: {} + description: Success + tags: + - fake + x-accepts: + - application/json + /fake/{petId}/uploadImageWithRequiredFile: + post: + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFileWithRequiredFile_request" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json +components: + schemas: + Order: + example: + id: 0 + petId: 6 + quantity: 1 + shipDate: 2000-01-23T04:56:07.000+00:00 + status: placed + complete: false + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + id: 6 + name: default-name + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + id: 0 + username: username + firstName: firstName + lastName: lastName + email: email + password: password + phone: phone + userStatus: 6 + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + Tag: + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + id: 0 + category: + id: 6 + name: default-name + name: doggie + photoUrls: + - photoUrls + - photoUrls + tags: + - id: 1 + name: name + - id: 1 + name: name + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + uniqueItems: true + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + $special[model.name]: + properties: + $special[property.name]: + format: int64 + type: integer + type: object + xml: + name: "$special[model.name]" + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + type: object + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + "123Number": + readOnly: true + type: integer + required: + - name + type: object + xml: + name: Name + "200_response": + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + type: object + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + type: object + Dog: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + declawed: + type: boolean + type: object + BigCat: + allOf: + - $ref: "#/components/schemas/Cat" + - properties: + kind: + enum: + - lions + - tigers + - leopards + - jaguars + type: string + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: "#/components/schemas/Animal" + type: array + format_test: + properties: + integer: + maximum: 100 + minimum: 10 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + pattern: "/[a-z]/i" + type: string + byte: + format: byte + pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + BigDecimal: + format: number + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: "#/components/schemas/OuterEnum" + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_string: + additionalProperties: + type: string + type: object + map_number: + additionalProperties: + type: number + type: object + map_integer: + additionalProperties: + type: integer + type: object + map_boolean: + additionalProperties: + type: boolean + type: object + map_array_integer: + additionalProperties: + items: + type: integer + type: array + type: object + map_array_anytype: + additionalProperties: + items: + properties: {} + type: object + type: array + type: object + map_map_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_map_anytype: + additionalProperties: + additionalProperties: + properties: {} + type: object + type: object + type: object + anytype_1: + properties: {} + type: object + anytype_2: + type: object + anytype_3: + properties: {} + type: object + type: object + AdditionalPropertiesString: + additionalProperties: + type: string + properties: + name: + type: string + type: object + AdditionalPropertiesInteger: + additionalProperties: + type: integer + properties: + name: + type: string + type: object + AdditionalPropertiesNumber: + additionalProperties: + type: number + properties: + name: + type: string + type: object + AdditionalPropertiesBoolean: + additionalProperties: + type: boolean + properties: + name: + type: string + type: object + AdditionalPropertiesArray: + additionalProperties: + items: + properties: {} + type: object + type: array + properties: + name: + type: string + type: object + AdditionalPropertiesObject: + additionalProperties: + additionalProperties: + properties: {} + type: object + type: object + properties: + name: + type: string + type: object + AdditionalPropertiesAnyType: + additionalProperties: + properties: {} + type: object + properties: + name: + type: string + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: "#/components/schemas/Animal" + type: object + type: object + List: + properties: + "123-list": + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + type: object + ArrayTest: + properties: + array_of_string: + items: + type: string + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: "#/components/schemas/ReadOnlyFirst" + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + type: string + OuterComposite: + example: + my_number: 0.8008281904610115 + my_string: my_string + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: "#/components/schemas/File" + files: + items: + $ref: "#/components/schemas/File" + type: array + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + TypeHolderDefault: + properties: + string_item: + default: what + type: string + number_item: + type: number + integer_item: + type: integer + bool_item: + default: true + type: boolean + array_item: + items: + type: integer + type: array + required: + - array_item + - bool_item + - integer_item + - number_item + - string_item + type: object + TypeHolderExample: + properties: + string_item: + example: what + type: string + number_item: + example: 1.234 + type: number + float_item: + example: 1.234 + format: float + type: number + integer_item: + example: -2 + type: integer + bool_item: + example: true + type: boolean + array_item: + example: + - 0 + - 1 + - 2 + - 3 + items: + type: integer + type: array + required: + - array_item + - bool_item + - float_item + - integer_item + - number_item + - string_item + type: object + XmlItem: + properties: + attribute_string: + example: string + type: string + xml: + attribute: true + attribute_number: + example: 1.234 + type: number + xml: + attribute: true + attribute_integer: + example: -2 + type: integer + xml: + attribute: true + attribute_boolean: + example: true + type: boolean + xml: + attribute: true + wrapped_array: + items: + type: integer + type: array + xml: + wrapped: true + name_string: + example: string + type: string + xml: + name: xml_name_string + name_number: + example: 1.234 + type: number + xml: + name: xml_name_number + name_integer: + example: -2 + type: integer + xml: + name: xml_name_integer + name_boolean: + example: true + type: boolean + xml: + name: xml_name_boolean + name_array: + items: + type: integer + xml: + name: xml_name_array_item + type: array + name_wrapped_array: + items: + type: integer + xml: + name: xml_name_wrapped_array_item + type: array + xml: + name: xml_name_wrapped_array + wrapped: true + prefix_string: + example: string + type: string + xml: + prefix: ab + prefix_number: + example: 1.234 + type: number + xml: + prefix: cd + prefix_integer: + example: -2 + type: integer + xml: + prefix: ef + prefix_boolean: + example: true + type: boolean + xml: + prefix: gh + prefix_array: + items: + type: integer + xml: + prefix: ij + type: array + prefix_wrapped_array: + items: + type: integer + xml: + prefix: mn + type: array + xml: + prefix: kl + wrapped: true + namespace_string: + example: string + type: string + xml: + namespace: http://a.com/schema + namespace_number: + example: 1.234 + type: number + xml: + namespace: http://b.com/schema + namespace_integer: + example: -2 + type: integer + xml: + namespace: http://c.com/schema + namespace_boolean: + example: true + type: boolean + xml: + namespace: http://d.com/schema + namespace_array: + items: + type: integer + xml: + namespace: http://e.com/schema + type: array + namespace_wrapped_array: + items: + type: integer + xml: + namespace: http://g.com/schema + type: array + xml: + namespace: http://f.com/schema + wrapped: true + prefix_ns_string: + example: string + type: string + xml: + namespace: http://a.com/schema + prefix: a + prefix_ns_number: + example: 1.234 + type: number + xml: + namespace: http://b.com/schema + prefix: b + prefix_ns_integer: + example: -2 + type: integer + xml: + namespace: http://c.com/schema + prefix: c + prefix_ns_boolean: + example: true + type: boolean + xml: + namespace: http://d.com/schema + prefix: d + prefix_ns_array: + items: + type: integer + xml: + namespace: http://e.com/schema + prefix: e + type: array + prefix_ns_wrapped_array: + items: + type: integer + xml: + namespace: http://g.com/schema + prefix: g + type: array + xml: + namespace: http://f.com/schema + prefix: f + wrapped: true + type: object + xml: + namespace: http://a.com/schema + prefix: pre + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + testEndpointParameters_request: + properties: + integer: + description: None + format: int32 + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: "/[a-z]/i" + type: string + pattern_without_delimiter: + description: None + pattern: "^[A-Z].*" + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http +x-original-swagger-version: "2.0" + diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java new file mode 100644 index 000000000000..759193160447 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -0,0 +1,50 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Client; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AnotherFakeApi + */ +@Disabled +public class AnotherFakeApiTest { + + private final AnotherFakeApi api = new AnotherFakeApi(); + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + * + * @throws ApiException if the Api call fails + */ + @Test + public void call123testSpecialTagsTest() throws ApiException { + UUID uuidTest = null; + Client body = null; + Client response = api.call123testSpecialTags(uuidTest, body); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 000000000000..c5064962312c --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,253 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.User; +import org.openapitools.client.model.XmlItem; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +@Disabled +public class FakeApiTest { + + private final FakeApi api = new FakeApi(); + + /** + * creates an XmlItem + * + * this route creates an XmlItem + * + * @throws ApiException if the Api call fails + */ + @Test + public void createXmlItemTest() throws ApiException { + XmlItem xmlItem = null; + api.createXmlItem(xmlItem); + // TODO: test validations + } + + /** + * Test serialization of outer boolean types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterBooleanSerializeTest() throws ApiException { + Boolean body = null; + Boolean response = api.fakeOuterBooleanSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of object with outer number type + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterCompositeSerializeTest() throws ApiException { + OuterComposite body = null; + OuterComposite response = api.fakeOuterCompositeSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of outer number types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterNumberSerializeTest() throws ApiException { + BigDecimal body = null; + BigDecimal response = api.fakeOuterNumberSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of outer string types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterStringSerializeTest() throws ApiException { + String body = null; + String response = api.fakeOuterStringSerialize(body); + // TODO: test validations + } + + /** + * For this test, the body for this request much reference a schema named `File`. + * + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithFileSchemaTest() throws ApiException { + FileSchemaTestClass body = null; + api.testBodyWithFileSchema(body); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithQueryParamsTest() throws ApiException { + String query = null; + User body = null; + api.testBodyWithQueryParams(query, body); + // TODO: test validations + } + + /** + * To test \"client\" model + * + * To test \"client\" model + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClientModelTest() throws ApiException { + Client body = null; + Client response = api.testClientModel(body); + // TODO: test validations + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEndpointParametersTest() throws ApiException { + BigDecimal number = null; + Double _double = null; + String patternWithoutDelimiter = null; + byte[] _byte = null; + Integer integer = null; + Integer int32 = null; + Long int64 = null; + Float _float = null; + String string = null; + File binary = null; + LocalDate date = null; + OffsetDateTime dateTime = null; + String password = null; + String paramCallback = null; + api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + // TODO: test validations + } + + /** + * To test enum parameters + * + * To test enum parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEnumParametersTest() throws ApiException { + List enumHeaderStringArray = null; + String enumHeaderString = null; + List enumQueryStringArray = null; + String enumQueryString = null; + Integer enumQueryInteger = null; + Double enumQueryDouble = null; + List enumFormStringArray = null; + String enumFormString = null; + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + // TODO: test validations + } + + /** + * Fake endpoint to test group parameters (optional) + * + * Fake endpoint to test group parameters (optional) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testGroupParametersTest() throws ApiException { + Integer requiredStringGroup = null; + Boolean requiredBooleanGroup = null; + Long requiredInt64Group = null; + Integer stringGroup = null; + Boolean booleanGroup = null; + Long int64Group = null; + api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + // TODO: test validations + } + + /** + * test inline additionalProperties + * + * @throws ApiException if the Api call fails + */ + @Test + public void testInlineAdditionalPropertiesTest() throws ApiException { + Map param = null; + api.testInlineAdditionalProperties(param); + // TODO: test validations + } + + /** + * test json serialization of form data + * + * @throws ApiException if the Api call fails + */ + @Test + public void testJsonFormDataTest() throws ApiException { + String param = null; + String param2 = null; + api.testJsonFormData(param, param2); + // TODO: test validations + } + + /** + * To test the collection format in query parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryParameterCollectionFormatTest() throws ApiException { + List pipe = null; + List ioutil = null; + List http = null; + List url = null; + List context = null; + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 000000000000..4899dbeac98c --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Client; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Disabled +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + /** + * To test class name in snake case + * + * To test class name in snake case + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + Client body = null; + Client response = api.testClassname(body); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..9c54e3b6ce2f --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,158 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import java.util.Set; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + /** + * Add a new pet to the store + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet body = null; + api.addPet(body); + // TODO: test validations + } + + /** + * Deletes a pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + Set tags = null; + Set response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Update an existing pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet body = null; + api.updatePet(body); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.uploadFile(petId, additionalMetadata, _file); + // TODO: test validations + } + + /** + * uploads an image (required) + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileWithRequiredFileTest() throws ApiException { + Long petId = null; + File requiredFile = null; + String additionalMetadata = null; + ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..b6d81a6c5800 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,87 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = api.getOrderById(orderId); + // TODO: test validations + } + + /** + * Place an order for a pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order body = null; + Order response = api.placeOrder(body); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..cb958423ece1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,138 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User body = null; + api.createUser(body); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List body = null; + api.createUsersWithArrayInput(body); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List body = null; + api.createUsersWithListInput(body); + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + api.deleteUser(username); + // TODO: test validations + } + + /** + * Get user by user name + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * @throws ApiException if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + api.logoutUser(); + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User body = null; + api.updateUser(username, body); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java new file mode 100644 index 000000000000..37643c848b07 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesAnyType + */ +public class AdditionalPropertiesAnyTypeTest { + private final AdditionalPropertiesAnyType model = new AdditionalPropertiesAnyType(); + + /** + * Model tests for AdditionalPropertiesAnyType + */ + @Test + public void testAdditionalPropertiesAnyType() { + // TODO: test AdditionalPropertiesAnyType + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java new file mode 100644 index 000000000000..4c54188964c0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesArray + */ +public class AdditionalPropertiesArrayTest { + private final AdditionalPropertiesArray model = new AdditionalPropertiesArray(); + + /** + * Model tests for AdditionalPropertiesArray + */ + @Test + public void testAdditionalPropertiesArray() { + // TODO: test AdditionalPropertiesArray + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java new file mode 100644 index 000000000000..2c801222f957 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesBoolean + */ +public class AdditionalPropertiesBooleanTest { + private final AdditionalPropertiesBoolean model = new AdditionalPropertiesBoolean(); + + /** + * Model tests for AdditionalPropertiesBoolean + */ + @Test + public void testAdditionalPropertiesBoolean() { + // TODO: test AdditionalPropertiesBoolean + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..c9f259343b94 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesClass + */ +public class AdditionalPropertiesClassTest { + private final AdditionalPropertiesClass model = new AdditionalPropertiesClass(); + + /** + * Model tests for AdditionalPropertiesClass + */ + @Test + public void testAdditionalPropertiesClass() { + // TODO: test AdditionalPropertiesClass + } + + /** + * Test the property 'mapString' + */ + @Test + public void mapStringTest() { + // TODO: test mapString + } + + /** + * Test the property 'mapNumber' + */ + @Test + public void mapNumberTest() { + // TODO: test mapNumber + } + + /** + * Test the property 'mapInteger' + */ + @Test + public void mapIntegerTest() { + // TODO: test mapInteger + } + + /** + * Test the property 'mapBoolean' + */ + @Test + public void mapBooleanTest() { + // TODO: test mapBoolean + } + + /** + * Test the property 'mapArrayInteger' + */ + @Test + public void mapArrayIntegerTest() { + // TODO: test mapArrayInteger + } + + /** + * Test the property 'mapArrayAnytype' + */ + @Test + public void mapArrayAnytypeTest() { + // TODO: test mapArrayAnytype + } + + /** + * Test the property 'mapMapString' + */ + @Test + public void mapMapStringTest() { + // TODO: test mapMapString + } + + /** + * Test the property 'mapMapAnytype' + */ + @Test + public void mapMapAnytypeTest() { + // TODO: test mapMapAnytype + } + + /** + * Test the property 'anytype1' + */ + @Test + public void anytype1Test() { + // TODO: test anytype1 + } + + /** + * Test the property 'anytype2' + */ + @Test + public void anytype2Test() { + // TODO: test anytype2 + } + + /** + * Test the property 'anytype3' + */ + @Test + public void anytype3Test() { + // TODO: test anytype3 + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java new file mode 100644 index 000000000000..5b96188630d2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesInteger + */ +public class AdditionalPropertiesIntegerTest { + private final AdditionalPropertiesInteger model = new AdditionalPropertiesInteger(); + + /** + * Model tests for AdditionalPropertiesInteger + */ + @Test + public void testAdditionalPropertiesInteger() { + // TODO: test AdditionalPropertiesInteger + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java new file mode 100644 index 000000000000..e098c76dd09f --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesNumber + */ +public class AdditionalPropertiesNumberTest { + private final AdditionalPropertiesNumber model = new AdditionalPropertiesNumber(); + + /** + * Model tests for AdditionalPropertiesNumber + */ + @Test + public void testAdditionalPropertiesNumber() { + // TODO: test AdditionalPropertiesNumber + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java new file mode 100644 index 000000000000..9c0f4e265f72 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesObject + */ +public class AdditionalPropertiesObjectTest { + private final AdditionalPropertiesObject model = new AdditionalPropertiesObject(); + + /** + * Model tests for AdditionalPropertiesObject + */ + @Test + public void testAdditionalPropertiesObject() { + // TODO: test AdditionalPropertiesObject + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java new file mode 100644 index 000000000000..187096f7462a --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesString + */ +public class AdditionalPropertiesStringTest { + private final AdditionalPropertiesString model = new AdditionalPropertiesString(); + + /** + * Model tests for AdditionalPropertiesString + */ + @Test + public void testAdditionalPropertiesString() { + // TODO: test AdditionalPropertiesString + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AnimalTest.java new file mode 100644 index 000000000000..1fc472f0fafd --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Animal + */ +public class AnimalTest { + private final Animal model = new Animal(); + + /** + * Model tests for Animal + */ + @Test + public void testAnimal() { + // TODO: test Animal + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..618a21c8a982 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfArrayOfNumberOnly + */ +public class ArrayOfArrayOfNumberOnlyTest { + private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfArrayOfNumberOnly + */ + @Test + public void testArrayOfArrayOfNumberOnly() { + // TODO: test ArrayOfArrayOfNumberOnly + } + + /** + * Test the property 'arrayArrayNumber' + */ + @Test + public void arrayArrayNumberTest() { + // TODO: test arrayArrayNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..7121b15da89f --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfNumberOnly + */ +public class ArrayOfNumberOnlyTest { + private final ArrayOfNumberOnly model = new ArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfNumberOnly + */ + @Test + public void testArrayOfNumberOnly() { + // TODO: test ArrayOfNumberOnly + } + + /** + * Test the property 'arrayNumber' + */ + @Test + public void arrayNumberTest() { + // TODO: test arrayNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ArrayTestTest.java new file mode 100644 index 000000000000..da72462ec73d --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ArrayTestTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayTest + */ +public class ArrayTestTest { + private final ArrayTest model = new ArrayTest(); + + /** + * Model tests for ArrayTest + */ + @Test + public void testArrayTest() { + // TODO: test ArrayTest + } + + /** + * Test the property 'arrayOfString' + */ + @Test + public void arrayOfStringTest() { + // TODO: test arrayOfString + } + + /** + * Test the property 'arrayArrayOfInteger' + */ + @Test + public void arrayArrayOfIntegerTest() { + // TODO: test arrayArrayOfInteger + } + + /** + * Test the property 'arrayArrayOfModel' + */ + @Test + public void arrayArrayOfModelTest() { + // TODO: test arrayArrayOfModel + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 000000000000..e2f41cc959c9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Cat; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/CapitalizationTest.java new file mode 100644 index 000000000000..8179ed092cc0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/CapitalizationTest.java @@ -0,0 +1,87 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Capitalization + */ +public class CapitalizationTest { + private final Capitalization model = new Capitalization(); + + /** + * Model tests for Capitalization + */ + @Test + public void testCapitalization() { + // TODO: test Capitalization + } + + /** + * Test the property 'smallCamel' + */ + @Test + public void smallCamelTest() { + // TODO: test smallCamel + } + + /** + * Test the property 'capitalCamel' + */ + @Test + public void capitalCamelTest() { + // TODO: test capitalCamel + } + + /** + * Test the property 'smallSnake' + */ + @Test + public void smallSnakeTest() { + // TODO: test smallSnake + } + + /** + * Test the property 'capitalSnake' + */ + @Test + public void capitalSnakeTest() { + // TODO: test capitalSnake + } + + /** + * Test the property 'scAETHFlowPoints' + */ + @Test + public void scAETHFlowPointsTest() { + // TODO: test scAETHFlowPoints + } + + /** + * Test the property 'ATT_NAME' + */ + @Test + public void ATT_NAMETest() { + // TODO: test ATT_NAME + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/CatTest.java new file mode 100644 index 000000000000..a74c3076a0b5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/CatTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Cat + */ +public class CatTest { + private final Cat model = new Cat(); + + /** + * Model tests for Cat + */ + @Test + public void testCat() { + // TODO: test Cat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..6fc9054dd7f8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ClassModelTest.java new file mode 100644 index 000000000000..23f382c5cbc5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ClassModelTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ClassModel + */ +public class ClassModelTest { + private final ClassModel model = new ClassModel(); + + /** + * Model tests for ClassModel + */ + @Test + public void testClassModel() { + // TODO: test ClassModel + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ClientTest.java new file mode 100644 index 000000000000..35cf8622cdf9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ClientTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Client + */ +public class ClientTest { + private final Client model = new Client(); + + /** + * Model tests for Client + */ + @Test + public void testClient() { + // TODO: test Client + } + + /** + * Test the property 'client' + */ + @Test + public void clientTest() { + // TODO: test client + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/DogTest.java new file mode 100644 index 000000000000..7a98584acd36 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/DogTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Dog + */ +public class DogTest { + private final Dog model = new Dog(); + + /** + * Model tests for Dog + */ + @Test + public void testDog() { + // TODO: test Dog + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/EnumArraysTest.java new file mode 100644 index 000000000000..02954e6a6839 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/EnumArraysTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumArrays + */ +public class EnumArraysTest { + private final EnumArrays model = new EnumArrays(); + + /** + * Model tests for EnumArrays + */ + @Test + public void testEnumArrays() { + // TODO: test EnumArrays + } + + /** + * Test the property 'justSymbol' + */ + @Test + public void justSymbolTest() { + // TODO: test justSymbol + } + + /** + * Test the property 'arrayEnum' + */ + @Test + public void arrayEnumTest() { + // TODO: test arrayEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/EnumClassTest.java new file mode 100644 index 000000000000..bed8681219e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/EnumClassTest.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.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumClass + */ +public class EnumClassTest { + /** + * Model tests for EnumClass + */ + @Test + public void testEnumClass() { + // TODO: test EnumClass + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/EnumTestTest.java new file mode 100644 index 000000000000..bb29f1e74613 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/EnumTestTest.java @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.OuterEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumTest + */ +public class EnumTestTest { + private final EnumTest model = new EnumTest(); + + /** + * Model tests for EnumTest + */ + @Test + public void testEnumTest() { + // TODO: test EnumTest + } + + /** + * Test the property 'enumString' + */ + @Test + public void enumStringTest() { + // TODO: test enumString + } + + /** + * Test the property 'enumStringRequired' + */ + @Test + public void enumStringRequiredTest() { + // TODO: test enumStringRequired + } + + /** + * Test the property 'enumInteger' + */ + @Test + public void enumIntegerTest() { + // TODO: test enumInteger + } + + /** + * Test the property 'enumNumber' + */ + @Test + public void enumNumberTest() { + // TODO: test enumNumber + } + + /** + * Test the property 'outerEnum' + */ + @Test + public void outerEnumTest() { + // TODO: test outerEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java new file mode 100644 index 000000000000..79eccbf4beef --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FileSchemaTestClass + */ +public class FileSchemaTestClassTest { + private final FileSchemaTestClass model = new FileSchemaTestClass(); + + /** + * Model tests for FileSchemaTestClass + */ + @Test + public void testFileSchemaTestClass() { + // TODO: test FileSchemaTestClass + } + + /** + * Test the property '_file' + */ + @Test + public void _fileTest() { + // TODO: test _file + } + + /** + * Test the property 'files' + */ + @Test + public void filesTest() { + // TODO: test files + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/FormatTestTest.java new file mode 100644 index 000000000000..14766694971d --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -0,0 +1,156 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.File; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FormatTest + */ +public class FormatTestTest { + private final FormatTest model = new FormatTest(); + + /** + * Model tests for FormatTest + */ + @Test + public void testFormatTest() { + // TODO: test FormatTest + } + + /** + * Test the property 'integer' + */ + @Test + public void integerTest() { + // TODO: test integer + } + + /** + * Test the property 'int32' + */ + @Test + public void int32Test() { + // TODO: test int32 + } + + /** + * Test the property 'int64' + */ + @Test + public void int64Test() { + // TODO: test int64 + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property '_float' + */ + @Test + public void _floatTest() { + // TODO: test _float + } + + /** + * Test the property '_double' + */ + @Test + public void _doubleTest() { + // TODO: test _double + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + + /** + * Test the property '_byte' + */ + @Test + public void _byteTest() { + // TODO: test _byte + } + + /** + * Test the property 'binary' + */ + @Test + public void binaryTest() { + // TODO: test binary + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'bigDecimal' + */ + @Test + public void bigDecimalTest() { + // TODO: test bigDecimal + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java new file mode 100644 index 000000000000..e9f2e0e27d9d --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HasOnlyReadOnly + */ +public class HasOnlyReadOnlyTest { + private final HasOnlyReadOnly model = new HasOnlyReadOnly(); + + /** + * Model tests for HasOnlyReadOnly + */ + @Test + public void testHasOnlyReadOnly() { + // TODO: test HasOnlyReadOnly + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'foo' + */ + @Test + public void fooTest() { + // TODO: test foo + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/MapTestTest.java new file mode 100644 index 000000000000..5d038c2d0fe8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/MapTestTest.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MapTest + */ +public class MapTestTest { + private final MapTest model = new MapTest(); + + /** + * Model tests for MapTest + */ + @Test + public void testMapTest() { + // TODO: test MapTest + } + + /** + * Test the property 'mapMapOfString' + */ + @Test + public void mapMapOfStringTest() { + // TODO: test mapMapOfString + } + + /** + * Test the property 'mapOfEnumString' + */ + @Test + public void mapOfEnumStringTest() { + // TODO: test mapOfEnumString + } + + /** + * Test the property 'directMap' + */ + @Test + public void directMapTest() { + // TODO: test directMap + } + + /** + * Test the property 'indirectMap' + */ + @Test + public void indirectMapTest() { + // TODO: test indirectMap + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..17838591172d --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java @@ -0,0 +1,68 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ +public class MixedPropertiesAndAdditionalPropertiesClassTest { + private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass(); + + /** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ + @Test + public void testMixedPropertiesAndAdditionalPropertiesClass() { + // TODO: test MixedPropertiesAndAdditionalPropertiesClass + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'map' + */ + @Test + public void mapTest() { + // TODO: test map + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/Model200ResponseTest.java new file mode 100644 index 000000000000..f2d8b804c0b9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/Model200ResponseTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Model200Response + */ +public class Model200ResponseTest { + private final Model200Response model = new Model200Response(); + + /** + * Model tests for Model200Response + */ + @Test + public void testModel200Response() { + // TODO: test Model200Response + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..b0d5fa0ec460 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelFileTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelFileTest.java new file mode 100644 index 000000000000..03567262c412 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelFileTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelFile + */ +public class ModelFileTest { + private final ModelFile model = new ModelFile(); + + /** + * Model tests for ModelFile + */ + @Test + public void testModelFile() { + // TODO: test ModelFile + } + + /** + * Test the property 'sourceURI' + */ + @Test + public void sourceURITest() { + // TODO: test sourceURI + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelListTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelListTest.java new file mode 100644 index 000000000000..670e48650b33 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelListTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelList + */ +public class ModelListTest { + private final ModelList model = new ModelList(); + + /** + * Model tests for ModelList + */ + @Test + public void testModelList() { + // TODO: test ModelList + } + + /** + * Test the property '_123list' + */ + @Test + public void _123listTest() { + // TODO: test _123list + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelReturnTest.java new file mode 100644 index 000000000000..74f4be0f5993 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ModelReturnTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelReturn + */ +public class ModelReturnTest { + private final ModelReturn model = new ModelReturn(); + + /** + * Model tests for ModelReturn + */ + @Test + public void testModelReturn() { + // TODO: test ModelReturn + } + + /** + * Test the property '_return' + */ + @Test + public void _returnTest() { + // TODO: test _return + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/NameTest.java new file mode 100644 index 000000000000..83b9901518f7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/NameTest.java @@ -0,0 +1,71 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Name + */ +public class NameTest { + private final Name model = new Name(); + + /** + * Model tests for Name + */ + @Test + public void testName() { + // TODO: test Name + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'snakeCase' + */ + @Test + public void snakeCaseTest() { + // TODO: test snakeCase + } + + /** + * Test the property 'property' + */ + @Test + public void propertyTest() { + // TODO: test property + } + + /** + * Test the property '_123number' + */ + @Test + public void _123numberTest() { + // TODO: test _123number + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/NumberOnlyTest.java new file mode 100644 index 000000000000..263fba35a860 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/NumberOnlyTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NumberOnly + */ +public class NumberOnlyTest { + private final NumberOnly model = new NumberOnly(); + + /** + * Model tests for NumberOnly + */ + @Test + public void testNumberOnly() { + // TODO: test NumberOnly + } + + /** + * Test the property 'justNumber' + */ + @Test + public void justNumberTest() { + // TODO: test justNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..023271431452 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/OuterCompositeTest.java new file mode 100644 index 000000000000..5ed682c3550d --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/OuterCompositeTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterComposite + */ +public class OuterCompositeTest { + private final OuterComposite model = new OuterComposite(); + + /** + * Model tests for OuterComposite + */ + @Test + public void testOuterComposite() { + // TODO: test OuterComposite + } + + /** + * Test the property 'myNumber' + */ + @Test + public void myNumberTest() { + // TODO: test myNumber + } + + /** + * Test the property 'myString' + */ + @Test + public void myStringTest() { + // TODO: test myString + } + + /** + * Test the property 'myBoolean' + */ + @Test + public void myBooleanTest() { + // TODO: test myBoolean + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/OuterEnumTest.java new file mode 100644 index 000000000000..8ab11b65cbde --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/OuterEnumTest.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.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnum + */ +public class OuterEnumTest { + /** + * Model tests for OuterEnum + */ + @Test + public void testOuterEnum() { + // TODO: test OuterEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..552828ac1f45 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/PetTest.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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java new file mode 100644 index 000000000000..290d52b66012 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadOnlyFirst + */ +public class ReadOnlyFirstTest { + private final ReadOnlyFirst model = new ReadOnlyFirst(); + + /** + * Model tests for ReadOnlyFirst + */ + @Test + public void testReadOnlyFirst() { + // TODO: test ReadOnlyFirst + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'baz' + */ + @Test + public void bazTest() { + // TODO: test baz + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java new file mode 100644 index 000000000000..14e74e01ea82 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SpecialModelName + */ +public class SpecialModelNameTest { + private final SpecialModelName model = new SpecialModelName(); + + /** + * Model tests for SpecialModelName + */ + @Test + public void testSpecialModelName() { + // TODO: test SpecialModelName + } + + /** + * Test the property '$specialPropertyName' + */ + @Test + public void $specialPropertyNameTest() { + // TODO: test $specialPropertyName + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..bf9338f4f91a --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java new file mode 100644 index 000000000000..8c431a664bda --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TypeHolderDefault + */ +public class TypeHolderDefaultTest { + private final TypeHolderDefault model = new TypeHolderDefault(); + + /** + * Model tests for TypeHolderDefault + */ + @Test + public void testTypeHolderDefault() { + // TODO: test TypeHolderDefault + } + + /** + * Test the property 'stringItem' + */ + @Test + public void stringItemTest() { + // TODO: test stringItem + } + + /** + * Test the property 'numberItem' + */ + @Test + public void numberItemTest() { + // TODO: test numberItem + } + + /** + * Test the property 'integerItem' + */ + @Test + public void integerItemTest() { + // TODO: test integerItem + } + + /** + * Test the property 'boolItem' + */ + @Test + public void boolItemTest() { + // TODO: test boolItem + } + + /** + * Test the property 'arrayItem' + */ + @Test + public void arrayItemTest() { + // TODO: test arrayItem + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java new file mode 100644 index 000000000000..65b2aa966eec --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java @@ -0,0 +1,91 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TypeHolderExample + */ +public class TypeHolderExampleTest { + private final TypeHolderExample model = new TypeHolderExample(); + + /** + * Model tests for TypeHolderExample + */ + @Test + public void testTypeHolderExample() { + // TODO: test TypeHolderExample + } + + /** + * Test the property 'stringItem' + */ + @Test + public void stringItemTest() { + // TODO: test stringItem + } + + /** + * Test the property 'numberItem' + */ + @Test + public void numberItemTest() { + // TODO: test numberItem + } + + /** + * Test the property 'floatItem' + */ + @Test + public void floatItemTest() { + // TODO: test floatItem + } + + /** + * Test the property 'integerItem' + */ + @Test + public void integerItemTest() { + // TODO: test integerItem + } + + /** + * Test the property 'boolItem' + */ + @Test + public void boolItemTest() { + // TODO: test boolItem + } + + /** + * Test the property 'arrayItem' + */ + @Test + public void arrayItemTest() { + // TODO: test arrayItem + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..5ea9705d7a43 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/UserTest.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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/XmlItemTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/XmlItemTest.java new file mode 100644 index 000000000000..9f7762e5dd92 --- /dev/null +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/test/java/org/openapitools/client/model/XmlItemTest.java @@ -0,0 +1,275 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for XmlItem + */ +public class XmlItemTest { + private final XmlItem model = new XmlItem(); + + /** + * Model tests for XmlItem + */ + @Test + public void testXmlItem() { + // TODO: test XmlItem + } + + /** + * Test the property 'attributeString' + */ + @Test + public void attributeStringTest() { + // TODO: test attributeString + } + + /** + * Test the property 'attributeNumber' + */ + @Test + public void attributeNumberTest() { + // TODO: test attributeNumber + } + + /** + * Test the property 'attributeInteger' + */ + @Test + public void attributeIntegerTest() { + // TODO: test attributeInteger + } + + /** + * Test the property 'attributeBoolean' + */ + @Test + public void attributeBooleanTest() { + // TODO: test attributeBoolean + } + + /** + * Test the property 'wrappedArray' + */ + @Test + public void wrappedArrayTest() { + // TODO: test wrappedArray + } + + /** + * Test the property 'nameString' + */ + @Test + public void nameStringTest() { + // TODO: test nameString + } + + /** + * Test the property 'nameNumber' + */ + @Test + public void nameNumberTest() { + // TODO: test nameNumber + } + + /** + * Test the property 'nameInteger' + */ + @Test + public void nameIntegerTest() { + // TODO: test nameInteger + } + + /** + * Test the property 'nameBoolean' + */ + @Test + public void nameBooleanTest() { + // TODO: test nameBoolean + } + + /** + * Test the property 'nameArray' + */ + @Test + public void nameArrayTest() { + // TODO: test nameArray + } + + /** + * Test the property 'nameWrappedArray' + */ + @Test + public void nameWrappedArrayTest() { + // TODO: test nameWrappedArray + } + + /** + * Test the property 'prefixString' + */ + @Test + public void prefixStringTest() { + // TODO: test prefixString + } + + /** + * Test the property 'prefixNumber' + */ + @Test + public void prefixNumberTest() { + // TODO: test prefixNumber + } + + /** + * Test the property 'prefixInteger' + */ + @Test + public void prefixIntegerTest() { + // TODO: test prefixInteger + } + + /** + * Test the property 'prefixBoolean' + */ + @Test + public void prefixBooleanTest() { + // TODO: test prefixBoolean + } + + /** + * Test the property 'prefixArray' + */ + @Test + public void prefixArrayTest() { + // TODO: test prefixArray + } + + /** + * Test the property 'prefixWrappedArray' + */ + @Test + public void prefixWrappedArrayTest() { + // TODO: test prefixWrappedArray + } + + /** + * Test the property 'namespaceString' + */ + @Test + public void namespaceStringTest() { + // TODO: test namespaceString + } + + /** + * Test the property 'namespaceNumber' + */ + @Test + public void namespaceNumberTest() { + // TODO: test namespaceNumber + } + + /** + * Test the property 'namespaceInteger' + */ + @Test + public void namespaceIntegerTest() { + // TODO: test namespaceInteger + } + + /** + * Test the property 'namespaceBoolean' + */ + @Test + public void namespaceBooleanTest() { + // TODO: test namespaceBoolean + } + + /** + * Test the property 'namespaceArray' + */ + @Test + public void namespaceArrayTest() { + // TODO: test namespaceArray + } + + /** + * Test the property 'namespaceWrappedArray' + */ + @Test + public void namespaceWrappedArrayTest() { + // TODO: test namespaceWrappedArray + } + + /** + * Test the property 'prefixNsString' + */ + @Test + public void prefixNsStringTest() { + // TODO: test prefixNsString + } + + /** + * Test the property 'prefixNsNumber' + */ + @Test + public void prefixNsNumberTest() { + // TODO: test prefixNsNumber + } + + /** + * Test the property 'prefixNsInteger' + */ + @Test + public void prefixNsIntegerTest() { + // TODO: test prefixNsInteger + } + + /** + * Test the property 'prefixNsBoolean' + */ + @Test + public void prefixNsBooleanTest() { + // TODO: test prefixNsBoolean + } + + /** + * Test the property 'prefixNsArray' + */ + @Test + public void prefixNsArrayTest() { + // TODO: test prefixNsArray + } + + /** + * Test the property 'prefixNsWrappedArray' + */ + @Test + public void prefixNsWrappedArrayTest() { + // TODO: test prefixNsWrappedArray + } + +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp-group-parameter/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp-group-parameter/.gitignore b/samples/client/petstore/java/okhttp-group-parameter/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/.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/client/petstore/java/okhttp-group-parameter/.openapi-generator-ignore b/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/.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/client/petstore/java/okhttp-group-parameter/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/FILES new file mode 100644 index 000000000000..98017590a055 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/FILES @@ -0,0 +1,54 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/Category.md +docs/ModelApiResponse.md +docs/Order.md +docs/Pet.md +docs/PetApi.md +docs/Tag.md +docs/User.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/User.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-group-parameter/.travis.yml b/samples/client/petstore/java/okhttp-group-parameter/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/.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/client/petstore/java/okhttp-group-parameter/README.md b/samples/client/petstore/java/okhttp-group-parameter/README.md new file mode 100644 index 000000000000..fbd8bf8d5d81 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/README.md @@ -0,0 +1,173 @@ +# petstore-okhttp-group-parameter + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-okhttp-group-parameter + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-okhttp-group-parameter' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp-group-parameter' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp-group-parameter:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/petstore-okhttp-group-parameter-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image + + +## Documentation for Models + + - [Category](docs/Category.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp-group-parameter/api/openapi.yaml b/samples/client/petstore/java/okhttp-group-parameter/api/openapi.yaml new file mode 100644 index 000000000000..80c98f47cea9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/api/openapi.yaml @@ -0,0 +1,519 @@ +openapi: 3.0.0 +info: + description: "This is a sample server Petstore server. For this sample, you can\ + \ use the api key `special-key` to test the authorization filters." + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + put: + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-group-parameters: false + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + Order: + description: An order for a pets from the pet store + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object + xml: + name: Order + Category: + description: A category for a pet + example: + id: 6 + name: name + properties: + id: + format: int64 + type: integer + name: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + title: Pet category + type: object + xml: + name: Category + User: + description: A User who is purchasing from the pet store + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Tag: + description: A tag for a pet + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + Pet: + description: A pet for sale in the pet store + example: + id: 0 + category: + id: 6 + name: name + name: doggie + photoUrls: + - photoUrls + - photoUrls + tags: + - id: 1 + name: name + - id: 1 + name: name + status: available + properties: + id: + format: int64 + type: integer + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + diff --git a/samples/client/petstore/java/okhttp-group-parameter/build.gradle b/samples/client/petstore/java/okhttp-group-parameter/build.gradle new file mode 100644 index 000000000000..e1a6e8d258e6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/build.gradle @@ -0,0 +1,64 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-okhttp-group-parameter' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/build.sbt b/samples/client/petstore/java/okhttp-group-parameter/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp-group-parameter/docs/Category.md b/samples/client/petstore/java/okhttp-group-parameter/docs/Category.md new file mode 100644 index 000000000000..a7fc939d252e --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/docs/Category.md @@ -0,0 +1,15 @@ + + +# Category + +A category for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-group-parameter/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-group-parameter/docs/ModelApiResponse.md new file mode 100644 index 000000000000..cd7e3c400be6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/docs/ModelApiResponse.md @@ -0,0 +1,16 @@ + + +# ModelApiResponse + +Describes the result of uploading an image resource + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-group-parameter/docs/Order.md b/samples/client/petstore/java/okhttp-group-parameter/docs/Order.md new file mode 100644 index 000000000000..0c33059b8b6a --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/docs/Order.md @@ -0,0 +1,29 @@ + + +# Order + +An order for a pets from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp-group-parameter/docs/Pet.md b/samples/client/petstore/java/okhttp-group-parameter/docs/Pet.md new file mode 100644 index 000000000000..8bb363301232 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/docs/Pet.md @@ -0,0 +1,29 @@ + + +# Pet + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-group-parameter/docs/PetApi.md b/samples/client/petstore/java/okhttp-group-parameter/docs/PetApi.md new file mode 100644 index 000000000000..d7676885b4b6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/docs/PetApi.md @@ -0,0 +1,580 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | + + + +# **addPet** +> Pet addPet(pet).execute(); + +Add a new pet to the store + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +# **deletePet** +> deletePet(petId).apiKey(apiKey).execute(); + +Deletes a pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId) + .apiKey(apiKey) + .execute(); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status).execute(); + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags).execute(); + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +# **getPetById** +> Pet getPetById(petId).execute(); + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +# **updatePet** +> Pet updatePet(pet).execute(); + +Update an existing pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.updatePet(pet) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **uploadFile** +> ModelApiResponse uploadFile(petId).additionalMetadata(additionalMetadata)._file(_file).execute(); + +uploads an image + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId) + .additionalMetadata(additionalMetadata) + ._file(_file) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-group-parameter/docs/Tag.md b/samples/client/petstore/java/okhttp-group-parameter/docs/Tag.md new file mode 100644 index 000000000000..abfde4afb501 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/docs/Tag.md @@ -0,0 +1,15 @@ + + +# Tag + +A tag for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-group-parameter/docs/User.md b/samples/client/petstore/java/okhttp-group-parameter/docs/User.md new file mode 100644 index 000000000000..426845227bd3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/docs/User.md @@ -0,0 +1,21 @@ + + +# User + +A User who is purchasing from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-group-parameter/git_push.sh b/samples/client/petstore/java/okhttp-group-parameter/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp-group-parameter/gradle.properties b/samples/client/petstore/java/okhttp-group-parameter/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-group-parameter/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-group-parameter/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-group-parameter/gradlew.bat b/samples/client/petstore/java/okhttp-group-parameter/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp-group-parameter/pom.xml b/samples/client/petstore/java/okhttp-group-parameter/pom.xml new file mode 100644 index 000000000000..9e6b4bb088aa --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/pom.xml @@ -0,0 +1,284 @@ + + 4.0.0 + org.openapitools + petstore-okhttp-group-parameter + jar + petstore-okhttp-group-parameter + 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-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.10.1 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp-group-parameter/settings.gradle b/samples/client/petstore/java/okhttp-group-parameter/settings.gradle new file mode 100644 index 000000000000..f7159b474695 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-okhttp-group-parameter" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-group-parameter/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..e818a511443e --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..deb938b73b46 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1727 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://petstore.swagger.io/v2"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = ""; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io/v2) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..bbe1b2c8ee33 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..189537deb549 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..ba56d6cab13d --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..01aa8bb7a1f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,445 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Category.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelApiResponse.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Order.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Pet.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Tag.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.User.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..8b84ab37c82a --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..673ffc4cbb7b --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..10eeda6a297e --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..ae47d8bdb452 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..1b09cdb8d75c --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..a4859da9a700 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..19ce937edbc6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1444 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PetApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call addPetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addPetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling addPet(Async)"); + } + + return addPetCall(pet, _callback); + + } + + + private ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call addPetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIaddPetRequest { + @javax.annotation.Nonnull + private final Pet pet; + + private APIaddPetRequest(@javax.annotation.Nonnull Pet pet) { + this.pet = pet; + } + + /** + * Build call for addPet + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return addPetCall(pet, _callback); + } + + /** + * Execute addPet request + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public Pet execute() throws ApiException { + ApiResponse localVarResp = addPetWithHttpInfo(pet); + return localVarResp.getData(); + } + + /** + * Execute addPet request with HTTP info returned + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return addPetWithHttpInfo(pet); + } + + /** + * Execute addPet request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return addPetAsync(pet, _callback); + } + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return APIaddPetRequest + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public APIaddPetRequest addPet(@javax.annotation.Nonnull Pet pet) { + return new APIaddPetRequest(pet); + } + private okhttp3.Call deletePetCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePetValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); + } + + return deletePetCall(petId, apiKey, _callback); + + } + + + private ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deletePetAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIdeletePetRequest { + @javax.annotation.Nonnull + private final Long petId; + @javax.annotation.Nullable + private String apiKey; + + private APIdeletePetRequest(@javax.annotation.Nonnull Long petId) { + this.petId = petId; + } + + /** + * Set apiKey + * @param apiKey (optional) + * @return APIdeletePetRequest + */ + public APIdeletePetRequest apiKey(@javax.annotation.Nullable String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Build call for deletePet + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deletePetCall(petId, apiKey, _callback); + } + + /** + * Execute deletePet request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public void execute() throws ApiException { + deletePetWithHttpInfo(petId, apiKey); + } + + /** + * Execute deletePet request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deletePetWithHttpInfo(petId, apiKey); + } + + /** + * Execute deletePet request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deletePetAsync(petId, apiKey, _callback); + } + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @return APIdeletePetRequest + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public APIdeletePetRequest deletePet(@javax.annotation.Nonnull Long petId) { + return new APIdeletePetRequest(petId); + } + private okhttp3.Call findPetsByStatusCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "status", status)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByStatusValidateBeforeCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + + return findPetsByStatusCall(status, _callback); + + } + + + private ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call findPetsByStatusAsync(@javax.annotation.Nonnull List status, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIfindPetsByStatusRequest { + @javax.annotation.Nonnull + private final List status; + + private APIfindPetsByStatusRequest(@javax.annotation.Nonnull List status) { + this.status = status; + } + + /** + * Build call for findPetsByStatus + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return findPetsByStatusCall(status, _callback); + } + + /** + * Execute findPetsByStatus request + * @return List<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = findPetsByStatusWithHttpInfo(status); + return localVarResp.getData(); + } + + /** + * Execute findPetsByStatus request with HTTP info returned + * @return ApiResponse<List<Pet>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return findPetsByStatusWithHttpInfo(status); + } + + /** + * Execute findPetsByStatus request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return findPetsByStatusAsync(status, _callback); + } + } + + /** + * 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 APIfindPetsByStatusRequest + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public APIfindPetsByStatusRequest findPetsByStatus(@javax.annotation.Nonnull List status) { + return new APIfindPetsByStatusRequest(status); + } + private okhttp3.Call findPetsByTagsCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByTagsValidateBeforeCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); + } + + return findPetsByTagsCall(tags, _callback); + + } + + + private ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call findPetsByTagsAsync(@javax.annotation.Nonnull List tags, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIfindPetsByTagsRequest { + @javax.annotation.Nonnull + private final List tags; + + private APIfindPetsByTagsRequest(@javax.annotation.Nonnull List tags) { + this.tags = tags; + } + + /** + * Build call for findPetsByTags + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return findPetsByTagsCall(tags, _callback); + } + + /** + * Execute findPetsByTags request + * @return List<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public List execute() throws ApiException { + ApiResponse> localVarResp = findPetsByTagsWithHttpInfo(tags); + return localVarResp.getData(); + } + + /** + * Execute findPetsByTags request with HTTP info returned + * @return ApiResponse<List<Pet>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> executeWithHttpInfo() throws ApiException { + return findPetsByTagsWithHttpInfo(tags); + } + + /** + * Execute findPetsByTags request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return findPetsByTagsAsync(tags, _callback); + } + } + + /** + * 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 APIfindPetsByTagsRequest + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public APIfindPetsByTagsRequest findPetsByTags(@javax.annotation.Nonnull List tags) { + return new APIfindPetsByTagsRequest(tags); + } + private okhttp3.Call getPetByIdCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + return getPetByIdCall(petId, _callback); + + } + + + private ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getPetByIdAsync(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIgetPetByIdRequest { + @javax.annotation.Nonnull + private final Long petId; + + private APIgetPetByIdRequest(@javax.annotation.Nonnull Long petId) { + this.petId = petId; + } + + /** + * Build call for getPetById + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getPetByIdCall(petId, _callback); + } + + /** + * Execute getPetById request + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet execute() throws ApiException { + ApiResponse localVarResp = getPetByIdWithHttpInfo(petId); + return localVarResp.getData(); + } + + /** + * Execute getPetById request with HTTP info returned + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getPetByIdWithHttpInfo(petId); + } + + /** + * Execute getPetById request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getPetByIdAsync(petId, _callback); + } + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return APIgetPetByIdRequest + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public APIgetPetByIdRequest getPetById(@javax.annotation.Nonnull Long petId) { + return new APIgetPetByIdRequest(petId); + } + private okhttp3.Call updatePetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling updatePet(Async)"); + } + + return updatePetCall(pet, _callback); + + } + + + private ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call updatePetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIupdatePetRequest { + @javax.annotation.Nonnull + private final Pet pet; + + private APIupdatePetRequest(@javax.annotation.Nonnull Pet pet) { + this.pet = pet; + } + + /** + * Build call for updatePet + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return updatePetCall(pet, _callback); + } + + /** + * Execute updatePet request + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public Pet execute() throws ApiException { + ApiResponse localVarResp = updatePetWithHttpInfo(pet); + return localVarResp.getData(); + } + + /** + * Execute updatePet request with HTTP info returned + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return updatePetWithHttpInfo(pet); + } + + /** + * Execute updatePet request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return updatePetAsync(pet, _callback); + } + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return APIupdatePetRequest + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public APIupdatePetRequest updatePet(@javax.annotation.Nonnull Pet pet) { + return new APIupdatePetRequest(pet); + } + /** + * Build call for updatePetWithForm + * @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) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetWithFormValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); + } + + return updatePetWithFormCall(petId, name, status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updates a pet in the store with form data (asynchronously) + * + * @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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + private okhttp3.Call uploadFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); + } + + return uploadFileCall(petId, additionalMetadata, _file, _callback); + + } + + + private ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIuploadFileRequest { + @javax.annotation.Nonnull + private final Long petId; + @javax.annotation.Nullable + private String additionalMetadata; + @javax.annotation.Nullable + private File _file; + + private APIuploadFileRequest(@javax.annotation.Nonnull Long petId) { + this.petId = petId; + } + + /** + * Set additionalMetadata + * @param additionalMetadata Additional data to pass to server (optional) + * @return APIuploadFileRequest + */ + public APIuploadFileRequest additionalMetadata(@javax.annotation.Nullable String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + return this; + } + + /** + * Set _file + * @param _file file to upload (optional) + * @return APIuploadFileRequest + */ + public APIuploadFileRequest _file(@javax.annotation.Nullable File _file) { + this._file = _file; + return this; + } + + /** + * Build call for uploadFile + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return uploadFileCall(petId, additionalMetadata, _file, _callback); + } + + /** + * Execute uploadFile request + * @return ModelApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse execute() throws ApiException { + ApiResponse localVarResp = uploadFileWithHttpInfo(petId, additionalMetadata, _file); + return localVarResp.getData(); + } + + /** + * Execute uploadFile request with HTTP info returned + * @return ApiResponse<ModelApiResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return uploadFileWithHttpInfo(petId, additionalMetadata, _file); + } + + /** + * Execute uploadFile request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return uploadFileAsync(petId, additionalMetadata, _file, _callback); + } + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @return APIuploadFileRequest + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public APIuploadFileRequest uploadFile(@javax.annotation.Nonnull Long petId) { + return new APIuploadFileRequest(petId); + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..334ae1f6fd40 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..07839e9966cf --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..85d6556f1f68 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..f728b306c358 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..0b5e71fe6212 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,43 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..0de7ae9fc491 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..57db3963e4f6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..75a1d304801f --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..bdd0ae91976f --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,142 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..1332de3a1697 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,311 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A category for a pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Category { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, category.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Category + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Category.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Category' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Category.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Category value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Category read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Category given an JSON string + * + * @param jsonString JSON string + * @return An instance of Category + * @throws IOException if the JSON string is invalid with respect to Category + */ + public static Category fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Category.class); + } + + /** + * Convert an instance of Category to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..1bc343bd5338 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,341 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Describes the result of uploading an image resource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelApiResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + + public Integer getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, _apiResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("code", "type", "message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelApiResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelApiResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelApiResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelApiResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelApiResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelApiResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelApiResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelApiResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelApiResponse + * @throws IOException if the JSON string is invalid with respect to ModelApiResponse + */ + public static ModelApiResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelApiResponse.class); + } + + /** + * Convert an instance of ModelApiResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..db0571d69be1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,478 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * An order for a pets from the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Order { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_PET_ID = "petId"; + @SerializedName(SERIALIZED_NAME_PET_ID) + @javax.annotation.Nullable + private Long petId; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; + @SerializedName(SERIALIZED_NAME_SHIP_DATE) + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_COMPLETE = "complete"; + @SerializedName(SERIALIZED_NAME_COMPLETE) + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + + public Long getPetId() { + return petId; + } + + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + + public OffsetDateTime getShipDate() { + return shipDate; + } + + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + + public Boolean getComplete() { + return complete; + } + + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, order.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "petId", "quantity", "shipDate", "status", "complete")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Order + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Order.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Order' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Order.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Order value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Order read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Order instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Order given an JSON string + * + * @param jsonString JSON string + * @return An instance of Order + * @throws IOException if the JSON string is invalid with respect to Order + */ + public static Order fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Order.class); + } + + /** + * Convert an instance of Order to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..385b0eb2ad13 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,537 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A pet for sale in the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pet { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @Deprecated + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable 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 + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + @Deprecated + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + @Deprecated + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, pet.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Pet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Pet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Pet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Pet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Pet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Pet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Pet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Pet given an JSON string + * + * @param jsonString JSON string + * @return An instance of Pet + * @throws IOException if the JSON string is invalid with respect to Pet + */ + public static Pet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Pet.class); + } + + /** + * Convert an instance of Pet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..de14a3aee9b3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,311 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A tag for a pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Tag { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Tag + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Tag.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Tag' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Tag value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Tag read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Tag given an JSON string + * + * @param jsonString JSON string + * @return An instance of Tag + * @throws IOException if the JSON string is invalid with respect to Tag + */ + public static Tag fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Tag.class); + } + + /** + * Convert an instance of Tag to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..01d7a093236a --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,488 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A User who is purchasing from the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class User { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nullable + private String username; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nullable + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nullable + private String lastName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nullable + private String password; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nullable + private String phone; + + public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; + @SerializedName(SERIALIZED_NAME_USER_STATUS) + @javax.annotation.Nullable + private Integer userStatus; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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.additionalProperties, user.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to User + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) && !jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!User.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'User' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(User.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, User value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public User read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of User given an JSON string + * + * @param jsonString JSON string + * @return An instance of User + * @throws IOException if the JSON string is invalid with respect to User + */ + public static User fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, User.class); + } + + /** + * Convert an instance of User to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..0aa0fcd8fdd1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,163 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + Pet response = api.addPet(pet) + .execute(); + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + api.deletePet(petId) + .apiKey(apiKey) + .execute(); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = api.findPetsByStatus(status) + .execute(); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = api.findPetsByTags(tags) + .execute(); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = api.getPetById(petId) + .execute(); + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + Pet response = api.updatePet(pet) + .execute(); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.uploadFile(petId) + .additionalMetadata(additionalMetadata) + ._file(_file) + .execute(); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..5bf64f190609 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..91f7c6e7b08b --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..68d51864f2e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..1dbb74a230c4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..baef6f40d3a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..1be6c73e32cd --- /dev/null +++ b/samples/client/petstore/java/okhttp-group-parameter/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 6afed7044204..22113560c03d 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -384,6 +384,50 @@ public void setAnytype3(@javax.annotation.Nullable Object anytype3) { this.anytype3 = anytype3; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesClass instance itself + */ + public AdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -405,12 +449,13 @@ public boolean equals(Object o) { Objects.equals(this.mapMapAnytype, additionalPropertiesClass.mapMapAnytype) && Objects.equals(this.anytype1, additionalPropertiesClass.anytype1) && Objects.equals(this.anytype2, additionalPropertiesClass.anytype2) && - Objects.equals(this.anytype3, additionalPropertiesClass.anytype3); + Objects.equals(this.anytype3, additionalPropertiesClass.anytype3)&& + Objects.equals(this.additionalProperties, additionalPropertiesClass.additionalProperties); } @Override public int hashCode() { - return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); + return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3, additionalProperties); } @Override @@ -428,6 +473,7 @@ public String toString() { sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n"); sb.append(" anytype2: ").append(toIndentedString(anytype2)).append("\n"); sb.append(" anytype3: ").append(toIndentedString(anytype3)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -464,14 +510,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesClass is not found in the empty JSON string", AdditionalPropertiesClass.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!AdditionalPropertiesClass.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `AdditionalPropertiesClass` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); } @@ -490,6 +528,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, AdditionalPropertiesClass value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -497,7 +557,28 @@ public void write(JsonWriter out, AdditionalPropertiesClass value) throws IOExce public AdditionalPropertiesClass read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java index 2bd79e51c96c..70ac4a92edb2 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java @@ -101,6 +101,50 @@ public void setColor(@javax.annotation.Nullable String color) { this.color = color; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Animal instance itself + */ + public Animal putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -113,12 +157,13 @@ public boolean equals(Object o) { } Animal animal = (Animal) o; return Objects.equals(this.className, animal.className) && - Objects.equals(this.color, animal.color); + Objects.equals(this.color, animal.color)&& + Objects.equals(this.additionalProperties, animal.additionalProperties); } @Override public int hashCode() { - return Objects.hash(className, color); + return Objects.hash(className, color, additionalProperties); } @Override @@ -127,6 +172,7 @@ public String toString() { sb.append("class Animal {\n"); sb.append(" className: ").append(toIndentedString(className)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index db4475ecbd4b..df10642a77cb 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -87,6 +87,50 @@ public void setArrayArrayNumber(@javax.annotation.Nullable List this.arrayArrayNumber = arrayArrayNumber; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfArrayOfNumberOnly instance itself + */ + public ArrayOfArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; - return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber)&& + Objects.equals(this.additionalProperties, arrayOfArrayOfNumberOnly.additionalProperties); } @Override public int hashCode() { - return Objects.hash(arrayArrayNumber); + return Objects.hash(arrayArrayNumber, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ArrayOfArrayOfNumberOnly {\n"); sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -147,14 +193,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayOfArrayOfNumberOnly is not found in the empty JSON string", ArrayOfArrayOfNumberOnly.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ArrayOfArrayOfNumberOnly.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ArrayOfArrayOfNumberOnly` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the optional json data is an array if present if (jsonObj.get("ArrayArrayNumber") != null && !jsonObj.get("ArrayArrayNumber").isJsonNull() && !jsonObj.get("ArrayArrayNumber").isJsonArray()) { @@ -177,6 +215,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ArrayOfArrayOfNumberOnly value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +244,28 @@ public void write(JsonWriter out, ArrayOfArrayOfNumberOnly value) throws IOExcep public ArrayOfArrayOfNumberOnly read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayOfArrayOfNumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index ef4271dea400..16962e6b6061 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -87,6 +87,50 @@ public void setArrayNumber(@javax.annotation.Nullable List arrayNumb this.arrayNumber = arrayNumber; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfNumberOnly instance itself + */ + public ArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; - return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber)&& + Objects.equals(this.additionalProperties, arrayOfNumberOnly.additionalProperties); } @Override public int hashCode() { - return Objects.hash(arrayNumber); + return Objects.hash(arrayNumber, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ArrayOfNumberOnly {\n"); sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -147,14 +193,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayOfNumberOnly is not found in the empty JSON string", ArrayOfNumberOnly.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ArrayOfNumberOnly.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ArrayOfNumberOnly` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the optional json data is an array if present if (jsonObj.get("ArrayNumber") != null && !jsonObj.get("ArrayNumber").isJsonNull() && !jsonObj.get("ArrayNumber").isJsonArray()) { @@ -177,6 +215,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ArrayOfNumberOnly value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +244,28 @@ public void write(JsonWriter out, ArrayOfNumberOnly value) throws IOException { public ArrayOfNumberOnly read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayOfNumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java index c76aa8cbf48f..e83d4cc8268f 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -151,6 +151,50 @@ public void setArrayArrayOfModel(@javax.annotation.Nullable List additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayTest instance itself + */ + public ArrayTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -164,12 +208,13 @@ public boolean equals(Object o) { ArrayTest arrayTest = (ArrayTest) o; return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && - Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel)&& + Objects.equals(this.additionalProperties, arrayTest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel, additionalProperties); } @Override @@ -179,6 +224,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -215,14 +261,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayTest is not found in the empty JSON string", ArrayTest.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ArrayTest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ArrayTest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the optional json data is an array if present if (jsonObj.get("array_of_string") != null && !jsonObj.get("array_of_string").isJsonNull() && !jsonObj.get("array_of_string").isJsonArray()) { @@ -253,6 +291,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ArrayTest value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -260,7 +320,28 @@ public void write(JsonWriter out, ArrayTest value) throws IOException { public ArrayTest read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java index 6c7a8ac73e6e..c72c7857825f 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java @@ -134,6 +134,50 @@ public void setKind(@javax.annotation.Nullable KindEnum kind) { this.kind = kind; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BigCat instance itself + */ + public BigCat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -145,13 +189,14 @@ public boolean equals(Object o) { return false; } BigCat bigCat = (BigCat) o; - return Objects.equals(this.kind, bigCat.kind) && + return Objects.equals(this.kind, bigCat.kind)&& + Objects.equals(this.additionalProperties, bigCat.additionalProperties) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(kind, super.hashCode()); + return Objects.hash(kind, super.hashCode(), additionalProperties); } @Override @@ -160,6 +205,7 @@ public String toString() { sb.append("class BigCat {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -197,14 +243,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!BigCat.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `BigCat` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : BigCat.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -228,6 +266,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, BigCat value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -235,7 +295,28 @@ public void write(JsonWriter out, BigCat value) throws IOException { public BigCat read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BigCat instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java index 03335a1000f6..2cde2a9a7213 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java @@ -196,6 +196,50 @@ public void setATTNAME(@javax.annotation.Nullable String ATT_NAME) { this.ATT_NAME = ATT_NAME; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Capitalization instance itself + */ + public Capitalization putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -212,12 +256,13 @@ public boolean equals(Object o) { 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); + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME)&& + Objects.equals(this.additionalProperties, capitalization.additionalProperties); } @Override public int hashCode() { - return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME, additionalProperties); } @Override @@ -230,6 +275,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -266,14 +312,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Capitalization is not found in the empty JSON string", Capitalization.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Capitalization.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Capitalization` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("smallCamel") != null && !jsonObj.get("smallCamel").isJsonNull()) && !jsonObj.get("smallCamel").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `smallCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("smallCamel").toString())); @@ -310,6 +348,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Capitalization value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -317,7 +377,28 @@ public void write(JsonWriter out, Capitalization value) throws IOException { public Capitalization read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Capitalization instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java index b005b5f13a13..a48a8529ac55 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java @@ -78,6 +78,50 @@ public void setDeclawed(@javax.annotation.Nullable Boolean declawed) { this.declawed = declawed; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Cat instance itself + */ + public Cat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -89,13 +133,14 @@ public boolean equals(Object o) { return false; } Cat cat = (Cat) o; - return Objects.equals(this.declawed, cat.declawed) && + return Objects.equals(this.declawed, cat.declawed)&& + Objects.equals(this.additionalProperties, cat.additionalProperties) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(declawed, super.hashCode()); + return Objects.hash(declawed, super.hashCode(), additionalProperties); } @Override @@ -104,6 +149,7 @@ public String toString() { sb.append("class Cat {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java index 0f0dc8bc2c85..720078c9bc64 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java @@ -100,6 +100,50 @@ public void setName(@javax.annotation.Nonnull String name) { this.name = name; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } Category category = (Category) o; return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); + Objects.equals(this.name, category.name)&& + Objects.equals(this.additionalProperties, category.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, name); + return Objects.hash(id, name, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class Category {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -163,14 +209,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Category.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Category` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Category.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -198,6 +236,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Category value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -205,7 +265,28 @@ public void write(JsonWriter out, Category value) throws IOException { public Category read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java index 46f4d56fa529..345ece2a62b4 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java @@ -76,6 +76,50 @@ public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { this.propertyClass = propertyClass; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ClassModel instance itself + */ + public ClassModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } ClassModel classModel = (ClassModel) o; - return Objects.equals(this.propertyClass, classModel.propertyClass); + return Objects.equals(this.propertyClass, classModel.propertyClass)&& + Objects.equals(this.additionalProperties, classModel.additionalProperties); } @Override public int hashCode() { - return Objects.hash(propertyClass); + return Objects.hash(propertyClass, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ClassModel {\n"); sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -136,14 +182,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ClassModel is not found in the empty JSON string", ClassModel.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ClassModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ClassModel` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("_class") != null && !jsonObj.get("_class").isJsonNull()) && !jsonObj.get("_class").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `_class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_class").toString())); @@ -165,6 +203,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ClassModel value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -172,7 +232,28 @@ public void write(JsonWriter out, ClassModel value) throws IOException { public ClassModel read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ClassModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java index 85990b595635..003e850dd04e 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java @@ -76,6 +76,50 @@ public void setClient(@javax.annotation.Nullable String client) { this.client = client; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Client instance itself + */ + public Client putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } Client client = (Client) o; - return Objects.equals(this.client, client.client); + return Objects.equals(this.client, client.client)&& + Objects.equals(this.additionalProperties, client.additionalProperties); } @Override public int hashCode() { - return Objects.hash(client); + return Objects.hash(client, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Client {\n"); sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -136,14 +182,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Client is not found in the empty JSON string", Client.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Client.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Client` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("client") != null && !jsonObj.get("client").isJsonNull()) && !jsonObj.get("client").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `client` to be a primitive type in the JSON string but got `%s`", jsonObj.get("client").toString())); @@ -165,6 +203,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Client value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -172,7 +232,28 @@ public void write(JsonWriter out, Client value) throws IOException { public Client read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Client instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java index b83ab44cf0bb..1271dbf9d904 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java @@ -78,6 +78,50 @@ public void setBreed(@javax.annotation.Nullable String breed) { this.breed = breed; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Dog instance itself + */ + public Dog putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -89,13 +133,14 @@ public boolean equals(Object o) { return false; } Dog dog = (Dog) o; - return Objects.equals(this.breed, dog.breed) && + return Objects.equals(this.breed, dog.breed)&& + Objects.equals(this.additionalProperties, dog.additionalProperties) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(breed, super.hashCode()); + return Objects.hash(breed, super.hashCode(), additionalProperties); } @Override @@ -104,6 +149,7 @@ public String toString() { sb.append("class Dog {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -141,14 +187,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Dog.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Dog` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Dog.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -172,6 +210,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Dog value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -179,7 +239,28 @@ public void write(JsonWriter out, Dog value) throws IOException { public Dog read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Dog instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java index 45402568a797..3fb6e4dbcf88 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -214,6 +214,50 @@ public void setArrayEnum(@javax.annotation.Nullable List arrayEnu this.arrayEnum = arrayEnum; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumArrays instance itself + */ + public EnumArrays putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -226,12 +270,13 @@ public boolean equals(Object o) { } EnumArrays enumArrays = (EnumArrays) o; return Objects.equals(this.justSymbol, enumArrays.justSymbol) && - Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + Objects.equals(this.arrayEnum, enumArrays.arrayEnum)&& + Objects.equals(this.additionalProperties, enumArrays.additionalProperties); } @Override public int hashCode() { - return Objects.hash(justSymbol, arrayEnum); + return Objects.hash(justSymbol, arrayEnum, additionalProperties); } @Override @@ -240,6 +285,7 @@ public String toString() { sb.append("class EnumArrays {\n"); sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -276,14 +322,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in EnumArrays is not found in the empty JSON string", EnumArrays.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!EnumArrays.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `EnumArrays` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonNull()) && !jsonObj.get("just_symbol").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `just_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("just_symbol").toString())); @@ -313,6 +351,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, EnumArrays value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -320,7 +380,28 @@ public void write(JsonWriter out, EnumArrays value) throws IOException { public EnumArrays read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EnumArrays instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java index 954ea4637064..99715d004485 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java @@ -385,6 +385,50 @@ public void setOuterEnum(@javax.annotation.Nullable OuterEnum outerEnum) { this.outerEnum = outerEnum; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumTest instance itself + */ + public EnumTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -400,12 +444,13 @@ public boolean equals(Object o) { 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.outerEnum, enumTest.outerEnum)&& + Objects.equals(this.additionalProperties, enumTest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, additionalProperties); } @Override @@ -417,6 +462,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -454,14 +500,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!EnumTest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `EnumTest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : EnumTest.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -510,6 +548,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, EnumTest value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -517,7 +577,28 @@ public void write(JsonWriter out, EnumTest value) throws IOException { public EnumTest read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EnumTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 8d322de80756..ee3179eae92c 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -111,6 +111,50 @@ public void setFiles(@javax.annotation.Nullable List files) { this.files = files; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FileSchemaTestClass instance itself + */ + public FileSchemaTestClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -123,12 +167,13 @@ public boolean equals(Object o) { } FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; return Objects.equals(this._file, fileSchemaTestClass._file) && - Objects.equals(this.files, fileSchemaTestClass.files); + Objects.equals(this.files, fileSchemaTestClass.files)&& + Objects.equals(this.additionalProperties, fileSchemaTestClass.additionalProperties); } @Override public int hashCode() { - return Objects.hash(_file, files); + return Objects.hash(_file, files, additionalProperties); } @Override @@ -137,6 +182,7 @@ public String toString() { sb.append("class FileSchemaTestClass {\n"); sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); sb.append(" files: ").append(toIndentedString(files)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -173,14 +219,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FileSchemaTestClass is not found in the empty JSON string", FileSchemaTestClass.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!FileSchemaTestClass.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FileSchemaTestClass` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // validate the optional field `file` if (jsonObj.get("file") != null && !jsonObj.get("file").isJsonNull()) { @@ -217,6 +255,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, FileSchemaTestClass value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -224,7 +284,28 @@ public void write(JsonWriter out, FileSchemaTestClass value) throws IOException public FileSchemaTestClass read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FileSchemaTestClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java index 85dcc8fd93ff..ceb756d3ef9b 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java @@ -403,6 +403,50 @@ public void setBigDecimal(@javax.annotation.Nullable BigDecimal bigDecimal) { this.bigDecimal = bigDecimal; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FormatTest instance itself + */ + public FormatTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -427,12 +471,13 @@ public boolean equals(Object o) { Objects.equals(this.dateTime, formatTest.dateTime) && Objects.equals(this.uuid, formatTest.uuid) && Objects.equals(this.password, formatTest.password) && - Objects.equals(this.bigDecimal, formatTest.bigDecimal); + Objects.equals(this.bigDecimal, formatTest.bigDecimal)&& + Objects.equals(this.additionalProperties, formatTest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal, additionalProperties); } @Override @@ -453,6 +498,7 @@ public String toString() { sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" password: ").append("*").append("\n"); sb.append(" bigDecimal: ").append(toIndentedString(bigDecimal)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -490,14 +536,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!FormatTest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FormatTest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : FormatTest.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -531,6 +569,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, FormatTest value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -538,7 +598,28 @@ public void write(JsonWriter out, FormatTest value) throws IOException { public FormatTest read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FormatTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 83c564ac338b..5b65e8ee1671 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -93,6 +93,50 @@ public String getFoo() { } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the HasOnlyReadOnly instance itself + */ + public HasOnlyReadOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -105,12 +149,13 @@ public boolean equals(Object o) { } HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; return Objects.equals(this.bar, hasOnlyReadOnly.bar) && - Objects.equals(this.foo, hasOnlyReadOnly.foo); + Objects.equals(this.foo, hasOnlyReadOnly.foo)&& + Objects.equals(this.additionalProperties, hasOnlyReadOnly.additionalProperties); } @Override public int hashCode() { - return Objects.hash(bar, foo); + return Objects.hash(bar, foo, additionalProperties); } @Override @@ -119,6 +164,7 @@ public String toString() { sb.append("class HasOnlyReadOnly {\n"); sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); sb.append(" foo: ").append(toIndentedString(foo)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -155,14 +201,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in HasOnlyReadOnly is not found in the empty JSON string", HasOnlyReadOnly.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!HasOnlyReadOnly.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `HasOnlyReadOnly` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonNull()) && !jsonObj.get("bar").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); @@ -187,6 +225,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, HasOnlyReadOnly value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -194,7 +254,28 @@ public void write(JsonWriter out, HasOnlyReadOnly value) throws IOException { public HasOnlyReadOnly read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + HasOnlyReadOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java index 63e6cf47c253..2c2311ec7ce4 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java @@ -234,6 +234,50 @@ public void setIndirectMap(@javax.annotation.Nullable Map indir this.indirectMap = indirectMap; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MapTest instance itself + */ + public MapTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -248,12 +292,13 @@ public boolean equals(Object 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); + Objects.equals(this.indirectMap, mapTest.indirectMap)&& + Objects.equals(this.additionalProperties, mapTest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap, additionalProperties); } @Override @@ -264,6 +309,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -300,14 +346,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in MapTest is not found in the empty JSON string", MapTest.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MapTest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `MapTest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); } @@ -326,6 +364,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MapTest value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -333,7 +393,28 @@ public void write(JsonWriter out, MapTest value) throws IOException { public MapTest read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MapTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index e1966532c23a..7207c1f27d9c 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -137,6 +137,50 @@ public void setMap(@javax.annotation.Nullable Map map) { this.map = map; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MixedPropertiesAndAdditionalPropertiesClass instance itself + */ + public MixedPropertiesAndAdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -150,12 +194,13 @@ public boolean equals(Object o) { MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && - Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map)&& + Objects.equals(this.additionalProperties, mixedPropertiesAndAdditionalPropertiesClass.additionalProperties); } @Override public int hashCode() { - return Objects.hash(uuid, dateTime, map); + return Objects.hash(uuid, dateTime, map, additionalProperties); } @Override @@ -165,6 +210,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -201,14 +247,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in MixedPropertiesAndAdditionalPropertiesClass is not found in the empty JSON string", MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MixedPropertiesAndAdditionalPropertiesClass.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `MixedPropertiesAndAdditionalPropertiesClass` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); @@ -230,6 +268,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MixedPropertiesAndAdditionalPropertiesClass value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -237,7 +297,28 @@ public void write(JsonWriter out, MixedPropertiesAndAdditionalPropertiesClass va public MixedPropertiesAndAdditionalPropertiesClass read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MixedPropertiesAndAdditionalPropertiesClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java index 174f58967046..5effb694af36 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java @@ -100,6 +100,50 @@ public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { this.propertyClass = propertyClass; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Model200Response instance itself + */ + public Model200Response putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } Model200Response _200response = (Model200Response) o; return Objects.equals(this.name, _200response.name) && - Objects.equals(this.propertyClass, _200response.propertyClass); + Objects.equals(this.propertyClass, _200response.propertyClass)&& + Objects.equals(this.additionalProperties, _200response.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, propertyClass); + return Objects.hash(name, propertyClass, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class Model200Response {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -162,14 +208,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Model200Response is not found in the empty JSON string", Model200Response.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Model200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Model200Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("class") != null && !jsonObj.get("class").isJsonNull()) && !jsonObj.get("class").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("class").toString())); @@ -191,6 +229,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Model200Response value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -198,7 +258,28 @@ public void write(JsonWriter out, Model200Response value) throws IOException { public Model200Response read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Model200Response instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java index bf9c54f41346..3b5fd5914c3e 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -124,6 +124,50 @@ public void setMessage(@javax.annotation.Nullable String message) { this.message = message; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -137,12 +181,13 @@ public boolean equals(Object o) { ModelApiResponse _apiResponse = (ModelApiResponse) o; return Objects.equals(this.code, _apiResponse.code) && Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message); + Objects.equals(this.message, _apiResponse.message)&& + Objects.equals(this.additionalProperties, _apiResponse.additionalProperties); } @Override public int hashCode() { - return Objects.hash(code, type, message); + return Objects.hash(code, type, message, additionalProperties); } @Override @@ -152,6 +197,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -188,14 +234,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ModelApiResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ModelApiResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); @@ -220,6 +258,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ModelApiResponse value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -227,7 +287,28 @@ public void write(JsonWriter out, ModelApiResponse value) throws IOException { public ModelApiResponse read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelApiResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java index b103475f9e82..9568db3ca265 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java @@ -76,6 +76,50 @@ public void setSourceURI(@javax.annotation.Nullable String sourceURI) { this.sourceURI = sourceURI; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelFile instance itself + */ + public ModelFile putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } ModelFile _file = (ModelFile) o; - return Objects.equals(this.sourceURI, _file.sourceURI); + return Objects.equals(this.sourceURI, _file.sourceURI)&& + Objects.equals(this.additionalProperties, _file.additionalProperties); } @Override public int hashCode() { - return Objects.hash(sourceURI); + return Objects.hash(sourceURI, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ModelFile {\n"); sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -136,14 +182,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelFile is not found in the empty JSON string", ModelFile.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ModelFile.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ModelFile` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("sourceURI") != null && !jsonObj.get("sourceURI").isJsonNull()) && !jsonObj.get("sourceURI").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `sourceURI` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceURI").toString())); @@ -165,6 +203,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ModelFile value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -172,7 +232,28 @@ public void write(JsonWriter out, ModelFile value) throws IOException { public ModelFile read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelFile instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java index ce4211c2e5a8..62c343dd6560 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java @@ -76,6 +76,50 @@ public void set123list(@javax.annotation.Nullable String _123list) { this._123list = _123list; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelList instance itself + */ + public ModelList putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } ModelList _list = (ModelList) o; - return Objects.equals(this._123list, _list._123list); + return Objects.equals(this._123list, _list._123list)&& + Objects.equals(this.additionalProperties, _list.additionalProperties); } @Override public int hashCode() { - return Objects.hash(_123list); + return Objects.hash(_123list, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ModelList {\n"); sb.append(" _123list: ").append(toIndentedString(_123list)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -136,14 +182,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelList is not found in the empty JSON string", ModelList.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ModelList.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ModelList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("123-list") != null && !jsonObj.get("123-list").isJsonNull()) && !jsonObj.get("123-list").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `123-list` to be a primitive type in the JSON string but got `%s`", jsonObj.get("123-list").toString())); @@ -165,6 +203,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ModelList value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -172,7 +232,28 @@ public void write(JsonWriter out, ModelList value) throws IOException { public ModelList read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelList instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java index 3d172893e815..d0ca40bc5e8e 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -76,6 +76,50 @@ public void setReturn(@javax.annotation.Nullable Integer _return) { this._return = _return; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelReturn instance itself + */ + public ModelReturn putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } ModelReturn _return = (ModelReturn) o; - return Objects.equals(this._return, _return._return); + return Objects.equals(this._return, _return._return)&& + Objects.equals(this.additionalProperties, _return.additionalProperties); } @Override public int hashCode() { - return Objects.hash(_return); + return Objects.hash(_return, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ModelReturn {\n"); sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -136,14 +182,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelReturn is not found in the empty JSON string", ModelReturn.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ModelReturn.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ModelReturn` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); } @@ -162,6 +200,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ModelReturn value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -169,7 +229,28 @@ public void write(JsonWriter out, ModelReturn value) throws IOException { public ModelReturn read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelReturn instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java index efe6ce73a358..45b146c18ad2 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java @@ -141,6 +141,50 @@ public Integer get123number() { } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Name instance itself + */ + public Name putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -155,12 +199,13 @@ public boolean equals(Object 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); + Objects.equals(this._123number, name._123number)&& + Objects.equals(this.additionalProperties, name.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, snakeCase, property, _123number); + return Objects.hash(name, snakeCase, property, _123number, additionalProperties); } @Override @@ -171,6 +216,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -208,14 +254,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Name.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Name` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Name.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -243,6 +281,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Name value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -250,7 +310,28 @@ public void write(JsonWriter out, Name value) throws IOException { public Name read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Name instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java index 9e34c696d567..ab6184a2ab49 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -77,6 +77,50 @@ public void setJustNumber(@javax.annotation.Nullable BigDecimal justNumber) { this.justNumber = justNumber; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NumberOnly instance itself + */ + public NumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -88,12 +132,13 @@ public boolean equals(Object o) { return false; } NumberOnly numberOnly = (NumberOnly) o; - return Objects.equals(this.justNumber, numberOnly.justNumber); + return Objects.equals(this.justNumber, numberOnly.justNumber)&& + Objects.equals(this.additionalProperties, numberOnly.additionalProperties); } @Override public int hashCode() { - return Objects.hash(justNumber); + return Objects.hash(justNumber, additionalProperties); } @Override @@ -101,6 +146,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class NumberOnly {\n"); sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -137,14 +183,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NumberOnly is not found in the empty JSON string", NumberOnly.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!NumberOnly.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `NumberOnly` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); } @@ -163,6 +201,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, NumberOnly value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -170,7 +230,28 @@ public void write(JsonWriter out, NumberOnly value) throws IOException { public NumberOnly read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java index 5dafda4d0886..1ec4c52a40d5 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java @@ -251,6 +251,50 @@ public void setComplete(@javax.annotation.Nullable Boolean complete) { this.complete = complete; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -267,12 +311,13 @@ public boolean equals(Object o) { Objects.equals(this.quantity, order.quantity) && Objects.equals(this.shipDate, order.shipDate) && Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete); + Objects.equals(this.complete, order.complete)&& + Objects.equals(this.additionalProperties, order.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, petId, quantity, shipDate, status, complete); + return Objects.hash(id, petId, quantity, shipDate, status, complete, additionalProperties); } @Override @@ -285,6 +330,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -321,14 +367,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Order.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Order` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); @@ -354,6 +392,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Order value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -361,7 +421,28 @@ public void write(JsonWriter out, Order value) throws IOException { public Order read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Order instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java index 58431c54a11d..f21b55cf0356 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -125,6 +125,50 @@ public void setMyBoolean(@javax.annotation.Nullable Boolean myBoolean) { this.myBoolean = myBoolean; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OuterComposite instance itself + */ + public OuterComposite putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -138,12 +182,13 @@ public boolean equals(Object o) { OuterComposite outerComposite = (OuterComposite) o; return Objects.equals(this.myNumber, outerComposite.myNumber) && Objects.equals(this.myString, outerComposite.myString) && - Objects.equals(this.myBoolean, outerComposite.myBoolean); + Objects.equals(this.myBoolean, outerComposite.myBoolean)&& + Objects.equals(this.additionalProperties, outerComposite.additionalProperties); } @Override public int hashCode() { - return Objects.hash(myNumber, myString, myBoolean); + return Objects.hash(myNumber, myString, myBoolean, additionalProperties); } @Override @@ -153,6 +198,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -189,14 +235,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in OuterComposite is not found in the empty JSON string", OuterComposite.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!OuterComposite.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `OuterComposite` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("my_string") != null && !jsonObj.get("my_string").isJsonNull()) && !jsonObj.get("my_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `my_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("my_string").toString())); @@ -218,6 +256,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, OuterComposite value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -225,7 +285,28 @@ public void write(JsonWriter out, OuterComposite value) throws IOException { public OuterComposite read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OuterComposite instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java index a11a74a66263..ffb5c8eb2ad0 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java @@ -272,6 +272,50 @@ public void setStatus(@javax.annotation.Nullable StatusEnum status) { this.status = status; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -288,12 +332,13 @@ public boolean equals(Object o) { Objects.equals(this.name, pet.name) && Objects.equals(this.photoUrls, pet.photoUrls) && Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); + Objects.equals(this.status, pet.status)&& + Objects.equals(this.additionalProperties, pet.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, category, name, photoUrls, tags, status); + return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); } @Override @@ -306,6 +351,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -343,14 +389,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Pet.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Pet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Pet.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -409,6 +447,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Pet value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -416,7 +476,28 @@ public void write(JsonWriter out, Pet value) throws IOException { public Pet read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 86d5273b8105..80548e1c08e3 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -99,6 +99,50 @@ public void setBaz(@javax.annotation.Nullable String baz) { this.baz = baz; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ReadOnlyFirst instance itself + */ + public ReadOnlyFirst putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; return Objects.equals(this.bar, readOnlyFirst.bar) && - Objects.equals(this.baz, readOnlyFirst.baz); + Objects.equals(this.baz, readOnlyFirst.baz)&& + Objects.equals(this.additionalProperties, readOnlyFirst.additionalProperties); } @Override public int hashCode() { - return Objects.hash(bar, baz); + return Objects.hash(bar, baz, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class ReadOnlyFirst {\n"); sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -161,14 +207,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReadOnlyFirst is not found in the empty JSON string", ReadOnlyFirst.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ReadOnlyFirst.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ReadOnlyFirst` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonNull()) && !jsonObj.get("bar").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); @@ -193,6 +231,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ReadOnlyFirst value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -200,7 +260,28 @@ public void write(JsonWriter out, ReadOnlyFirst value) throws IOException { public ReadOnlyFirst read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReadOnlyFirst instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java index c26b2a3b9f21..0dcdcce32fa8 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -76,6 +76,50 @@ public SpecialModelName() { this.$specialPropertyName = $specialPropertyName; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SpecialModelName instance itself + */ + public SpecialModelName putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } SpecialModelName $specialModelName = (SpecialModelName) o; - return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName); + return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName)&& + Objects.equals(this.additionalProperties, $specialModelName.additionalProperties); } @Override public int hashCode() { - return Objects.hash($specialPropertyName); + return Objects.hash($specialPropertyName, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SpecialModelName {\n"); sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -136,14 +182,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SpecialModelName is not found in the empty JSON string", SpecialModelName.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SpecialModelName.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `SpecialModelName` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); } @@ -162,6 +200,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SpecialModelName value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -169,7 +229,28 @@ public void write(JsonWriter out, SpecialModelName value) throws IOException { public SpecialModelName read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SpecialModelName instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java index 35345ace5210..5adc02dd7049 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java @@ -100,6 +100,50 @@ public void setName(@javax.annotation.Nullable String name) { this.name = name; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } Tag tag = (Tag) o; return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); + Objects.equals(this.name, tag.name)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, name); + return Objects.hash(id, name, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class Tag {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -162,14 +208,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Tag.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Tag` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); @@ -191,6 +229,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Tag value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -198,7 +258,28 @@ public void write(JsonWriter out, Tag value) throws IOException { public Tag read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index dfd79f857183..cd6ef07b3932 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -183,6 +183,50 @@ public void setArrayItem(@javax.annotation.Nonnull List arrayItem) { this.arrayItem = arrayItem; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TypeHolderDefault instance itself + */ + public TypeHolderDefault putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -198,12 +242,13 @@ public boolean equals(Object o) { Objects.equals(this.numberItem, typeHolderDefault.numberItem) && Objects.equals(this.integerItem, typeHolderDefault.integerItem) && Objects.equals(this.boolItem, typeHolderDefault.boolItem) && - Objects.equals(this.arrayItem, typeHolderDefault.arrayItem); + Objects.equals(this.arrayItem, typeHolderDefault.arrayItem)&& + Objects.equals(this.additionalProperties, typeHolderDefault.additionalProperties); } @Override public int hashCode() { - return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); + return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem, additionalProperties); } @Override @@ -215,6 +260,7 @@ public String toString() { sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -252,14 +298,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TypeHolderDefault.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TypeHolderDefault` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : TypeHolderDefault.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -293,6 +331,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TypeHolderDefault value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -300,7 +360,28 @@ public void write(JsonWriter out, TypeHolderDefault value) throws IOException { public TypeHolderDefault read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TypeHolderDefault instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java index c0a2fa2d5944..bdf267aa3b80 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -207,6 +207,50 @@ public void setArrayItem(@javax.annotation.Nonnull List arrayItem) { this.arrayItem = arrayItem; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TypeHolderExample instance itself + */ + public TypeHolderExample putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -223,12 +267,13 @@ public boolean equals(Object o) { Objects.equals(this.floatItem, typeHolderExample.floatItem) && Objects.equals(this.integerItem, typeHolderExample.integerItem) && Objects.equals(this.boolItem, typeHolderExample.boolItem) && - Objects.equals(this.arrayItem, typeHolderExample.arrayItem); + Objects.equals(this.arrayItem, typeHolderExample.arrayItem)&& + Objects.equals(this.additionalProperties, typeHolderExample.additionalProperties); } @Override public int hashCode() { - return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); + return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem, additionalProperties); } @Override @@ -241,6 +286,7 @@ public String toString() { sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -278,14 +324,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TypeHolderExample.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TypeHolderExample` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : TypeHolderExample.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -319,6 +357,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TypeHolderExample value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -326,7 +386,28 @@ public void write(JsonWriter out, TypeHolderExample value) throws IOException { public TypeHolderExample read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TypeHolderExample instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java index 57123a138592..11d774d0e7bf 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java @@ -244,6 +244,50 @@ public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { this.userStatus = userStatus; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -262,12 +306,13 @@ public boolean equals(Object o) { Objects.equals(this.email, user.email) && Objects.equals(this.password, user.password) && Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); + Objects.equals(this.userStatus, user.userStatus)&& + Objects.equals(this.additionalProperties, user.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, additionalProperties); } @Override @@ -282,6 +327,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -318,14 +364,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!User.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `User` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); @@ -362,6 +400,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, User value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -369,7 +429,28 @@ public void write(JsonWriter out, User value) throws IOException { public User read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java index d99aeb0ef69d..07ec7156f4fc 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java @@ -823,6 +823,50 @@ public void setPrefixNsWrappedArray(@javax.annotation.Nullable List pre this.prefixNsWrappedArray = prefixNsWrappedArray; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the XmlItem instance itself + */ + public XmlItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -862,12 +906,13 @@ public boolean equals(Object o) { Objects.equals(this.prefixNsInteger, xmlItem.prefixNsInteger) && Objects.equals(this.prefixNsBoolean, xmlItem.prefixNsBoolean) && Objects.equals(this.prefixNsArray, xmlItem.prefixNsArray) && - Objects.equals(this.prefixNsWrappedArray, xmlItem.prefixNsWrappedArray); + Objects.equals(this.prefixNsWrappedArray, xmlItem.prefixNsWrappedArray)&& + Objects.equals(this.additionalProperties, xmlItem.additionalProperties); } @Override public int hashCode() { - return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); + return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray, additionalProperties); } @Override @@ -903,6 +948,7 @@ public String toString() { sb.append(" prefixNsBoolean: ").append(toIndentedString(prefixNsBoolean)).append("\n"); sb.append(" prefixNsArray: ").append(toIndentedString(prefixNsArray)).append("\n"); sb.append(" prefixNsWrappedArray: ").append(toIndentedString(prefixNsWrappedArray)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -939,14 +985,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in XmlItem is not found in the empty JSON string", XmlItem.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!XmlItem.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `XmlItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("attribute_string") != null && !jsonObj.get("attribute_string").isJsonNull()) && !jsonObj.get("attribute_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `attribute_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("attribute_string").toString())); @@ -1016,6 +1054,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, XmlItem value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -1023,7 +1083,28 @@ public void write(JsonWriter out, XmlItem value) throws IOException { public XmlItem read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + XmlItem instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index ca2806fb1af5..073759d3c139 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -386,6 +386,50 @@ public void setAnytype3(@javax.annotation.Nullable Object anytype3) { this.anytype3 = anytype3; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesClass instance itself + */ + public AdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -407,12 +451,13 @@ public boolean equals(Object o) { Objects.equals(this.mapMapAnytype, additionalPropertiesClass.mapMapAnytype) && Objects.equals(this.anytype1, additionalPropertiesClass.anytype1) && Objects.equals(this.anytype2, additionalPropertiesClass.anytype2) && - Objects.equals(this.anytype3, additionalPropertiesClass.anytype3); + Objects.equals(this.anytype3, additionalPropertiesClass.anytype3)&& + Objects.equals(this.additionalProperties, additionalPropertiesClass.additionalProperties); } @Override public int hashCode() { - return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); + return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3, additionalProperties); } @Override @@ -430,6 +475,7 @@ public String toString() { sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n"); sb.append(" anytype2: ").append(toIndentedString(anytype2)).append("\n"); sb.append(" anytype3: ").append(toIndentedString(anytype3)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -507,14 +553,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesClass is not found in the empty JSON string", AdditionalPropertiesClass.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!AdditionalPropertiesClass.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `AdditionalPropertiesClass` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); } @@ -533,6 +571,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, AdditionalPropertiesClass value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -540,7 +600,28 @@ public void write(JsonWriter out, AdditionalPropertiesClass value) throws IOExce public AdditionalPropertiesClass read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java index fbf3b55ec93b..5952d821cfdd 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java @@ -103,6 +103,50 @@ public void setColor(@javax.annotation.Nullable String color) { this.color = color; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Animal instance itself + */ + public Animal putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -115,12 +159,13 @@ public boolean equals(Object o) { } Animal animal = (Animal) o; return Objects.equals(this.className, animal.className) && - Objects.equals(this.color, animal.color); + Objects.equals(this.color, animal.color)&& + Objects.equals(this.additionalProperties, animal.additionalProperties); } @Override public int hashCode() { - return Objects.hash(className, color); + return Objects.hash(className, color, additionalProperties); } @Override @@ -129,6 +174,7 @@ public String toString() { sb.append("class Animal {\n"); sb.append(" className: ").append(toIndentedString(className)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index ce7437daf243..903e0f9a3d88 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -89,6 +89,50 @@ public void setArrayArrayNumber(@javax.annotation.Nullable List this.arrayArrayNumber = arrayArrayNumber; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfArrayOfNumberOnly instance itself + */ + public ArrayOfArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -100,12 +144,13 @@ public boolean equals(Object o) { return false; } ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; - return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber)&& + Objects.equals(this.additionalProperties, arrayOfArrayOfNumberOnly.additionalProperties); } @Override public int hashCode() { - return Objects.hash(arrayArrayNumber); + return Objects.hash(arrayArrayNumber, additionalProperties); } @Override @@ -113,6 +158,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ArrayOfArrayOfNumberOnly {\n"); sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -170,14 +216,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayOfArrayOfNumberOnly is not found in the empty JSON string", ArrayOfArrayOfNumberOnly.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ArrayOfArrayOfNumberOnly.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ArrayOfArrayOfNumberOnly` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the optional json data is an array if present if (jsonObj.get("ArrayArrayNumber") != null && !jsonObj.get("ArrayArrayNumber").isJsonNull() && !jsonObj.get("ArrayArrayNumber").isJsonArray()) { @@ -200,6 +238,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ArrayOfArrayOfNumberOnly value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -207,7 +267,28 @@ public void write(JsonWriter out, ArrayOfArrayOfNumberOnly value) throws IOExcep public ArrayOfArrayOfNumberOnly read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayOfArrayOfNumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 8da06da454d2..9f19af4c69ac 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -89,6 +89,50 @@ public void setArrayNumber(@javax.annotation.Nullable List arrayNumb this.arrayNumber = arrayNumber; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfNumberOnly instance itself + */ + public ArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -100,12 +144,13 @@ public boolean equals(Object o) { return false; } ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; - return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber)&& + Objects.equals(this.additionalProperties, arrayOfNumberOnly.additionalProperties); } @Override public int hashCode() { - return Objects.hash(arrayNumber); + return Objects.hash(arrayNumber, additionalProperties); } @Override @@ -113,6 +158,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ArrayOfNumberOnly {\n"); sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -170,14 +216,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayOfNumberOnly is not found in the empty JSON string", ArrayOfNumberOnly.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ArrayOfNumberOnly.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ArrayOfNumberOnly` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the optional json data is an array if present if (jsonObj.get("ArrayNumber") != null && !jsonObj.get("ArrayNumber").isJsonNull() && !jsonObj.get("ArrayNumber").isJsonArray()) { @@ -200,6 +238,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ArrayOfNumberOnly value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -207,7 +267,28 @@ public void write(JsonWriter out, ArrayOfNumberOnly value) throws IOException { public ArrayOfNumberOnly read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayOfNumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java index 470e51f6add8..a9e239628ef8 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -153,6 +153,50 @@ public void setArrayArrayOfModel(@javax.annotation.Nullable List additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayTest instance itself + */ + public ArrayTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -166,12 +210,13 @@ public boolean equals(Object o) { ArrayTest arrayTest = (ArrayTest) o; return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && - Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel)&& + Objects.equals(this.additionalProperties, arrayTest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel, additionalProperties); } @Override @@ -181,6 +226,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -242,14 +288,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayTest is not found in the empty JSON string", ArrayTest.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ArrayTest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ArrayTest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the optional json data is an array if present if (jsonObj.get("array_of_string") != null && !jsonObj.get("array_of_string").isJsonNull() && !jsonObj.get("array_of_string").isJsonArray()) { @@ -280,6 +318,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ArrayTest value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -287,7 +347,28 @@ public void write(JsonWriter out, ArrayTest value) throws IOException { public ArrayTest read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java index 3a488312c5c8..56f4048ee525 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java @@ -137,6 +137,50 @@ public void setKind(@javax.annotation.Nullable KindEnum kind) { this.kind = kind; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BigCat instance itself + */ + public BigCat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -148,13 +192,14 @@ public boolean equals(Object o) { return false; } BigCat bigCat = (BigCat) o; - return Objects.equals(this.kind, bigCat.kind) && + return Objects.equals(this.kind, bigCat.kind)&& + Objects.equals(this.additionalProperties, bigCat.additionalProperties) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(kind, super.hashCode()); + return Objects.hash(kind, super.hashCode(), additionalProperties); } @Override @@ -163,6 +208,7 @@ public String toString() { sb.append("class BigCat {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -223,14 +269,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!BigCat.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `BigCat` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : BigCat.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -254,6 +292,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, BigCat value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -261,7 +321,28 @@ public void write(JsonWriter out, BigCat value) throws IOException { public BigCat read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BigCat instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java index e1dac0cf85fb..b30e4c46d61b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java @@ -198,6 +198,50 @@ public void setATTNAME(@javax.annotation.Nullable String ATT_NAME) { this.ATT_NAME = ATT_NAME; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Capitalization instance itself + */ + public Capitalization putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -214,12 +258,13 @@ public boolean equals(Object o) { 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); + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME)&& + Objects.equals(this.additionalProperties, capitalization.additionalProperties); } @Override public int hashCode() { - return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME, additionalProperties); } @Override @@ -232,6 +277,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -299,14 +345,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Capitalization is not found in the empty JSON string", Capitalization.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Capitalization.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Capitalization` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("smallCamel") != null && !jsonObj.get("smallCamel").isJsonNull()) && !jsonObj.get("smallCamel").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `smallCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("smallCamel").toString())); @@ -343,6 +381,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Capitalization value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -350,7 +410,28 @@ public void write(JsonWriter out, Capitalization value) throws IOException { public Capitalization read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Capitalization instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java index cdd3e89301e6..dd243de90284 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java @@ -81,6 +81,50 @@ public void setDeclawed(@javax.annotation.Nullable Boolean declawed) { this.declawed = declawed; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Cat instance itself + */ + public Cat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -92,13 +136,14 @@ public boolean equals(Object o) { return false; } Cat cat = (Cat) o; - return Objects.equals(this.declawed, cat.declawed) && + return Objects.equals(this.declawed, cat.declawed)&& + Objects.equals(this.additionalProperties, cat.additionalProperties) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(declawed, super.hashCode()); + return Objects.hash(declawed, super.hashCode(), additionalProperties); } @Override @@ -107,6 +152,7 @@ public String toString() { sb.append("class Cat {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java index 38a73d87e5dd..98a947416f17 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java @@ -102,6 +102,50 @@ public void setName(@javax.annotation.Nonnull String name) { this.name = name; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -114,12 +158,13 @@ public boolean equals(Object o) { } Category category = (Category) o; return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); + Objects.equals(this.name, category.name)&& + Objects.equals(this.additionalProperties, category.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, name); + return Objects.hash(id, name, additionalProperties); } @Override @@ -128,6 +173,7 @@ public String toString() { sb.append("class Category {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -188,14 +234,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Category.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Category` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Category.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -223,6 +261,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Category value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -230,7 +290,28 @@ public void write(JsonWriter out, Category value) throws IOException { public Category read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java index 984987538ba3..a26eb5c6a0ea 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java @@ -78,6 +78,50 @@ public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { this.propertyClass = propertyClass; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ClassModel instance itself + */ + public ClassModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -89,12 +133,13 @@ public boolean equals(Object o) { return false; } ClassModel classModel = (ClassModel) o; - return Objects.equals(this.propertyClass, classModel.propertyClass); + return Objects.equals(this.propertyClass, classModel.propertyClass)&& + Objects.equals(this.additionalProperties, classModel.additionalProperties); } @Override public int hashCode() { - return Objects.hash(propertyClass); + return Objects.hash(propertyClass, additionalProperties); } @Override @@ -102,6 +147,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ClassModel {\n"); sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -159,14 +205,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ClassModel is not found in the empty JSON string", ClassModel.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ClassModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ClassModel` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("_class") != null && !jsonObj.get("_class").isJsonNull()) && !jsonObj.get("_class").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `_class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_class").toString())); @@ -188,6 +226,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ClassModel value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -195,7 +255,28 @@ public void write(JsonWriter out, ClassModel value) throws IOException { public ClassModel read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ClassModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java index a1f4cd8bde78..51bcafdf2f39 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java @@ -78,6 +78,50 @@ public void setClient(@javax.annotation.Nullable String client) { this.client = client; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Client instance itself + */ + public Client putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -89,12 +133,13 @@ public boolean equals(Object o) { return false; } Client client = (Client) o; - return Objects.equals(this.client, client.client); + return Objects.equals(this.client, client.client)&& + Objects.equals(this.additionalProperties, client.additionalProperties); } @Override public int hashCode() { - return Objects.hash(client); + return Objects.hash(client, additionalProperties); } @Override @@ -102,6 +147,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Client {\n"); sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -159,14 +205,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Client is not found in the empty JSON string", Client.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Client.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Client` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("client") != null && !jsonObj.get("client").isJsonNull()) && !jsonObj.get("client").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `client` to be a primitive type in the JSON string but got `%s`", jsonObj.get("client").toString())); @@ -188,6 +226,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Client value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -195,7 +255,28 @@ public void write(JsonWriter out, Client value) throws IOException { public Client read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Client instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java index ddccc9ba0da7..6415ebcde179 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java @@ -81,6 +81,50 @@ public void setBreed(@javax.annotation.Nullable String breed) { this.breed = breed; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Dog instance itself + */ + public Dog putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -92,13 +136,14 @@ public boolean equals(Object o) { return false; } Dog dog = (Dog) o; - return Objects.equals(this.breed, dog.breed) && + return Objects.equals(this.breed, dog.breed)&& + Objects.equals(this.additionalProperties, dog.additionalProperties) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(breed, super.hashCode()); + return Objects.hash(breed, super.hashCode(), additionalProperties); } @Override @@ -107,6 +152,7 @@ public String toString() { sb.append("class Dog {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -167,14 +213,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Dog.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Dog` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Dog.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -198,6 +236,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Dog value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -205,7 +265,28 @@ public void write(JsonWriter out, Dog value) throws IOException { public Dog read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Dog instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java index dfe342227f2a..8efda5d6b2f0 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -216,6 +216,50 @@ public void setArrayEnum(@javax.annotation.Nullable List arrayEnu this.arrayEnum = arrayEnum; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumArrays instance itself + */ + public EnumArrays putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -228,12 +272,13 @@ public boolean equals(Object o) { } EnumArrays enumArrays = (EnumArrays) o; return Objects.equals(this.justSymbol, enumArrays.justSymbol) && - Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + Objects.equals(this.arrayEnum, enumArrays.arrayEnum)&& + Objects.equals(this.additionalProperties, enumArrays.additionalProperties); } @Override public int hashCode() { - return Objects.hash(justSymbol, arrayEnum); + return Objects.hash(justSymbol, arrayEnum, additionalProperties); } @Override @@ -242,6 +287,7 @@ public String toString() { sb.append("class EnumArrays {\n"); sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -301,14 +347,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in EnumArrays is not found in the empty JSON string", EnumArrays.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!EnumArrays.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `EnumArrays` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonNull()) && !jsonObj.get("just_symbol").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `just_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("just_symbol").toString())); @@ -338,6 +376,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, EnumArrays value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -345,7 +405,28 @@ public void write(JsonWriter out, EnumArrays value) throws IOException { public EnumArrays read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EnumArrays instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java index 726d90be084a..c3920d8f45fa 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java @@ -387,6 +387,50 @@ public void setOuterEnum(@javax.annotation.Nullable OuterEnum outerEnum) { this.outerEnum = outerEnum; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumTest instance itself + */ + public EnumTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -402,12 +446,13 @@ public boolean equals(Object o) { 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.outerEnum, enumTest.outerEnum)&& + Objects.equals(this.additionalProperties, enumTest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, additionalProperties); } @Override @@ -419,6 +464,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -485,14 +531,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!EnumTest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `EnumTest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : EnumTest.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -541,6 +579,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, EnumTest value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -548,7 +608,28 @@ public void write(JsonWriter out, EnumTest value) throws IOException { public EnumTest read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EnumTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 3c9d17f03b18..7fa210b5c281 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -113,6 +113,50 @@ public void setFiles(@javax.annotation.Nullable List files) { this.files = files; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FileSchemaTestClass instance itself + */ + public FileSchemaTestClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -125,12 +169,13 @@ public boolean equals(Object o) { } FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; return Objects.equals(this._file, fileSchemaTestClass._file) && - Objects.equals(this.files, fileSchemaTestClass.files); + Objects.equals(this.files, fileSchemaTestClass.files)&& + Objects.equals(this.additionalProperties, fileSchemaTestClass.additionalProperties); } @Override public int hashCode() { - return Objects.hash(_file, files); + return Objects.hash(_file, files, additionalProperties); } @Override @@ -139,6 +184,7 @@ public String toString() { sb.append("class FileSchemaTestClass {\n"); sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); sb.append(" files: ").append(toIndentedString(files)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -198,14 +244,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FileSchemaTestClass is not found in the empty JSON string", FileSchemaTestClass.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!FileSchemaTestClass.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FileSchemaTestClass` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // validate the optional field `file` if (jsonObj.get("file") != null && !jsonObj.get("file").isJsonNull()) { @@ -242,6 +280,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, FileSchemaTestClass value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -249,7 +309,28 @@ public void write(JsonWriter out, FileSchemaTestClass value) throws IOException public FileSchemaTestClass read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FileSchemaTestClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java index 87ddb2dc05b6..64c6dbba88ab 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java @@ -405,6 +405,50 @@ public void setBigDecimal(@javax.annotation.Nullable BigDecimal bigDecimal) { this.bigDecimal = bigDecimal; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FormatTest instance itself + */ + public FormatTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -429,12 +473,13 @@ public boolean equals(Object o) { Objects.equals(this.dateTime, formatTest.dateTime) && Objects.equals(this.uuid, formatTest.uuid) && Objects.equals(this.password, formatTest.password) && - Objects.equals(this.bigDecimal, formatTest.bigDecimal); + Objects.equals(this.bigDecimal, formatTest.bigDecimal)&& + Objects.equals(this.additionalProperties, formatTest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal, additionalProperties); } @Override @@ -455,6 +500,7 @@ public String toString() { sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" password: ").append("*").append("\n"); sb.append(" bigDecimal: ").append(toIndentedString(bigDecimal)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -539,14 +585,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!FormatTest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FormatTest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : FormatTest.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -580,6 +618,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, FormatTest value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -587,7 +647,28 @@ public void write(JsonWriter out, FormatTest value) throws IOException { public FormatTest read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FormatTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 00bebc432a78..23d3c83c8580 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -95,6 +95,50 @@ public String getFoo() { } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the HasOnlyReadOnly instance itself + */ + public HasOnlyReadOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -107,12 +151,13 @@ public boolean equals(Object o) { } HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; return Objects.equals(this.bar, hasOnlyReadOnly.bar) && - Objects.equals(this.foo, hasOnlyReadOnly.foo); + Objects.equals(this.foo, hasOnlyReadOnly.foo)&& + Objects.equals(this.additionalProperties, hasOnlyReadOnly.additionalProperties); } @Override public int hashCode() { - return Objects.hash(bar, foo); + return Objects.hash(bar, foo, additionalProperties); } @Override @@ -121,6 +166,7 @@ public String toString() { sb.append("class HasOnlyReadOnly {\n"); sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); sb.append(" foo: ").append(toIndentedString(foo)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -180,14 +226,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in HasOnlyReadOnly is not found in the empty JSON string", HasOnlyReadOnly.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!HasOnlyReadOnly.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `HasOnlyReadOnly` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonNull()) && !jsonObj.get("bar").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); @@ -212,6 +250,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, HasOnlyReadOnly value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -219,7 +279,28 @@ public void write(JsonWriter out, HasOnlyReadOnly value) throws IOException { public HasOnlyReadOnly read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + HasOnlyReadOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java index 6604771cbd54..2e617fdb2eac 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java @@ -236,6 +236,50 @@ public void setIndirectMap(@javax.annotation.Nullable Map indir this.indirectMap = indirectMap; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MapTest instance itself + */ + public MapTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -250,12 +294,13 @@ public boolean equals(Object 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); + Objects.equals(this.indirectMap, mapTest.indirectMap)&& + Objects.equals(this.additionalProperties, mapTest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap, additionalProperties); } @Override @@ -266,6 +311,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -329,14 +375,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in MapTest is not found in the empty JSON string", MapTest.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MapTest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `MapTest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); } @@ -355,6 +393,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MapTest value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -362,7 +422,28 @@ public void write(JsonWriter out, MapTest value) throws IOException { public MapTest read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MapTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index bd7822f75930..889492dd4063 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -139,6 +139,50 @@ public void setMap(@javax.annotation.Nullable Map map) { this.map = map; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MixedPropertiesAndAdditionalPropertiesClass instance itself + */ + public MixedPropertiesAndAdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -152,12 +196,13 @@ public boolean equals(Object o) { MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && - Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map)&& + Objects.equals(this.additionalProperties, mixedPropertiesAndAdditionalPropertiesClass.additionalProperties); } @Override public int hashCode() { - return Objects.hash(uuid, dateTime, map); + return Objects.hash(uuid, dateTime, map, additionalProperties); } @Override @@ -167,6 +212,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -228,14 +274,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in MixedPropertiesAndAdditionalPropertiesClass is not found in the empty JSON string", MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MixedPropertiesAndAdditionalPropertiesClass.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `MixedPropertiesAndAdditionalPropertiesClass` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); @@ -257,6 +295,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MixedPropertiesAndAdditionalPropertiesClass value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -264,7 +324,28 @@ public void write(JsonWriter out, MixedPropertiesAndAdditionalPropertiesClass va public MixedPropertiesAndAdditionalPropertiesClass read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MixedPropertiesAndAdditionalPropertiesClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java index c94de6f12caf..357d7338bc27 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java @@ -102,6 +102,50 @@ public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { this.propertyClass = propertyClass; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Model200Response instance itself + */ + public Model200Response putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -114,12 +158,13 @@ public boolean equals(Object o) { } Model200Response _200response = (Model200Response) o; return Objects.equals(this.name, _200response.name) && - Objects.equals(this.propertyClass, _200response.propertyClass); + Objects.equals(this.propertyClass, _200response.propertyClass)&& + Objects.equals(this.additionalProperties, _200response.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, propertyClass); + return Objects.hash(name, propertyClass, additionalProperties); } @Override @@ -128,6 +173,7 @@ public String toString() { sb.append("class Model200Response {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -187,14 +233,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Model200Response is not found in the empty JSON string", Model200Response.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Model200Response.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Model200Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("class") != null && !jsonObj.get("class").isJsonNull()) && !jsonObj.get("class").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("class").toString())); @@ -216,6 +254,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Model200Response value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -223,7 +283,28 @@ public void write(JsonWriter out, Model200Response value) throws IOException { public Model200Response read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Model200Response instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 909c9fefbdf2..c14ad46f3ce0 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -126,6 +126,50 @@ public void setMessage(@javax.annotation.Nullable String message) { this.message = message; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -139,12 +183,13 @@ public boolean equals(Object o) { ModelApiResponse _apiResponse = (ModelApiResponse) o; return Objects.equals(this.code, _apiResponse.code) && Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message); + Objects.equals(this.message, _apiResponse.message)&& + Objects.equals(this.additionalProperties, _apiResponse.additionalProperties); } @Override public int hashCode() { - return Objects.hash(code, type, message); + return Objects.hash(code, type, message, additionalProperties); } @Override @@ -154,6 +199,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -215,14 +261,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ModelApiResponse.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ModelApiResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); @@ -247,6 +285,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ModelApiResponse value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -254,7 +314,28 @@ public void write(JsonWriter out, ModelApiResponse value) throws IOException { public ModelApiResponse read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelApiResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java index a97691464d7f..93272a70ca5f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java @@ -78,6 +78,50 @@ public void setSourceURI(@javax.annotation.Nullable String sourceURI) { this.sourceURI = sourceURI; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelFile instance itself + */ + public ModelFile putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -89,12 +133,13 @@ public boolean equals(Object o) { return false; } ModelFile _file = (ModelFile) o; - return Objects.equals(this.sourceURI, _file.sourceURI); + return Objects.equals(this.sourceURI, _file.sourceURI)&& + Objects.equals(this.additionalProperties, _file.additionalProperties); } @Override public int hashCode() { - return Objects.hash(sourceURI); + return Objects.hash(sourceURI, additionalProperties); } @Override @@ -102,6 +147,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ModelFile {\n"); sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -159,14 +205,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelFile is not found in the empty JSON string", ModelFile.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ModelFile.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ModelFile` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("sourceURI") != null && !jsonObj.get("sourceURI").isJsonNull()) && !jsonObj.get("sourceURI").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `sourceURI` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceURI").toString())); @@ -188,6 +226,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ModelFile value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -195,7 +255,28 @@ public void write(JsonWriter out, ModelFile value) throws IOException { public ModelFile read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelFile instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java index 2c8f7f99478b..39a77d942b7e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java @@ -78,6 +78,50 @@ public void set123list(@javax.annotation.Nullable String _123list) { this._123list = _123list; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelList instance itself + */ + public ModelList putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -89,12 +133,13 @@ public boolean equals(Object o) { return false; } ModelList _list = (ModelList) o; - return Objects.equals(this._123list, _list._123list); + return Objects.equals(this._123list, _list._123list)&& + Objects.equals(this.additionalProperties, _list.additionalProperties); } @Override public int hashCode() { - return Objects.hash(_123list); + return Objects.hash(_123list, additionalProperties); } @Override @@ -102,6 +147,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ModelList {\n"); sb.append(" _123list: ").append(toIndentedString(_123list)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -159,14 +205,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelList is not found in the empty JSON string", ModelList.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ModelList.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ModelList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("123-list") != null && !jsonObj.get("123-list").isJsonNull()) && !jsonObj.get("123-list").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `123-list` to be a primitive type in the JSON string but got `%s`", jsonObj.get("123-list").toString())); @@ -188,6 +226,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ModelList value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -195,7 +255,28 @@ public void write(JsonWriter out, ModelList value) throws IOException { public ModelList read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelList instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java index eb95cb74f0d1..0aec1e535346 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -78,6 +78,50 @@ public void setReturn(@javax.annotation.Nullable Integer _return) { this._return = _return; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelReturn instance itself + */ + public ModelReturn putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -89,12 +133,13 @@ public boolean equals(Object o) { return false; } ModelReturn _return = (ModelReturn) o; - return Objects.equals(this._return, _return._return); + return Objects.equals(this._return, _return._return)&& + Objects.equals(this.additionalProperties, _return.additionalProperties); } @Override public int hashCode() { - return Objects.hash(_return); + return Objects.hash(_return, additionalProperties); } @Override @@ -102,6 +147,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ModelReturn {\n"); sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -159,14 +205,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelReturn is not found in the empty JSON string", ModelReturn.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ModelReturn.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ModelReturn` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); } @@ -185,6 +223,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ModelReturn value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -192,7 +252,28 @@ public void write(JsonWriter out, ModelReturn value) throws IOException { public ModelReturn read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelReturn instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java index a9923044bf23..5914be5cf6ad 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java @@ -143,6 +143,50 @@ public Integer get123number() { } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Name instance itself + */ + public Name putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -157,12 +201,13 @@ public boolean equals(Object 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); + Objects.equals(this._123number, name._123number)&& + Objects.equals(this.additionalProperties, name.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, snakeCase, property, _123number); + return Objects.hash(name, snakeCase, property, _123number, additionalProperties); } @Override @@ -173,6 +218,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -237,14 +283,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Name.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Name` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Name.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -272,6 +310,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Name value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -279,7 +339,28 @@ public void write(JsonWriter out, Name value) throws IOException { public Name read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Name instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java index bd6c5f9a2704..0c2bd17e5da0 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -79,6 +79,50 @@ public void setJustNumber(@javax.annotation.Nullable BigDecimal justNumber) { this.justNumber = justNumber; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NumberOnly instance itself + */ + public NumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -90,12 +134,13 @@ public boolean equals(Object o) { return false; } NumberOnly numberOnly = (NumberOnly) o; - return Objects.equals(this.justNumber, numberOnly.justNumber); + return Objects.equals(this.justNumber, numberOnly.justNumber)&& + Objects.equals(this.additionalProperties, numberOnly.additionalProperties); } @Override public int hashCode() { - return Objects.hash(justNumber); + return Objects.hash(justNumber, additionalProperties); } @Override @@ -103,6 +148,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class NumberOnly {\n"); sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -160,14 +206,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NumberOnly is not found in the empty JSON string", NumberOnly.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!NumberOnly.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `NumberOnly` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); } @@ -186,6 +224,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, NumberOnly value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -193,7 +253,28 @@ public void write(JsonWriter out, NumberOnly value) throws IOException { public NumberOnly read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java index 373764feb6c0..3c5bc27a7e51 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java @@ -253,6 +253,50 @@ public void setComplete(@javax.annotation.Nullable Boolean complete) { this.complete = complete; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -269,12 +313,13 @@ public boolean equals(Object o) { Objects.equals(this.quantity, order.quantity) && Objects.equals(this.shipDate, order.shipDate) && Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete); + Objects.equals(this.complete, order.complete)&& + Objects.equals(this.additionalProperties, order.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, petId, quantity, shipDate, status, complete); + return Objects.hash(id, petId, quantity, shipDate, status, complete, additionalProperties); } @Override @@ -287,6 +332,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -354,14 +400,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Order.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Order` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); @@ -387,6 +425,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Order value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -394,7 +454,28 @@ public void write(JsonWriter out, Order value) throws IOException { public Order read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Order instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java index a9b65827d385..33cf5f278fd0 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -127,6 +127,50 @@ public void setMyBoolean(@javax.annotation.Nullable Boolean myBoolean) { this.myBoolean = myBoolean; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OuterComposite instance itself + */ + public OuterComposite putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -140,12 +184,13 @@ public boolean equals(Object o) { OuterComposite outerComposite = (OuterComposite) o; return Objects.equals(this.myNumber, outerComposite.myNumber) && Objects.equals(this.myString, outerComposite.myString) && - Objects.equals(this.myBoolean, outerComposite.myBoolean); + Objects.equals(this.myBoolean, outerComposite.myBoolean)&& + Objects.equals(this.additionalProperties, outerComposite.additionalProperties); } @Override public int hashCode() { - return Objects.hash(myNumber, myString, myBoolean); + return Objects.hash(myNumber, myString, myBoolean, additionalProperties); } @Override @@ -155,6 +200,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -216,14 +262,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in OuterComposite is not found in the empty JSON string", OuterComposite.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!OuterComposite.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `OuterComposite` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("my_string") != null && !jsonObj.get("my_string").isJsonNull()) && !jsonObj.get("my_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `my_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("my_string").toString())); @@ -245,6 +283,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, OuterComposite value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -252,7 +312,28 @@ public void write(JsonWriter out, OuterComposite value) throws IOException { public OuterComposite read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OuterComposite instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java index 3abde7538a05..e5f0e9fd4860 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java @@ -274,6 +274,50 @@ public void setStatus(@javax.annotation.Nullable StatusEnum status) { this.status = status; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -290,12 +334,13 @@ public boolean equals(Object o) { Objects.equals(this.name, pet.name) && Objects.equals(this.photoUrls, pet.photoUrls) && Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); + Objects.equals(this.status, pet.status)&& + Objects.equals(this.additionalProperties, pet.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, category, name, photoUrls, tags, status); + return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); } @Override @@ -308,6 +353,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -376,14 +422,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Pet.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Pet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Pet.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -442,6 +480,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Pet value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -449,7 +509,28 @@ public void write(JsonWriter out, Pet value) throws IOException { public Pet read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 815f7730ada8..6035faaaa49a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -101,6 +101,50 @@ public void setBaz(@javax.annotation.Nullable String baz) { this.baz = baz; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ReadOnlyFirst instance itself + */ + public ReadOnlyFirst putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -113,12 +157,13 @@ public boolean equals(Object o) { } ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; return Objects.equals(this.bar, readOnlyFirst.bar) && - Objects.equals(this.baz, readOnlyFirst.baz); + Objects.equals(this.baz, readOnlyFirst.baz)&& + Objects.equals(this.additionalProperties, readOnlyFirst.additionalProperties); } @Override public int hashCode() { - return Objects.hash(bar, baz); + return Objects.hash(bar, baz, additionalProperties); } @Override @@ -127,6 +172,7 @@ public String toString() { sb.append("class ReadOnlyFirst {\n"); sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -186,14 +232,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReadOnlyFirst is not found in the empty JSON string", ReadOnlyFirst.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ReadOnlyFirst.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ReadOnlyFirst` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonNull()) && !jsonObj.get("bar").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); @@ -218,6 +256,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ReadOnlyFirst value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -225,7 +285,28 @@ public void write(JsonWriter out, ReadOnlyFirst value) throws IOException { public ReadOnlyFirst read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReadOnlyFirst instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java index bc624cb554ab..1c7c132d4697 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -78,6 +78,50 @@ public SpecialModelName() { this.$specialPropertyName = $specialPropertyName; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SpecialModelName instance itself + */ + public SpecialModelName putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -89,12 +133,13 @@ public boolean equals(Object o) { return false; } SpecialModelName $specialModelName = (SpecialModelName) o; - return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName); + return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName)&& + Objects.equals(this.additionalProperties, $specialModelName.additionalProperties); } @Override public int hashCode() { - return Objects.hash($specialPropertyName); + return Objects.hash($specialPropertyName, additionalProperties); } @Override @@ -102,6 +147,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SpecialModelName {\n"); sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -159,14 +205,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SpecialModelName is not found in the empty JSON string", SpecialModelName.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SpecialModelName.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `SpecialModelName` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); } @@ -185,6 +223,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SpecialModelName value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -192,7 +252,28 @@ public void write(JsonWriter out, SpecialModelName value) throws IOException { public SpecialModelName read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SpecialModelName instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java index b152ab36f84f..08c73513622e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java @@ -102,6 +102,50 @@ public void setName(@javax.annotation.Nullable String name) { this.name = name; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -114,12 +158,13 @@ public boolean equals(Object o) { } Tag tag = (Tag) o; return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); + Objects.equals(this.name, tag.name)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, name); + return Objects.hash(id, name, additionalProperties); } @Override @@ -128,6 +173,7 @@ public String toString() { sb.append("class Tag {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -187,14 +233,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Tag.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Tag` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); @@ -216,6 +254,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Tag value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -223,7 +283,28 @@ public void write(JsonWriter out, Tag value) throws IOException { public Tag read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 4dc5b8353157..186b5baa963c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -185,6 +185,50 @@ public void setArrayItem(@javax.annotation.Nonnull List arrayItem) { this.arrayItem = arrayItem; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TypeHolderDefault instance itself + */ + public TypeHolderDefault putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -200,12 +244,13 @@ public boolean equals(Object o) { Objects.equals(this.numberItem, typeHolderDefault.numberItem) && Objects.equals(this.integerItem, typeHolderDefault.integerItem) && Objects.equals(this.boolItem, typeHolderDefault.boolItem) && - Objects.equals(this.arrayItem, typeHolderDefault.arrayItem); + Objects.equals(this.arrayItem, typeHolderDefault.arrayItem)&& + Objects.equals(this.additionalProperties, typeHolderDefault.additionalProperties); } @Override public int hashCode() { - return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); + return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem, additionalProperties); } @Override @@ -217,6 +262,7 @@ public String toString() { sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -283,14 +329,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TypeHolderDefault.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TypeHolderDefault` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : TypeHolderDefault.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -324,6 +362,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TypeHolderDefault value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -331,7 +391,28 @@ public void write(JsonWriter out, TypeHolderDefault value) throws IOException { public TypeHolderDefault read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TypeHolderDefault instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 7e5b6ea0b885..78af4a84f819 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -209,6 +209,50 @@ public void setArrayItem(@javax.annotation.Nonnull List arrayItem) { this.arrayItem = arrayItem; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TypeHolderExample instance itself + */ + public TypeHolderExample putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -225,12 +269,13 @@ public boolean equals(Object o) { Objects.equals(this.floatItem, typeHolderExample.floatItem) && Objects.equals(this.integerItem, typeHolderExample.integerItem) && Objects.equals(this.boolItem, typeHolderExample.boolItem) && - Objects.equals(this.arrayItem, typeHolderExample.arrayItem); + Objects.equals(this.arrayItem, typeHolderExample.arrayItem)&& + Objects.equals(this.additionalProperties, typeHolderExample.additionalProperties); } @Override public int hashCode() { - return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); + return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem, additionalProperties); } @Override @@ -243,6 +288,7 @@ public String toString() { sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -311,14 +357,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TypeHolderExample.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TypeHolderExample` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : TypeHolderExample.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -352,6 +390,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TypeHolderExample value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -359,7 +419,28 @@ public void write(JsonWriter out, TypeHolderExample value) throws IOException { public TypeHolderExample read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TypeHolderExample instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java index 07a0dc35b9f8..97c0976be066 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java @@ -246,6 +246,50 @@ public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { this.userStatus = userStatus; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -264,12 +308,13 @@ public boolean equals(Object o) { Objects.equals(this.email, user.email) && Objects.equals(this.password, user.password) && Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); + Objects.equals(this.userStatus, user.userStatus)&& + Objects.equals(this.additionalProperties, user.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, additionalProperties); } @Override @@ -284,6 +329,7 @@ public String toString() { 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -355,14 +401,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!User.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `User` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); @@ -399,6 +437,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, User value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -406,7 +466,28 @@ public void write(JsonWriter out, User value) throws IOException { public User read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java index 333ce565a34f..de5ab93e012b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java @@ -825,6 +825,50 @@ public void setPrefixNsWrappedArray(@javax.annotation.Nullable List pre this.prefixNsWrappedArray = prefixNsWrappedArray; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the XmlItem instance itself + */ + public XmlItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -864,12 +908,13 @@ public boolean equals(Object o) { Objects.equals(this.prefixNsInteger, xmlItem.prefixNsInteger) && Objects.equals(this.prefixNsBoolean, xmlItem.prefixNsBoolean) && Objects.equals(this.prefixNsArray, xmlItem.prefixNsArray) && - Objects.equals(this.prefixNsWrappedArray, xmlItem.prefixNsWrappedArray); + Objects.equals(this.prefixNsWrappedArray, xmlItem.prefixNsWrappedArray)&& + Objects.equals(this.additionalProperties, xmlItem.additionalProperties); } @Override public int hashCode() { - return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); + return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray, additionalProperties); } @Override @@ -905,6 +950,7 @@ public String toString() { sb.append(" prefixNsBoolean: ").append(toIndentedString(prefixNsBoolean)).append("\n"); sb.append(" prefixNsArray: ").append(toIndentedString(prefixNsArray)).append("\n"); sb.append(" prefixNsWrappedArray: ").append(toIndentedString(prefixNsWrappedArray)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -1018,14 +1064,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in XmlItem is not found in the empty JSON string", XmlItem.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!XmlItem.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `XmlItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("attribute_string") != null && !jsonObj.get("attribute_string").isJsonNull()) && !jsonObj.get("attribute_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `attribute_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("attribute_string").toString())); @@ -1095,6 +1133,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, XmlItem value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -1102,7 +1162,28 @@ public void write(JsonWriter out, XmlItem value) throws IOException { public XmlItem read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + XmlItem instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AppleReq.java index 3dccf0b8a24a..2a371133ca3f 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AppleReq.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AppleReq.java @@ -100,6 +100,50 @@ public void setMealy(@javax.annotation.Nullable Boolean mealy) { this.mealy = mealy; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AppleReq instance itself + */ + public AppleReq putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } AppleReq appleReq = (AppleReq) o; return Objects.equals(this.cultivar, appleReq.cultivar) && - Objects.equals(this.mealy, appleReq.mealy); + Objects.equals(this.mealy, appleReq.mealy)&& + Objects.equals(this.additionalProperties, appleReq.additionalProperties); } @Override public int hashCode() { - return Objects.hash(cultivar, mealy); + return Objects.hash(cultivar, mealy, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class AppleReq {\n"); sb.append(" cultivar: ").append(toIndentedString(cultivar)).append("\n"); sb.append(" mealy: ").append(toIndentedString(mealy)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -163,14 +209,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!AppleReq.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `AppleReq` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : AppleReq.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -198,6 +236,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, AppleReq value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -205,7 +265,28 @@ public void write(JsonWriter out, AppleReq value) throws IOException { public AppleReq read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AppleReq instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BananaReq.java index 436c4dc16ff6..aa450ec4f08a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BananaReq.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BananaReq.java @@ -101,6 +101,50 @@ public void setSweet(@javax.annotation.Nullable Boolean sweet) { this.sweet = sweet; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BananaReq instance itself + */ + public BananaReq putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -113,12 +157,13 @@ public boolean equals(Object o) { } BananaReq bananaReq = (BananaReq) o; return Objects.equals(this.lengthCm, bananaReq.lengthCm) && - Objects.equals(this.sweet, bananaReq.sweet); + Objects.equals(this.sweet, bananaReq.sweet)&& + Objects.equals(this.additionalProperties, bananaReq.additionalProperties); } @Override public int hashCode() { - return Objects.hash(lengthCm, sweet); + return Objects.hash(lengthCm, sweet, additionalProperties); } @Override @@ -127,6 +172,7 @@ public String toString() { sb.append("class BananaReq {\n"); sb.append(" lengthCm: ").append(toIndentedString(lengthCm)).append("\n"); sb.append(" sweet: ").append(toIndentedString(sweet)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -164,14 +210,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!BananaReq.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `BananaReq` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : BananaReq.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -196,6 +234,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, BananaReq value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -203,7 +263,28 @@ public void write(JsonWriter out, BananaReq value) throws IOException { public BananaReq read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BananaReq instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java index dc0db0a88949..3dbc3f03372e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -100,6 +100,50 @@ public void setTriangleType(@javax.annotation.Nonnull String triangleType) { this.triangleType = triangleType; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IsoscelesTriangle instance itself + */ + public IsoscelesTriangle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } IsoscelesTriangle isoscelesTriangle = (IsoscelesTriangle) o; return Objects.equals(this.shapeType, isoscelesTriangle.shapeType) && - Objects.equals(this.triangleType, isoscelesTriangle.triangleType); + Objects.equals(this.triangleType, isoscelesTriangle.triangleType)&& + Objects.equals(this.additionalProperties, isoscelesTriangle.additionalProperties); } @Override public int hashCode() { - return Objects.hash(shapeType, triangleType); + return Objects.hash(shapeType, triangleType, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class IsoscelesTriangle {\n"); sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); sb.append(" triangleType: ").append(toIndentedString(triangleType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -163,14 +209,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!IsoscelesTriangle.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `IsoscelesTriangle` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : IsoscelesTriangle.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -201,6 +239,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, IsoscelesTriangle value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -208,7 +268,28 @@ public void write(JsonWriter out, IsoscelesTriangle value) throws IOException { public IsoscelesTriangle read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + IsoscelesTriangle instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java index ddfd76b209ac..9aff30983fcb 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java @@ -100,6 +100,50 @@ public void setReason(@javax.annotation.Nonnull String reason) { this.reason = reason; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsMapError instance itself + */ + public NullableFieldsMapError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } NullableFieldsMapError nullableFieldsMapError = (NullableFieldsMapError) o; return Objects.equals(this.status, nullableFieldsMapError.status) && - Objects.equals(this.reason, nullableFieldsMapError.reason); + Objects.equals(this.reason, nullableFieldsMapError.reason)&& + Objects.equals(this.additionalProperties, nullableFieldsMapError.additionalProperties); } @Override public int hashCode() { - return Objects.hash(status, reason); + return Objects.hash(status, reason, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class NullableFieldsMapError {\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -163,14 +209,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!NullableFieldsMapError.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `NullableFieldsMapError` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : NullableFieldsMapError.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -201,6 +239,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, NullableFieldsMapError value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -208,7 +268,28 @@ public void write(JsonWriter out, NullableFieldsMapError value) throws IOExcepti public NullableFieldsMapError read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NullableFieldsMapError instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java index 5b1c8aa5fb27..1b6772d87e01 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java @@ -111,6 +111,50 @@ public void setPositions(@javax.annotation.Nonnull Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsMapSuccess instance itself + */ + public NullableFieldsMapSuccess putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -123,12 +167,13 @@ public boolean equals(Object o) { } NullableFieldsMapSuccess nullableFieldsMapSuccess = (NullableFieldsMapSuccess) o; return Objects.equals(this.status, nullableFieldsMapSuccess.status) && - Objects.equals(this.positions, nullableFieldsMapSuccess.positions); + Objects.equals(this.positions, nullableFieldsMapSuccess.positions)&& + Objects.equals(this.additionalProperties, nullableFieldsMapSuccess.additionalProperties); } @Override public int hashCode() { - return Objects.hash(status, positions); + return Objects.hash(status, positions, additionalProperties); } @Override @@ -137,6 +182,7 @@ public String toString() { sb.append("class NullableFieldsMapSuccess {\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" positions: ").append(toIndentedString(positions)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -174,14 +220,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!NullableFieldsMapSuccess.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `NullableFieldsMapSuccess` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : NullableFieldsMapSuccess.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -209,6 +247,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, NullableFieldsMapSuccess value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } elementAdapter.write(out, obj); } @@ -216,7 +276,28 @@ public void write(JsonWriter out, NullableFieldsMapSuccess value) throws IOExcep public NullableFieldsMapSuccess read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NullableFieldsMapSuccess instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/samples/client/petstore/java/okhttp-jackson/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp-jackson/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp-jackson/.gitignore b/samples/client/petstore/java/okhttp-jackson/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/.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/client/petstore/java/okhttp-jackson/.openapi-generator-ignore b/samples/client/petstore/java/okhttp-jackson/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/.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/client/petstore/java/okhttp-jackson/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-jackson/.openapi-generator/FILES new file mode 100644 index 000000000000..fecfdd629754 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/.openapi-generator/FILES @@ -0,0 +1,404 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/AdditionalPropertiesClass.md +docs/AllOfModelArrayAnyOf.md +docs/AllOfModelArrayAnyOfAllOfAttributes.md +docs/AllOfModelArrayAnyOfAllOfAttributesC.md +docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md +docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md +docs/AllOfRefToDouble.md +docs/AllOfRefToFloat.md +docs/AllOfRefToLong.md +docs/Animal.md +docs/AnotherFakeApi.md +docs/Apple.md +docs/AppleReq.md +docs/ArrayAnyOf.md +docs/ArrayDefault.md +docs/ArrayOfArrayOfNumberOnly.md +docs/ArrayOfInlineAllOf.md +docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md +docs/ArrayOfNumberOnly.md +docs/ArrayOneOf.md +docs/ArrayTest.md +docs/Banana.md +docs/BananaReq.md +docs/BasquePig.md +docs/Capitalization.md +docs/Cat.md +docs/Category.md +docs/ClassModel.md +docs/Client.md +docs/ComplexQuadrilateral.md +docs/DanishPig.md +docs/DefaultApi.md +docs/DeprecatedObject.md +docs/Dog.md +docs/Drawing.md +docs/EnumArrays.md +docs/EnumClass.md +docs/EnumStringDiscriminator.md +docs/EnumTest.md +docs/EquilateralTriangle.md +docs/FakeAnyOfWIthSameErasureGet200Response.md +docs/FakeApi.md +docs/FakeClassnameTags123Api.md +docs/FakeOneOfWIthSameErasureGet200Response.md +docs/FakeRefParameterPetIdParameter.md +docs/FileSchemaTestClass.md +docs/Foo.md +docs/FooGetDefaultResponse.md +docs/FormatTest.md +docs/FreeFormObjectTestClass.md +docs/FreeFormObjectTestClassProperties.md +docs/Fruit.md +docs/FruitReq.md +docs/GmFruit.md +docs/GrandparentAnimal.md +docs/HasOnlyReadOnly.md +docs/HealthCheckResult.md +docs/IsoscelesTriangle.md +docs/Mammal.md +docs/MammalAnyof.md +docs/MapTest.md +docs/MixedPropertiesAndAdditionalPropertiesClass.md +docs/Model200Response.md +docs/ModelApiResponse.md +docs/ModelFile.md +docs/ModelList.md +docs/ModelReturn.md +docs/ModelWithOneOfAnyOfProperties.md +docs/Name.md +docs/NestedArrayWithDefaultValues.md +docs/NewPet.md +docs/NewPetCategoryInlineAllof.md +docs/NewPetCategoryInlineAllofAllOfCategoryTag.md +docs/NullableClass.md +docs/NullableEnum.md +docs/NullableFieldsMapError.md +docs/NullableFieldsMapResponse.md +docs/NullableFieldsMapSuccess.md +docs/NullableFieldsValue.md +docs/NullableShape.md +docs/NumberOnly.md +docs/ObjectWithDeprecatedFields.md +docs/Order.md +docs/OuterComposite.md +docs/OuterEnum.md +docs/OuterEnumDefaultValue.md +docs/OuterEnumInteger.md +docs/OuterEnumIntegerDefaultValue.md +docs/ParentPet.md +docs/Pet.md +docs/PetApi.md +docs/PetComposition.md +docs/PetRef.md +docs/PetUsingAllOf.md +docs/PetWithRequiredTags.md +docs/Pig.md +docs/PropertyNameCollision.md +docs/Quadrilateral.md +docs/QuadrilateralInterface.md +docs/ReadOnlyFirst.md +docs/RequiredNullableBody.md +docs/Scalar.md +docs/ScalarAnyOf.md +docs/ScaleneTriangle.md +docs/Shape.md +docs/ShapeInterface.md +docs/ShapeOrNull.md +docs/SimpleQuadrilateral.md +docs/SpecialModelName.md +docs/StoreApi.md +docs/Tag.md +docs/TestInlineFreeformAdditionalPropertiesRequest.md +docs/Triangle.md +docs/TriangleInterface.md +docs/User.md +docs/UserApi.md +docs/Value.md +docs/ValuesApi.md +docs/Variable.md +docs/Whale.md +docs/Zebra.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/RFC3339DateFormat.java +src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java +src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/AnotherFakeApi.java +src/main/java/org/openapitools/client/api/DefaultApi.java +src/main/java/org/openapitools/client/api/FakeApi.java +src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/api/ValuesApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java +src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +src/main/java/org/openapitools/client/model/AllOfRefToLong.java +src/main/java/org/openapitools/client/model/Animal.java +src/main/java/org/openapitools/client/model/Apple.java +src/main/java/org/openapitools/client/model/AppleReq.java +src/main/java/org/openapitools/client/model/ArrayAnyOf.java +src/main/java/org/openapitools/client/model/ArrayDefault.java +src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java +src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java +src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayOneOf.java +src/main/java/org/openapitools/client/model/ArrayTest.java +src/main/java/org/openapitools/client/model/Banana.java +src/main/java/org/openapitools/client/model/BananaReq.java +src/main/java/org/openapitools/client/model/BasquePig.java +src/main/java/org/openapitools/client/model/Capitalization.java +src/main/java/org/openapitools/client/model/Cat.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ClassModel.java +src/main/java/org/openapitools/client/model/Client.java +src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +src/main/java/org/openapitools/client/model/DanishPig.java +src/main/java/org/openapitools/client/model/DeprecatedObject.java +src/main/java/org/openapitools/client/model/Dog.java +src/main/java/org/openapitools/client/model/Drawing.java +src/main/java/org/openapitools/client/model/EnumArrays.java +src/main/java/org/openapitools/client/model/EnumClass.java +src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java +src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/EquilateralTriangle.java +src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java +src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java +src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java +src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +src/main/java/org/openapitools/client/model/FormatTest.java +src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java +src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java +src/main/java/org/openapitools/client/model/Fruit.java +src/main/java/org/openapitools/client/model/FruitReq.java +src/main/java/org/openapitools/client/model/GmFruit.java +src/main/java/org/openapitools/client/model/GrandparentAnimal.java +src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +src/main/java/org/openapitools/client/model/HealthCheckResult.java +src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +src/main/java/org/openapitools/client/model/Mammal.java +src/main/java/org/openapitools/client/model/MammalAnyof.java +src/main/java/org/openapitools/client/model/MapTest.java +src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/Model200Response.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/ModelFile.java +src/main/java/org/openapitools/client/model/ModelList.java +src/main/java/org/openapitools/client/model/ModelReturn.java +src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java +src/main/java/org/openapitools/client/model/Name.java +src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java +src/main/java/org/openapitools/client/model/NewPet.java +src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java +src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java +src/main/java/org/openapitools/client/model/NullableClass.java +src/main/java/org/openapitools/client/model/NullableEnum.java +src/main/java/org/openapitools/client/model/NullableFieldsMapError.java +src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java +src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java +src/main/java/org/openapitools/client/model/NullableFieldsValue.java +src/main/java/org/openapitools/client/model/NullableShape.java +src/main/java/org/openapitools/client/model/NumberOnly.java +src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/OuterComposite.java +src/main/java/org/openapitools/client/model/OuterEnum.java +src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java +src/main/java/org/openapitools/client/model/OuterEnumInteger.java +src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java +src/main/java/org/openapitools/client/model/ParentPet.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/PetComposition.java +src/main/java/org/openapitools/client/model/PetRef.java +src/main/java/org/openapitools/client/model/PetUsingAllOf.java +src/main/java/org/openapitools/client/model/PetWithRequiredTags.java +src/main/java/org/openapitools/client/model/Pig.java +src/main/java/org/openapitools/client/model/PropertyNameCollision.java +src/main/java/org/openapitools/client/model/Quadrilateral.java +src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +src/main/java/org/openapitools/client/model/RequiredNullableBody.java +src/main/java/org/openapitools/client/model/Scalar.java +src/main/java/org/openapitools/client/model/ScalarAnyOf.java +src/main/java/org/openapitools/client/model/ScaleneTriangle.java +src/main/java/org/openapitools/client/model/Shape.java +src/main/java/org/openapitools/client/model/ShapeInterface.java +src/main/java/org/openapitools/client/model/ShapeOrNull.java +src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +src/main/java/org/openapitools/client/model/SpecialModelName.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +src/main/java/org/openapitools/client/model/Triangle.java +src/main/java/org/openapitools/client/model/TriangleInterface.java +src/main/java/org/openapitools/client/model/User.java +src/main/java/org/openapitools/client/model/Value.java +src/main/java/org/openapitools/client/model/Variable.java +src/main/java/org/openapitools/client/model/Whale.java +src/main/java/org/openapitools/client/model/Zebra.java +src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java +src/test/java/org/openapitools/client/api/DefaultApiTest.java +src/test/java/org/openapitools/client/api/FakeApiTest.java +src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/api/ValuesApiTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java +src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java +src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java +src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java +src/test/java/org/openapitools/client/model/AnimalTest.java +src/test/java/org/openapitools/client/model/AppleReqTest.java +src/test/java/org/openapitools/client/model/AppleTest.java +src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java +src/test/java/org/openapitools/client/model/ArrayDefaultTest.java +src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java +src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java +src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayOneOfTest.java +src/test/java/org/openapitools/client/model/ArrayTestTest.java +src/test/java/org/openapitools/client/model/BananaReqTest.java +src/test/java/org/openapitools/client/model/BananaTest.java +src/test/java/org/openapitools/client/model/BasquePigTest.java +src/test/java/org/openapitools/client/model/CapitalizationTest.java +src/test/java/org/openapitools/client/model/CatTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ClassModelTest.java +src/test/java/org/openapitools/client/model/ClientTest.java +src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java +src/test/java/org/openapitools/client/model/DanishPigTest.java +src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java +src/test/java/org/openapitools/client/model/DogTest.java +src/test/java/org/openapitools/client/model/DrawingTest.java +src/test/java/org/openapitools/client/model/EnumArraysTest.java +src/test/java/org/openapitools/client/model/EnumClassTest.java +src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java +src/test/java/org/openapitools/client/model/EnumTestTest.java +src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java +src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java +src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java +src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java +src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java +src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java +src/test/java/org/openapitools/client/model/FooTest.java +src/test/java/org/openapitools/client/model/FormatTestTest.java +src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java +src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java +src/test/java/org/openapitools/client/model/FruitReqTest.java +src/test/java/org/openapitools/client/model/FruitTest.java +src/test/java/org/openapitools/client/model/GmFruitTest.java +src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java +src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java +src/test/java/org/openapitools/client/model/HealthCheckResultTest.java +src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java +src/test/java/org/openapitools/client/model/MammalAnyofTest.java +src/test/java/org/openapitools/client/model/MammalTest.java +src/test/java/org/openapitools/client/model/MapTestTest.java +src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java +src/test/java/org/openapitools/client/model/Model200ResponseTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/ModelFileTest.java +src/test/java/org/openapitools/client/model/ModelListTest.java +src/test/java/org/openapitools/client/model/ModelReturnTest.java +src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java +src/test/java/org/openapitools/client/model/NameTest.java +src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java +src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java +src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java +src/test/java/org/openapitools/client/model/NewPetTest.java +src/test/java/org/openapitools/client/model/NullableClassTest.java +src/test/java/org/openapitools/client/model/NullableEnumTest.java +src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java +src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java +src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java +src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java +src/test/java/org/openapitools/client/model/NullableShapeTest.java +src/test/java/org/openapitools/client/model/NumberOnlyTest.java +src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/OuterCompositeTest.java +src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java +src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java +src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java +src/test/java/org/openapitools/client/model/OuterEnumTest.java +src/test/java/org/openapitools/client/model/ParentPetTest.java +src/test/java/org/openapitools/client/model/PetCompositionTest.java +src/test/java/org/openapitools/client/model/PetRefTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java +src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java +src/test/java/org/openapitools/client/model/PigTest.java +src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java +src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java +src/test/java/org/openapitools/client/model/QuadrilateralTest.java +src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java +src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java +src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java +src/test/java/org/openapitools/client/model/ScalarTest.java +src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java +src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java +src/test/java/org/openapitools/client/model/ShapeOrNullTest.java +src/test/java/org/openapitools/client/model/ShapeTest.java +src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java +src/test/java/org/openapitools/client/model/SpecialModelNameTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java +src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java +src/test/java/org/openapitools/client/model/TriangleTest.java +src/test/java/org/openapitools/client/model/UserTest.java +src/test/java/org/openapitools/client/model/ValueTest.java +src/test/java/org/openapitools/client/model/VariableTest.java +src/test/java/org/openapitools/client/model/WhaleTest.java +src/test/java/org/openapitools/client/model/ZebraTest.java diff --git a/samples/client/petstore/java/okhttp-jackson/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-jackson/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-jackson/.travis.yml b/samples/client/petstore/java/okhttp-jackson/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/.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/client/petstore/java/okhttp-jackson/README.md b/samples/client/petstore/java/okhttp-jackson/README.md new file mode 100644 index 000000000000..86feb56c87d9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/README.md @@ -0,0 +1,337 @@ +# petstore-okhttp-jackson + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-okhttp-jackson + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-okhttp-jackson' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp-jackson' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp-jackson:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/petstore-okhttp-jackson-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**getParameterArrayNumber**](docs/AnotherFakeApi.md#getParameterArrayNumber) | **GET** /fake/parameter-array-number | parameter array number default value +*AnotherFakeApi* | [**getParameterStringNumber**](docs/AnotherFakeApi.md#getParameterStringNumber) | **GET** /fake/parameter-string-number | parameter string number +*DefaultApi* | [**fakeAnyOfWIthSameErasureGet**](docs/DefaultApi.md#fakeAnyOfWIthSameErasureGet) | **GET** /fake/anyOfWIthSameErasure | +*DefaultApi* | [**fakeFreeFormQueryParametersGet**](docs/DefaultApi.md#fakeFreeFormQueryParametersGet) | **GET** /fake/free-form-query-parameters | +*DefaultApi* | [**fakeOneOfWIthSameErasureGet**](docs/DefaultApi.md#fakeOneOfWIthSameErasureGet) | **GET** /fake/oneOfWIthSameErasure | +*DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo | +*FakeApi* | [**fakeGetFreeFormObjectGet**](docs/FakeApi.md#fakeGetFreeFormObjectGet) | **GET** /fake/get-free-form-object | +*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +*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* | [**fakeRefParameter**](docs/FakeApi.md#fakeRefParameter) | **POST** /fake/pet/{petId}/reference/parameter | fake reference parameter +*FakeApi* | [**fakeRequiredNullableBodyGet**](docs/FakeApi.md#fakeRequiredNullableBodyGet) | **GET** /fake/required-nullable-body | fields in the response body, required and nullable are both true +*FakeApi* | [**fakeUploadRefRequestBodies**](docs/FakeApi.md#fakeUploadRefRequestBodies) | **POST** /fake/pet/{petId}/uploadImage | fake reference parameter +*FakeApi* | [**getFakeArrayofenums**](docs/FakeApi.md#getFakeArrayofenums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**getFakeHealth**](docs/FakeApi.md#getFakeHealth) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**getParameterNameMapping**](docs/FakeApi.md#getParameterNameMapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test +*FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +*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 +*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testInlineFreeformAdditionalProperties**](docs/FakeApi.md#testInlineFreeformAdditionalProperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testNullableRequiredFieldsAnyOf**](docs/FakeApi.md#testNullableRequiredFieldsAnyOf) | **GET** /fake/nullable-required-fields-anyof | test anyOf with map of objects containing nullable required fields +*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | +*FakeApi* | [**testStringMapReference**](docs/FakeApi.md#testStringMapReference) | **POST** /fake/stringMap-reference | test referenced string map +*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user +*ValuesApi* | [**getSomeValues**](docs/ValuesApi.md#getSomeValues) | **GET** /values | Get some primitive variable values + + +## Documentation for Models + + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AllOfModelArrayAnyOf](docs/AllOfModelArrayAnyOf.md) + - [AllOfModelArrayAnyOfAllOfAttributes](docs/AllOfModelArrayAnyOfAllOfAttributes.md) + - [AllOfModelArrayAnyOfAllOfAttributesC](docs/AllOfModelArrayAnyOfAllOfAttributesC.md) + - [AllOfModelArrayAnyOfAllOfLinkListColumn1](docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md) + - [AllOfModelArrayAnyOfAllOfLinkListColumn1Value](docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md) + - [AllOfRefToDouble](docs/AllOfRefToDouble.md) + - [AllOfRefToFloat](docs/AllOfRefToFloat.md) + - [AllOfRefToLong](docs/AllOfRefToLong.md) + - [Animal](docs/Animal.md) + - [Apple](docs/Apple.md) + - [AppleReq](docs/AppleReq.md) + - [ArrayAnyOf](docs/ArrayAnyOf.md) + - [ArrayDefault](docs/ArrayDefault.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfInlineAllOf](docs/ArrayOfInlineAllOf.md) + - [ArrayOfInlineAllOfArrayAllofDogPropertyInner](docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayOneOf](docs/ArrayOneOf.md) + - [ArrayTest](docs/ArrayTest.md) + - [Banana](docs/Banana.md) + - [BananaReq](docs/BananaReq.md) + - [BasquePig](docs/BasquePig.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [Category](docs/Category.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [ComplexQuadrilateral](docs/ComplexQuadrilateral.md) + - [DanishPig](docs/DanishPig.md) + - [DeprecatedObject](docs/DeprecatedObject.md) + - [Dog](docs/Dog.md) + - [Drawing](docs/Drawing.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumStringDiscriminator](docs/EnumStringDiscriminator.md) + - [EnumTest](docs/EnumTest.md) + - [EquilateralTriangle](docs/EquilateralTriangle.md) + - [FakeAnyOfWIthSameErasureGet200Response](docs/FakeAnyOfWIthSameErasureGet200Response.md) + - [FakeOneOfWIthSameErasureGet200Response](docs/FakeOneOfWIthSameErasureGet200Response.md) + - [FakeRefParameterPetIdParameter](docs/FakeRefParameterPetIdParameter.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) + - [FormatTest](docs/FormatTest.md) + - [FreeFormObjectTestClass](docs/FreeFormObjectTestClass.md) + - [FreeFormObjectTestClassProperties](docs/FreeFormObjectTestClassProperties.md) + - [Fruit](docs/Fruit.md) + - [FruitReq](docs/FruitReq.md) + - [GmFruit](docs/GmFruit.md) + - [GrandparentAnimal](docs/GrandparentAnimal.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [HealthCheckResult](docs/HealthCheckResult.md) + - [IsoscelesTriangle](docs/IsoscelesTriangle.md) + - [Mammal](docs/Mammal.md) + - [MammalAnyof](docs/MammalAnyof.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [ModelFile](docs/ModelFile.md) + - [ModelList](docs/ModelList.md) + - [ModelReturn](docs/ModelReturn.md) + - [ModelWithOneOfAnyOfProperties](docs/ModelWithOneOfAnyOfProperties.md) + - [Name](docs/Name.md) + - [NestedArrayWithDefaultValues](docs/NestedArrayWithDefaultValues.md) + - [NewPet](docs/NewPet.md) + - [NewPetCategoryInlineAllof](docs/NewPetCategoryInlineAllof.md) + - [NewPetCategoryInlineAllofAllOfCategoryTag](docs/NewPetCategoryInlineAllofAllOfCategoryTag.md) + - [NullableClass](docs/NullableClass.md) + - [NullableEnum](docs/NullableEnum.md) + - [NullableFieldsMapError](docs/NullableFieldsMapError.md) + - [NullableFieldsMapResponse](docs/NullableFieldsMapResponse.md) + - [NullableFieldsMapSuccess](docs/NullableFieldsMapSuccess.md) + - [NullableFieldsValue](docs/NullableFieldsValue.md) + - [NullableShape](docs/NullableShape.md) + - [NumberOnly](docs/NumberOnly.md) + - [ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md) + - [OuterEnumInteger](docs/OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) + - [ParentPet](docs/ParentPet.md) + - [Pet](docs/Pet.md) + - [PetComposition](docs/PetComposition.md) + - [PetRef](docs/PetRef.md) + - [PetUsingAllOf](docs/PetUsingAllOf.md) + - [PetWithRequiredTags](docs/PetWithRequiredTags.md) + - [Pig](docs/Pig.md) + - [PropertyNameCollision](docs/PropertyNameCollision.md) + - [Quadrilateral](docs/Quadrilateral.md) + - [QuadrilateralInterface](docs/QuadrilateralInterface.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [RequiredNullableBody](docs/RequiredNullableBody.md) + - [Scalar](docs/Scalar.md) + - [ScalarAnyOf](docs/ScalarAnyOf.md) + - [ScaleneTriangle](docs/ScaleneTriangle.md) + - [Shape](docs/Shape.md) + - [ShapeInterface](docs/ShapeInterface.md) + - [ShapeOrNull](docs/ShapeOrNull.md) + - [SimpleQuadrilateral](docs/SimpleQuadrilateral.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) + - [Triangle](docs/Triangle.md) + - [TriangleInterface](docs/TriangleInterface.md) + - [User](docs/User.md) + - [Value](docs/Value.md) + - [Variable](docs/Variable.md) + - [Whale](docs/Whale.md) + - [Zebra](docs/Zebra.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +### bearer_test + +- **Type**: HTTP Bearer Token authentication (JWT) + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp-jackson/api/openapi.yaml b/samples/client/petstore/java/okhttp-jackson/api/openapi.yaml new file mode 100644 index 000000000000..ec6b0d631c06 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/api/openapi.yaml @@ -0,0 +1,3332 @@ +openapi: 3.0.0 +info: + description: "This spec is mainly for testing Petstore server and contains fake\ + \ endpoints, models. Please do not use this for any other purpose. Special characters:\ + \ \" \\" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- description: petstore server + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: "https://localhost:8080/{version}" + variables: + version: + default: v2 + enum: + - v1 + - v2 +- description: The local server without variables + url: https://127.0.0.1/no_variable +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/_foo_get_default_response" + description: response + x-accepts: + - application/json + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + put: + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + servers: + - url: http://petstore.swagger.io/v2 + - url: http://path-server-test.petstore.local/v2 + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + default: [] + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + default: [] + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + - description: Content type header parameter + explode: false + in: header + name: Content-Type + required: false + schema: + type: string + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + default: [] + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-content-type: application/json + x-accepts: + - application/json + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + explode: true + in: query + name: required_string_group + required: true + schema: + type: integer + style: form + - description: Required Boolean in group parameters + explode: false + in: header + name: required_boolean_group + required: true + schema: + type: boolean + style: simple + - description: Required Integer in group parameters + explode: true + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + style: form + - description: String in group parameters + explode: true + in: query + name: string_group + required: false + schema: + type: integer + style: form + - description: Boolean in group parameters + explode: false + in: header + name: boolean_group + required: false + schema: + type: boolean + style: simple + - description: Integer in group parameters + explode: true + in: query + name: int64_group + required: false + schema: + format: int64 + type: integer + style: form + responses: + "400": + description: Something wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + x-accepts: + - application/json + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + required: false + schema: + default: [] + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + default: [] + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_integer + required: false + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_double + required: false + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + style: form + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEnumParameters_request" + responses: + "400": + description: Invalid request + "404": + description: Not found + summary: To test enum parameters + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test "client" model + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEndpointParameters_request" + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterNumber" + description: Input number as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterNumber" + description: Output number + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterString" + description: Input string as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterString" + description: Output string + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Input boolean as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Output boolean + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterComposite" + description: Input composite as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterComposite" + description: Output composite + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/jsonFormData: + get: + description: "" + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testJsonFormData_request" + responses: + "200": + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/additionalProperties-reference: + post: + description: "" + operationId: testAdditionalPropertiesReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FreeFormObject" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/oneOfWIthSameErasure: + get: + description: "Test route, this shouldn't cause a compiler error" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/_fake_oneOfWIthSameErasure_get_200_response" + description: successful response + x-accepts: + - application/json + /fake/nullable-required-fields-anyof: + get: + description: "Tests that anyOf deserialization works when object values contain\ + \ required fields that are nullable (e.g. Record)" + operationId: testNullableRequiredFieldsAnyOf + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/NullableFieldsMapResponse" + description: successful operation + summary: test anyOf with map of objects containing nullable required fields + tags: + - fake + x-accepts: + - application/json + /fake/anyOfWIthSameErasure: + get: + description: "Test route, this shouldn't cause a compiler error" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/_fake_anyOfWIthSameErasure_get_200_response" + description: successful response + x-accepts: + - application/json + /fake/stringMap-reference: + post: + description: "" + operationId: testStringMapReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/MapOfString" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced string map + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/inline-additionalProperties: + post: + description: "" + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + default: [] + type: object + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/inline-freeform-additionalProperties: + post: + description: "" + operationId: testInlineFreeformAdditionalProperties + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/testInlineFreeformAdditionalProperties_request" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline free-form additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - explode: true + in: query + name: query + required: true + schema: + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-file-schema: + put: + description: "For this test, the body for this request much reference a schema\ + \ named `File`." + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FileSchemaTestClass" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/get-free-form-object: + get: + description: Get a free form object or Json string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FreeFormObjectTestClass" + description: Success + tags: + - fake + x-accepts: + - application/json + /fake/free-form-query-parameters: + get: + parameters: + - explode: true + in: query + name: fixed + required: false + schema: + type: string + style: form + - explode: true + in: query + name: free-form + required: false + schema: + type: object + style: form + responses: + "200": + description: OK + x-accepts: + - application/json + /fake/test-query-parameters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: true + in: query + name: pipe + required: true + schema: + default: [] + items: + type: string + type: array + style: form + - explode: false + in: query + name: ioutil + required: true + schema: + default: [] + items: + type: string + type: array + style: form + - explode: false + in: query + name: http + required: true + schema: + default: [] + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + default: [] + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + default: [] + items: + type: string + type: array + style: form + responses: + "200": + description: Success + tags: + - fake + x-accepts: + - application/json + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: "" + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFileWithRequiredFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/HealthCheckResult" + description: The instance started successfully + summary: Health check endpoint + 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 + /fake/parameter-name-mapping: + get: + operationId: getParameterNameMapping + parameters: + - description: _type + explode: false + in: header + name: _type + required: true + schema: + format: int64 + type: integer + style: simple + - description: type + explode: true + in: query + name: type + required: true + schema: + type: string + style: form + - description: type_ + explode: false + in: header + name: type_ + required: true + schema: + type: string + style: simple + responses: + "200": + description: OK + summary: parameter name mapping test + tags: + - fake + x-accepts: + - application/json + /fake/parameter-string-number: + get: + operationId: getParameterStringNumber + parameters: + - description: string number + explode: false + in: header + name: string_number + required: true + schema: + format: number + type: string + style: simple + responses: + "200": + description: OK + summary: parameter string number + tags: + - another_fake + x-accepts: + - application/json + /fake/parameter-array-number: + get: + operationId: getParameterArrayNumber + parameters: + - description: array integer + explode: false + in: header + name: array + required: true + schema: + default: + - 1 + items: + type: integer + type: array + style: simple + responses: + "200": + description: OK + summary: parameter array number default value + tags: + - another_fake + x-accepts: + - application/json + /fake/pet/{petId}/uploadImage: + post: + description: "" + operationId: fake-upload-ref-request-bodies + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: "#/components/requestBodies/upload_body" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: fake reference parameter + tags: + - fake + x-content-type: multipart/form-data + x-accepts: + - application/json + /fake/pet/{petId}/reference/parameter: + post: + description: "" + operationId: fake-ref-parameter + parameters: + - description: to test oneOf in parameter $ref + explode: false + in: path + name: petId + required: true + schema: + $ref: "#/components/schemas/fake_ref_parameter_petId_parameter" + style: simple + responses: + "200": + description: successful operation + summary: fake reference parameter + tags: + - fake + x-accepts: + - application/json + /values: + get: + description: "" + operationId: getSomeValues + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Variable" + description: successful operation + "400": + description: Invalid Value + summary: Get some primitive variable values + tags: + - values + x-accepts: + - application/json + /internal/only: + get: + description: "" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Variable" + description: successful operation + "400": + description: Invalid Value + summary: internal only + tags: + - values + x-internal: true + x-accepts: + - application/json + /fake/required-nullable-body: + get: + description: "" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredNullableBody" + description: success + summary: "fields in the response body, required and nullable are both true" + tags: + - fake + x-accepts: + - application/json +components: + parameters: + pet_id: + description: to test oneOf in parameter $ref + explode: false + in: path + name: petId + required: true + schema: + $ref: "#/components/schemas/fake_ref_parameter_petId_parameter" + style: simple + requestBodies: + upload_body: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + UserArray: + content: + application/json: + examples: + simple-list: + description: Should not get into code examples + summary: Simple list example + value: + - username: foo + - username: bar + schema: + default: [] + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + Pet: + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string + Order: + example: + id: 0 + petId: 6 + quantity: 1 + shipDate: 2020-02-02T20:20:20.000222Z + status: placed + complete: false + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + example: 2020-02-02T20:20:20.000222Z + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + id: 6 + name: default-name + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + id: 0 + username: username + firstName: firstName + lastName: lastName + email: email + password: password + phone: phone + userStatus: 6 + objectWithNoDeclaredProps: "{}" + objectWithNoDeclaredPropsNullable: "{}" + anyTypeProp: "" + anyTypePropNullable: "" + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + objectWithNoDeclaredProps: + description: test code generation for objects Value must be a map of strings + to values. It cannot be the 'null' value. + type: object + objectWithNoDeclaredPropsNullable: + description: test code generation for nullable objects. Value must be a + map of strings to values or the 'null' value. + nullable: true + type: object + anyTypeProp: + description: "test code generation for any type Here the 'type' attribute\ + \ is not specified, which means the value can be anything, including the\ + \ null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389" + anyTypePropNullable: + description: "test code generation for any type Here the 'type' attribute\ + \ is not specified, which means the value can be anything, including the\ + \ null value, string, number, boolean, array or object. The 'nullable'\ + \ attribute does not change the allowed values." + nullable: true + type: object + xml: + name: User + Tag: + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + id: 0 + category: + id: 6 + name: default-name + name: doggie + photoUrls: + - photoUrls + - photoUrls + tags: + - id: 1 + name: name + - id: 1 + name: name + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + "123Number": + readOnly: true + type: integer + required: + - name + xml: + name: Name + "200_response": + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: "#/components/schemas/Animal" + - $ref: "#/components/schemas/Address" + - properties: + declawed: + type: boolean + type: object + Address: + additionalProperties: + type: integer + default: [] + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: "#/components/schemas/Animal" + type: array + format_test: + properties: + integer: + maximum: 100 + minimum: 10 + multipleOf: 2 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + multipleOf: 32.5 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + decimal: + format: number + type: string + string: + pattern: "/[a-z]/i" + type: string + byte: + format: byte + type: string + binary: + 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: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + uuid_with_default: + default: 11111111-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: "^\\d{10}$" + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. + pattern: "/^image_\\d{1,3}$/i" + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_integer_only: + enum: + - 2 + - -2 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: "#/components/schemas/OuterEnum" + outerEnumInteger: + $ref: "#/components/schemas/OuterEnumInteger" + outerEnumDefaultValue: + $ref: "#/components/schemas/OuterEnumDefaultValue" + outerEnumIntegerDefaultValue: + $ref: "#/components/schemas/OuterEnumIntegerDefaultValue" + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + default: [] + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + default: [] + type: object + default: [] + type: object + anytype_1: {} + map_with_undeclared_properties_anytype_1: + type: object + map_with_undeclared_properties_anytype_2: + properties: {} + type: object + map_with_undeclared_properties_anytype_3: + additionalProperties: true + default: [] + type: object + empty_map: + additionalProperties: false + description: "an object with no declared properties and no undeclared properties,\ + \ hence it's an empty map." + type: object + map_with_undeclared_properties_string: + additionalProperties: + type: string + default: [] + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: "#/components/schemas/Animal" + default: [] + type: object + type: object + List: + properties: + "123-list": + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + default: [] + type: object + default: [] + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + default: [] + type: object + direct_map: + additionalProperties: + type: boolean + default: [] + type: object + indirect_map: + additionalProperties: + type: boolean + default: [] + type: object + type: object + ArrayTest: + properties: + array_of_string: + default: [] + items: + type: string + type: array + array_array_of_integer: + default: [] + items: + default: [] + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + default: [] + items: + default: [] + items: + $ref: "#/components/schemas/ReadOnlyFirst" + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + default: [] + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + default: [] + items: + default: [] + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + default: [] + items: + enum: + - fish + - crab + type: string + type: array + type: object + FreeFormObject: + additionalProperties: true + default: [] + description: A schema consisting only of additional properties + type: object + MapOfString: + additionalProperties: + type: string + default: [] + description: A schema consisting only of additional properties of type string + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + - s + - S + nullable: true + type: string + OuterEnumInteger: + deprecated: true + enum: + - 0 + - 1 + - 2 + type: integer + OuterEnumDefaultValue: + default: placed + enum: + - placed + - approved + - delivered + type: string + OuterEnumIntegerDefaultValue: + default: 0 + enum: + - 0 + - 1 + - 2 + type: integer + OuterComposite: + example: + my_number: 0.8008281904610115 + my_string: my_string + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + default: [] + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: "#/components/schemas/File" + files: + default: [] + items: + $ref: "#/components/schemas/File" + type: array + type: object + FreeFormObjectTestClass: + example: + name: name + properties: FreeFormObjectTestClass_properties + properties: + name: + type: string + properties: + $ref: "#/components/schemas/FreeFormObjectTestClass_properties" + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + _special_model.name_: + type: string + xml: + name: "$special[model.name]" + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable + in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage + properties: + NullableMessage: + nullable: true + type: string + type: object + NullableClass: + additionalProperties: + nullable: true + type: object + properties: + integer_prop: + nullable: true + type: integer + number_prop: + nullable: true + type: number + boolean_prop: + nullable: true + type: boolean + string_prop: + nullable: true + type: string + date_prop: + format: date + nullable: true + type: string + datetime_prop: + format: date-time + nullable: true + type: string + array_nullable_prop: + items: + type: object + nullable: true + type: array + array_and_items_nullable_prop: + items: + nullable: true + type: object + nullable: true + type: array + array_items_nullable: + default: [] + items: + nullable: true + type: object + type: array + object_nullable_prop: + additionalProperties: + type: object + nullable: true + type: object + object_and_items_nullable_prop: + additionalProperties: + nullable: true + type: object + nullable: true + type: object + object_items_nullable: + additionalProperties: + nullable: true + type: object + default: [] + type: object + type: object + fruit: + additionalProperties: false + oneOf: + - $ref: "#/components/schemas/apple" + - $ref: "#/components/schemas/banana" + properties: + color: + type: string + apple: + nullable: true + properties: + cultivar: + pattern: "^[a-zA-Z\\s]*$" + type: string + origin: + pattern: "/^[A-Z\\s]*$/i" + type: string + type: object + banana: + properties: + lengthCm: + type: number + type: object + mammal: + discriminator: + propertyName: className + oneOf: + - $ref: "#/components/schemas/whale" + - $ref: "#/components/schemas/zebra" + - $ref: "#/components/schemas/Pig" + mammal_anyof: + anyOf: + - $ref: "#/components/schemas/whale" + - $ref: "#/components/schemas/zebra" + - $ref: "#/components/schemas/Pig" + discriminator: + propertyName: className + whale: + properties: + hasBaleen: + type: boolean + hasTeeth: + type: boolean + className: + type: string + required: + - className + type: object + zebra: + additionalProperties: true + properties: + type: + enum: + - plains + - mountain + - grevys + type: string + className: + type: string + required: + - className + type: object + Pig: + discriminator: + propertyName: className + oneOf: + - $ref: "#/components/schemas/BasquePig" + - $ref: "#/components/schemas/DanishPig" + BasquePig: + properties: + className: + type: string + required: + - className + type: object + DanishPig: + properties: + className: + type: string + required: + - className + type: object + gmFruit: + additionalProperties: false + anyOf: + - $ref: "#/components/schemas/apple" + - $ref: "#/components/schemas/banana" + properties: + color: + type: string + fruitReq: + additionalProperties: false + nullable: true + oneOf: + - $ref: "#/components/schemas/appleReq" + - $ref: "#/components/schemas/bananaReq" + appleReq: + additionalProperties: false + properties: + cultivar: + type: string + mealy: + type: boolean + required: + - cultivar + type: object + bananaReq: + additionalProperties: false + properties: + lengthCm: + type: number + sweet: + type: boolean + required: + - lengthCm + type: object + Drawing: + additionalProperties: + $ref: "#/components/schemas/fruit" + properties: + mainShape: + $ref: "#/components/schemas/Shape" + shapeOrNull: + $ref: "#/components/schemas/ShapeOrNull" + nullableShape: + $ref: "#/components/schemas/NullableShape" + shapes: + default: [] + items: + $ref: "#/components/schemas/Shape" + type: array + type: object + Shape: + discriminator: + propertyName: shapeType + oneOf: + - $ref: "#/components/schemas/Triangle" + - $ref: "#/components/schemas/Quadrilateral" + ShapeOrNull: + description: The value may be a shape or the 'null' value. This is introduced + in OAS schema >= 3.1. + discriminator: + propertyName: shapeType + nullable: true + oneOf: + - $ref: "#/components/schemas/Triangle" + - $ref: "#/components/schemas/Quadrilateral" + NullableShape: + description: The value may be a shape or the 'null' value. The 'nullable' attribute + was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema + >= 3.1. + discriminator: + propertyName: shapeType + nullable: true + oneOf: + - $ref: "#/components/schemas/Triangle" + - $ref: "#/components/schemas/Quadrilateral" + ShapeInterface: + properties: + shapeType: + type: string + required: + - shapeType + TriangleInterface: + properties: + triangleType: + type: string + required: + - triangleType + Triangle: + discriminator: + propertyName: triangleType + oneOf: + - $ref: "#/components/schemas/EquilateralTriangle" + - $ref: "#/components/schemas/IsoscelesTriangle" + - $ref: "#/components/schemas/ScaleneTriangle" + EquilateralTriangle: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/TriangleInterface" + IsoscelesTriangle: + additionalProperties: false + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/TriangleInterface" + ScaleneTriangle: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/TriangleInterface" + QuadrilateralInterface: + properties: + quadrilateralType: + type: string + required: + - quadrilateralType + Quadrilateral: + discriminator: + propertyName: quadrilateralType + oneOf: + - $ref: "#/components/schemas/SimpleQuadrilateral" + - $ref: "#/components/schemas/ComplexQuadrilateral" + SimpleQuadrilateral: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/QuadrilateralInterface" + ComplexQuadrilateral: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/QuadrilateralInterface" + GrandparentAnimal: + discriminator: + propertyName: pet_type + properties: + pet_type: + type: string + required: + - pet_type + type: object + ParentPet: + allOf: + - $ref: "#/components/schemas/GrandparentAnimal" + type: object + ArrayOfEnums: + default: [] + items: + $ref: "#/components/schemas/OuterEnum" + type: array + DateTimeTest: + default: 2010-01-01T10:10:10.000111+01:00 + example: 2010-01-01T10:10:10.000111+01:00 + format: date-time + type: string + DeprecatedObject: + deprecated: true + properties: + name: + type: string + type: object + ObjectWithDeprecatedFields: + properties: + uuid: + type: string + id: + deprecated: true + type: number + deprecatedRef: + $ref: "#/components/schemas/DeprecatedObject" + bars: + default: [] + deprecated: true + items: + $ref: "#/components/schemas/Bar" + type: array + type: object + PetWithRequiredTags: + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + - tags + type: object + xml: + name: Pet + ArrayOfInlineAllOf: + properties: + id: + format: int64 + type: integer + name: + example: doggie + type: string + array_allof_dog_property: + default: [] + items: + $ref: "#/components/schemas/ArrayOfInlineAllOf_array_allof_dog_property_inner" + type: array + required: + - name + type: object + EnumStringDiscriminator: + description: An object to test discriminator of enum string + discriminator: + propertyName: enum_str_type + properties: + enum_str_type: + description: enum string type + enum: + - type_a + - type_b + type: string + required: + - enum_str_type + type: object + ArrayDefault: + properties: + WithDefaultEmptyBracket: + default: [] + items: + type: string + type: array + WithoutDefault: + default: [] + items: + type: string + type: array + Variable: + description: Value object + example: + name: variable_1 + value: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + properties: + name: + example: variable_1 + type: string + value: + $ref: "#/components/schemas/Value" + required: + - name + - value + Value: + oneOf: + - $ref: "#/components/schemas/Scalar" + - $ref: "#/components/schemas/Array" + Scalar: + description: Values of scalar type + oneOf: + - format: uuid + type: string + - maxLength: 1089 + type: string + - type: number + - type: boolean + ScalarAnyOf: + anyOf: + - format: uuid + type: string + - maxLength: 1089 + type: string + - type: number + - type: boolean + description: Values of scalar type using anyOf + Array: + default: [] + description: Values of array type + items: + $ref: "#/components/schemas/Scalar" + minItems: 1 + type: array + NewPet: + properties: + id: + format: int64 + type: integer + x-is-unique: true + category_inline_allof: + $ref: "#/components/schemas/NewPet_category_inline_allof" + category_allOf_ref: + allOf: + - $ref: "#/components/schemas/Category" + category_allOf_ref_description: + allOf: + - $ref: "#/components/schemas/Category" + description: | + Adding description to property using allOf + category_allOf_ref_description_readonly: + allOf: + - $ref: "#/components/schemas/Category" + description: | + Adding description to readonly property using allOf + readOnly: true + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + allOf: + - $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + PropertyNameCollision: + properties: + _type: + type: string + type: + type: string + type_: + type: string + type: object + x-internal: false + InteralOnly: + properties: + type: + type: string + type: object + x-internal: true + AllOfModelArrayAnyOf: + allOf: + - $ref: "#/components/schemas/Category" + - properties: + linkListColumn1: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_linkListColumn1" + attributes: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_attributes" + type: object + PetUsingAllOf: + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + allOf: + - $ref: "#/components/schemas/Category" + description: | + multi line description + 2nd line + last line + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + allOf: + - $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + PetComposition: + allOf: + - $ref: "#/components/schemas/Pet" + PetRef: + properties: + id: + $ref: "#/components/schemas/Pet/properties/id" + category: + $ref: "#/components/schemas/Pet/properties/category" + name: + $ref: "#/components/schemas/Pet/properties/name" + photoUrls: + $ref: "#/components/schemas/Pet/properties/photoUrls" + tags: + $ref: "#/components/schemas/Pet/properties/tags" + status: + $ref: "#/components/schemas/Pet/properties/status" + required: + - name + - photoUrls + type: object + xml: + name: Pet + ArrayOneOf: + oneOf: + - type: integer + - default: [] + items: + type: string + type: array + ArrayAnyOf: + anyOf: + - type: integer + - default: [] + items: + type: string + type: array + ModelWithOneOfAnyOfProperties: + properties: + oneof_prop: + $ref: "#/components/schemas/ArrayOneOf" + anyof_prop: + $ref: "#/components/schemas/ArrayAnyOf" + type: object + NullableEnum: + enum: + - custom + nullable: true + type: string + RequiredNullableBody: + allOf: + - $ref: "#/components/schemas/NullableClass" + - properties: + custom_ref_enum: + $ref: "#/components/schemas/NullableEnum" + custom_enum: + enum: + - custom + nullable: true + type: string + required: + - array_and_items_nullable_prop + - array_items_nullable + - array_nullable_prop + - boolean_prop + - custom_enum + - custom_ref_enum + - date_prop + - datetime_prop + - integer_prop + - number_prop + - object_and_items_nullable_prop + - object_items_nullable + - object_nullable_prop + - string_prop + type: object + example: + integer_prop: 0 + number_prop: 6.027456183070403 + boolean_prop: true + string_prop: string_prop + date_prop: 2000-01-23 + datetime_prop: 2000-01-23T04:56:07.000+00:00 + array_nullable_prop: + - "{}" + - "{}" + array_and_items_nullable_prop: + - "{}" + - "{}" + array_items_nullable: + - "{}" + - "{}" + object_nullable_prop: + key: "{}" + object_and_items_nullable_prop: + key: "{}" + object_items_nullable: + key: "{}" + custom_ref_enum: custom + custom_enum: custom + NestedArrayWithDefaultValues: + properties: + nestedArray: + default: + - - h1 + - Header 1 + - - h2 + - Header 2 + - - h3 + - Header 3 + - - h4 + - Header 4 + items: + default: + - value1 + - value2 + items: + type: string + type: array + type: array + type: object + LongId: + description: Id as long + format: int64 + type: integer + Weight: + description: Weight as float + format: float + type: number + Height: + description: Height as double + format: double + type: number + AllOfRefToLong: + description: Object with allOf ref to long + properties: + id: + allOf: + - $ref: "#/components/schemas/LongId" + default: 10 + type: object + AllOfRefToFloat: + description: Object with allOf ref to float + properties: + weight: + allOf: + - $ref: "#/components/schemas/Weight" + default: 7.89 + type: object + AllOfRefToDouble: + description: Object with allOf ref to double + properties: + height: + allOf: + - $ref: "#/components/schemas/Height" + default: 32.1 + type: object + NullableFieldsValue: + description: Object with required but nullable string fields + example: + before: before + after: after + properties: + before: + nullable: true + type: string + after: + nullable: true + type: string + required: + - after + - before + type: object + NullableFieldsMapSuccess: + additionalProperties: false + description: Success response containing a map of objects with nullable fields + example: + status: status + positions: + key: + before: before + after: after + properties: + status: + type: string + positions: + additionalProperties: + $ref: "#/components/schemas/NullableFieldsValue" + type: object + required: + - positions + - status + type: object + NullableFieldsMapError: + additionalProperties: false + description: Error response + properties: + status: + type: string + reason: + type: string + required: + - reason + - status + type: object + NullableFieldsMapResponse: + anyOf: + - $ref: "#/components/schemas/NullableFieldsMapSuccess" + - $ref: "#/components/schemas/NullableFieldsMapError" + _foo_get_default_response: + example: + string: + bar: bar + properties: + string: + $ref: "#/components/schemas/Foo" + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request: + properties: + enum_form_string_array: + default: [] + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + testEndpointParameters_request: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: "/[a-z]/i" + type: string + pattern_without_delimiter: + description: None + pattern: "^[A-Z].*" + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + 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: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + _fake_oneOfWIthSameErasure_get_200_response: + oneOf: + - default: [] + items: + type: string + type: array + - default: [] + items: + type: integer + type: array + _fake_anyOfWIthSameErasure_get_200_response: + anyOf: + - default: [] + items: + type: string + type: array + - default: [] + items: + type: integer + type: array + testInlineFreeformAdditionalProperties_request: + additionalProperties: true + properties: + someProperty: + type: string + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + fake_ref_parameter_petId_parameter: + oneOf: + - type: string + - type: integer + FreeFormObjectTestClass_properties: + oneOf: + - type: string + - additionalProperties: true + default: [] + type: object + ArrayOfInlineAllOf_array_allof_dog_property_inner: + allOf: + - properties: + breed: + type: string + type: object + - properties: + color: + type: string + type: object + NewPet_category_inline_allof_allOf_category_tag: + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + NewPet_category_inline_allof: + allOf: + - properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + category_tag: + $ref: "#/components/schemas/NewPet_category_inline_allof_allOf_category_tag" + required: + - name + type: object + AllOfModelArrayAnyOf_allOf_linkListColumn1_value: + anyOf: + - $ref: "#/components/schemas/User" + - $ref: "#/components/schemas/Tag" + AllOfModelArrayAnyOf_allOf_linkListColumn1: + properties: + value: + default: [] + items: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_linkListColumn1_value" + type: array + required: + - value + type: object + AllOfModelArrayAnyOf_allOf_attributes_C: + oneOf: + - $ref: "#/components/schemas/Pet" + - $ref: "#/components/schemas/Order" + AllOfModelArrayAnyOf_allOf_attributes: + properties: + C: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_attributes_C" + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http + diff --git a/samples/client/petstore/java/okhttp-jackson/build.gradle b/samples/client/petstore/java/okhttp-jackson/build.gradle new file mode 100644 index 000000000000..fc9054e0c022 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/build.gradle @@ -0,0 +1,69 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-okhttp-jackson' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + jackson_version = "2.17.1" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + implementation 'org.openapitools:jackson-databind-nullable:0.2.10' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.18.0' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/build.sbt b/samples/client/petstore/java/okhttp-jackson/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp-jackson/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-jackson/docs/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..83051d9be44b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/AdditionalPropertiesClass.md @@ -0,0 +1,20 @@ + + +# AdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapProperty** | **Map<String, String>** | | [optional] | +|**mapOfMapProperty** | **Map<String, Map<String, String>>** | | [optional] | +|**anytype1** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype3** | **Map<String, Object>** | | [optional] | +|**emptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] | +|**mapWithUndeclaredPropertiesString** | **Map<String, String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOf.md b/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOf.md new file mode 100644 index 000000000000..96dc5a34d089 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOf.md @@ -0,0 +1,16 @@ + + +# AllOfModelArrayAnyOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | +|**linkListColumn1** | [**AllOfModelArrayAnyOfAllOfLinkListColumn1**](AllOfModelArrayAnyOfAllOfLinkListColumn1.md) | | [optional] | +|**attributes** | [**AllOfModelArrayAnyOfAllOfAttributes**](AllOfModelArrayAnyOfAllOfAttributes.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfAttributes.md b/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfAttributes.md new file mode 100644 index 000000000000..c9096e515367 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfAttributes.md @@ -0,0 +1,13 @@ + + +# AllOfModelArrayAnyOfAllOfAttributes + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**C** | [**AllOfModelArrayAnyOfAllOfAttributesC**](AllOfModelArrayAnyOfAllOfAttributesC.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfAttributesC.md b/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfAttributesC.md new file mode 100644 index 000000000000..5229de89b299 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfAttributesC.md @@ -0,0 +1,32 @@ + + +# AllOfModelArrayAnyOfAllOfAttributesC + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md b/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md new file mode 100644 index 000000000000..43fa9b696377 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md @@ -0,0 +1,13 @@ + + +# AllOfModelArrayAnyOfAllOfLinkListColumn1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**value** | [**List<AllOfModelArrayAnyOfAllOfLinkListColumn1Value>**](AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md) | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md b/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md new file mode 100644 index 000000000000..6379cac28b02 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md @@ -0,0 +1,25 @@ + + +# AllOfModelArrayAnyOfAllOfLinkListColumn1Value + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | +|**objectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] | +|**objectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] | +|**anyTypeProp** | **Object** | 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 | [optional] | +|**anyTypePropNullable** | **Object** | 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. | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/AllOfRefToDouble.md b/samples/client/petstore/java/okhttp-jackson/docs/AllOfRefToDouble.md new file mode 100644 index 000000000000..516584f74348 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/AllOfRefToDouble.md @@ -0,0 +1,14 @@ + + +# AllOfRefToDouble + +Object with allOf ref to double + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**height** | **Double** | Height as double | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/AllOfRefToFloat.md b/samples/client/petstore/java/okhttp-jackson/docs/AllOfRefToFloat.md new file mode 100644 index 000000000000..9a60af8a2ea4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/AllOfRefToFloat.md @@ -0,0 +1,14 @@ + + +# AllOfRefToFloat + +Object with allOf ref to float + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**weight** | **Float** | Weight as float | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/AllOfRefToLong.md b/samples/client/petstore/java/okhttp-jackson/docs/AllOfRefToLong.md new file mode 100644 index 000000000000..0f32d49b0857 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/AllOfRefToLong.md @@ -0,0 +1,14 @@ + + +# AllOfRefToLong + +Object with allOf ref to long + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | Id as long | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Animal.md b/samples/client/petstore/java/okhttp-jackson/docs/Animal.md new file mode 100644 index 000000000000..d9b32f14c88a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Animal.md @@ -0,0 +1,14 @@ + + +# Animal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | +|**color** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/AnotherFakeApi.md b/samples/client/petstore/java/okhttp-jackson/docs/AnotherFakeApi.md new file mode 100644 index 000000000000..6cca209c72b1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/AnotherFakeApi.md @@ -0,0 +1,191 @@ +# AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags | +| [**getParameterArrayNumber**](AnotherFakeApi.md#getParameterArrayNumber) | **GET** /fake/parameter-array-number | parameter array number default value | +| [**getParameterStringNumber**](AnotherFakeApi.md#getParameterStringNumber) | **GET** /fake/parameter-string-number | parameter string number | + + + +# **call123testSpecialTags** +> Client call123testSpecialTags(client) + +To test special tags + +To test special tags and operation ID starting with number + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getParameterArrayNumber** +> getParameterArrayNumber(array) + +parameter array number default value + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + List array = Arrays.asList(); // List | array integer + try { + apiInstance.getParameterArrayNumber(array); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#getParameterArrayNumber"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **array** | [**List<Integer>**](Integer.md)| array integer | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +# **getParameterStringNumber** +> getParameterStringNumber(stringNumber) + +parameter string number + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + BigDecimal stringNumber = new BigDecimal(78); // BigDecimal | string number + try { + apiInstance.getParameterStringNumber(stringNumber); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#getParameterStringNumber"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **stringNumber** | **BigDecimal**| string number | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Apple.md b/samples/client/petstore/java/okhttp-jackson/docs/Apple.md new file mode 100644 index 000000000000..0ef7a92c74d6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Apple.md @@ -0,0 +1,14 @@ + + +# Apple + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | [optional] | +|**origin** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/AppleReq.md b/samples/client/petstore/java/okhttp-jackson/docs/AppleReq.md new file mode 100644 index 000000000000..989e1cfedd1e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/AppleReq.md @@ -0,0 +1,14 @@ + + +# AppleReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | | +|**mealy** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ArrayAnyOf.md b/samples/client/petstore/java/okhttp-jackson/docs/ArrayAnyOf.md new file mode 100644 index 000000000000..86bb944833ac --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ArrayAnyOf.md @@ -0,0 +1,12 @@ + + +# ArrayAnyOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ArrayDefault.md b/samples/client/petstore/java/okhttp-jackson/docs/ArrayDefault.md new file mode 100644 index 000000000000..b539cb294d74 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ArrayDefault.md @@ -0,0 +1,14 @@ + + +# ArrayDefault + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**withDefaultEmptyBracket** | **List<String>** | | [optional] | +|**withoutDefault** | **List<String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-jackson/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..0188db3eb131 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayArrayNumber** | **List<List<BigDecimal>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ArrayOfInlineAllOf.md b/samples/client/petstore/java/okhttp-jackson/docs/ArrayOfInlineAllOf.md new file mode 100644 index 000000000000..3efa4933a3b9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ArrayOfInlineAllOf.md @@ -0,0 +1,15 @@ + + +# ArrayOfInlineAllOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | +|**arrayAllofDogProperty** | [**List<ArrayOfInlineAllOfArrayAllofDogPropertyInner>**](ArrayOfInlineAllOfArrayAllofDogPropertyInner.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md b/samples/client/petstore/java/okhttp-jackson/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md new file mode 100644 index 000000000000..35f349597734 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md @@ -0,0 +1,14 @@ + + +# ArrayOfInlineAllOfArrayAllofDogPropertyInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | +|**color** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-jackson/docs/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..a5753530aada --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayNumber** | **List<BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ArrayOneOf.md b/samples/client/petstore/java/okhttp-jackson/docs/ArrayOneOf.md new file mode 100644 index 000000000000..34727d5f7301 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ArrayOneOf.md @@ -0,0 +1,12 @@ + + +# ArrayOneOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ArrayTest.md b/samples/client/petstore/java/okhttp-jackson/docs/ArrayTest.md new file mode 100644 index 000000000000..36077c9df300 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ArrayTest.md @@ -0,0 +1,15 @@ + + +# ArrayTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayOfString** | **List<String>** | | [optional] | +|**arrayArrayOfInteger** | **List<List<Long>>** | | [optional] | +|**arrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Banana.md b/samples/client/petstore/java/okhttp-jackson/docs/Banana.md new file mode 100644 index 000000000000..5356d17ee700 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Banana.md @@ -0,0 +1,13 @@ + + +# Banana + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**lengthCm** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/BananaReq.md b/samples/client/petstore/java/okhttp-jackson/docs/BananaReq.md new file mode 100644 index 000000000000..22ebe1a7105f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/BananaReq.md @@ -0,0 +1,14 @@ + + +# BananaReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**lengthCm** | **BigDecimal** | | | +|**sweet** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/BasquePig.md b/samples/client/petstore/java/okhttp-jackson/docs/BasquePig.md new file mode 100644 index 000000000000..160cb71c321f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/BasquePig.md @@ -0,0 +1,13 @@ + + +# BasquePig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Capitalization.md b/samples/client/petstore/java/okhttp-jackson/docs/Capitalization.md new file mode 100644 index 000000000000..82a812711de2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Capitalization.md @@ -0,0 +1,18 @@ + + +# Capitalization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**smallCamel** | **String** | | [optional] | +|**capitalCamel** | **String** | | [optional] | +|**smallSnake** | **String** | | [optional] | +|**capitalSnake** | **String** | | [optional] | +|**scAETHFlowPoints** | **String** | | [optional] | +|**ATT_NAME** | **String** | Name of the pet | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Cat.md b/samples/client/petstore/java/okhttp-jackson/docs/Cat.md new file mode 100644 index 000000000000..390dd519c8ce --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Cat.md @@ -0,0 +1,13 @@ + + +# Cat + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**declawed** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Category.md b/samples/client/petstore/java/okhttp-jackson/docs/Category.md new file mode 100644 index 000000000000..ab6d1ec334dc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Category.md @@ -0,0 +1,14 @@ + + +# Category + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ClassModel.md b/samples/client/petstore/java/okhttp-jackson/docs/ClassModel.md new file mode 100644 index 000000000000..af46dea1f6c8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ClassModel.md @@ -0,0 +1,14 @@ + + +# ClassModel + +Model for testing model with \"_class\" property + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Client.md b/samples/client/petstore/java/okhttp-jackson/docs/Client.md new file mode 100644 index 000000000000..ef07b4ab8b9d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Client.md @@ -0,0 +1,13 @@ + + +# Client + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**client** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ComplexQuadrilateral.md b/samples/client/petstore/java/okhttp-jackson/docs/ComplexQuadrilateral.md new file mode 100644 index 000000000000..d0a4b1a0a758 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ComplexQuadrilateral.md @@ -0,0 +1,14 @@ + + +# ComplexQuadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/DanishPig.md b/samples/client/petstore/java/okhttp-jackson/docs/DanishPig.md new file mode 100644 index 000000000000..0b366d3cf2ff --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/DanishPig.md @@ -0,0 +1,13 @@ + + +# DanishPig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/DefaultApi.md b/samples/client/petstore/java/okhttp-jackson/docs/DefaultApi.md new file mode 100644 index 000000000000..b0835fc23cf1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/DefaultApi.md @@ -0,0 +1,245 @@ +# DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fakeAnyOfWIthSameErasureGet**](DefaultApi.md#fakeAnyOfWIthSameErasureGet) | **GET** /fake/anyOfWIthSameErasure | | +| [**fakeFreeFormQueryParametersGet**](DefaultApi.md#fakeFreeFormQueryParametersGet) | **GET** /fake/free-form-query-parameters | | +| [**fakeOneOfWIthSameErasureGet**](DefaultApi.md#fakeOneOfWIthSameErasureGet) | **GET** /fake/oneOfWIthSameErasure | | +| [**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | | + + + +# **fakeAnyOfWIthSameErasureGet** +> FakeAnyOfWIthSameErasureGet200Response fakeAnyOfWIthSameErasureGet() + + + +Test route, this shouldn't cause a compiler error + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + FakeAnyOfWIthSameErasureGet200Response result = apiInstance.fakeAnyOfWIthSameErasureGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fakeAnyOfWIthSameErasureGet"); + 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 + +[**FakeAnyOfWIthSameErasureGet200Response**](FakeAnyOfWIthSameErasureGet200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful response | - | + + +# **fakeFreeFormQueryParametersGet** +> fakeFreeFormQueryParametersGet(fixed, freeForm) + + + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + String fixed = "fixed_example"; // String | + Object freeForm = null; // Object | + try { + apiInstance.fakeFreeFormQueryParametersGet(fixed, freeForm); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fakeFreeFormQueryParametersGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **fixed** | **String**| | [optional] | +| **freeForm** | [**Object**](.md)| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +# **fakeOneOfWIthSameErasureGet** +> FakeOneOfWIthSameErasureGet200Response fakeOneOfWIthSameErasureGet() + + + +Test route, this shouldn't cause a compiler error + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + FakeOneOfWIthSameErasureGet200Response result = apiInstance.fakeOneOfWIthSameErasureGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fakeOneOfWIthSameErasureGet"); + 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 + +[**FakeOneOfWIthSameErasureGet200Response**](FakeOneOfWIthSameErasureGet200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful response | - | + + +# **fooGet** +> FooGetDefaultResponse fooGet() + + + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + FooGetDefaultResponse result = apiInstance.fooGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fooGet"); + 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 + +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/DeprecatedObject.md b/samples/client/petstore/java/okhttp-jackson/docs/DeprecatedObject.md new file mode 100644 index 000000000000..48de1d624425 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/DeprecatedObject.md @@ -0,0 +1,13 @@ + + +# DeprecatedObject + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Dog.md b/samples/client/petstore/java/okhttp-jackson/docs/Dog.md new file mode 100644 index 000000000000..972c981c0d05 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Dog.md @@ -0,0 +1,13 @@ + + +# Dog + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Drawing.md b/samples/client/petstore/java/okhttp-jackson/docs/Drawing.md new file mode 100644 index 000000000000..6b815fc4131b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Drawing.md @@ -0,0 +1,16 @@ + + +# Drawing + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mainShape** | [**Shape**](Shape.md) | | [optional] | +|**shapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] | +|**nullableShape** | [**NullableShape**](NullableShape.md) | | [optional] | +|**shapes** | [**List<Shape>**](Shape.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/EnumArrays.md b/samples/client/petstore/java/okhttp-jackson/docs/EnumArrays.md new file mode 100644 index 000000000000..b2222d5beb25 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/EnumArrays.md @@ -0,0 +1,32 @@ + + +# EnumArrays + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] | +|**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] | + + + +## Enum: JustSymbolEnum + +| Name | Value | +|---- | -----| +| GREATER_THAN_OR_EQUAL_TO | ">=" | +| DOLLAR | "$" | + + + +## Enum: List<ArrayEnumEnum> + +| Name | Value | +|---- | -----| +| FISH | "fish" | +| CRAB | "crab" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/EnumClass.md b/samples/client/petstore/java/okhttp-jackson/docs/EnumClass.md new file mode 100644 index 000000000000..b314590a7591 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/EnumClass.md @@ -0,0 +1,15 @@ + + +# EnumClass + +## Enum + + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/EnumStringDiscriminator.md b/samples/client/petstore/java/okhttp-jackson/docs/EnumStringDiscriminator.md new file mode 100644 index 000000000000..83aebcdb4226 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/EnumStringDiscriminator.md @@ -0,0 +1,23 @@ + + +# EnumStringDiscriminator + +An object to test discriminator of enum string + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**enumStrType** | [**EnumStrTypeEnum**](#EnumStrTypeEnum) | enum string type | | + + + +## Enum: EnumStrTypeEnum + +| Name | Value | +|---- | -----| +| A | "type_a" | +| B | "type_b" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/EnumTest.md b/samples/client/petstore/java/okhttp-jackson/docs/EnumTest.md new file mode 100644 index 000000000000..3e226e18b50b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/EnumTest.md @@ -0,0 +1,68 @@ + + +# EnumTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] | +|**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | | +|**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] | +|**enumIntegerOnly** | [**EnumIntegerOnlyEnum**](#EnumIntegerOnlyEnum) | | [optional] | +|**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] | +|**outerEnum** | **OuterEnum** | | [optional] | +|**outerEnumInteger** | **OuterEnumInteger** | | [optional] | +|**outerEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] | +|**outerEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] | + + + +## Enum: EnumStringEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumStringRequiredEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumIntegerEnum + +| Name | Value | +|---- | -----| +| NUMBER_1 | 1 | +| NUMBER_MINUS_1 | -1 | + + + +## Enum: EnumIntegerOnlyEnum + +| Name | Value | +|---- | -----| +| NUMBER_2 | 2 | +| NUMBER_MINUS_2 | -2 | + + + +## Enum: EnumNumberEnum + +| Name | Value | +|---- | -----| +| NUMBER_1_DOT_1 | 1.1 | +| NUMBER_MINUS_1_DOT_2 | -1.2 | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/EquilateralTriangle.md b/samples/client/petstore/java/okhttp-jackson/docs/EquilateralTriangle.md new file mode 100644 index 000000000000..eade817feb3e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/EquilateralTriangle.md @@ -0,0 +1,14 @@ + + +# EquilateralTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/FakeAnyOfWIthSameErasureGet200Response.md b/samples/client/petstore/java/okhttp-jackson/docs/FakeAnyOfWIthSameErasureGet200Response.md new file mode 100644 index 000000000000..c224eb3d572f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/FakeAnyOfWIthSameErasureGet200Response.md @@ -0,0 +1,12 @@ + + +# FakeAnyOfWIthSameErasureGet200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/FakeApi.md b/samples/client/petstore/java/okhttp-jackson/docs/FakeApi.md new file mode 100644 index 000000000000..00d888ebe6e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/FakeApi.md @@ -0,0 +1,1571 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fakeGetFreeFormObjectGet**](FakeApi.md#fakeGetFreeFormObjectGet) | **GET** /fake/get-free-form-object | | +| [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | +| [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | | +| [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | | +| [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | | +| [**fakeRefParameter**](FakeApi.md#fakeRefParameter) | **POST** /fake/pet/{petId}/reference/parameter | fake reference parameter | +| [**fakeRequiredNullableBodyGet**](FakeApi.md#fakeRequiredNullableBodyGet) | **GET** /fake/required-nullable-body | fields in the response body, required and nullable are both true | +| [**fakeUploadRefRequestBodies**](FakeApi.md#fakeUploadRefRequestBodies) | **POST** /fake/pet/{petId}/uploadImage | fake reference parameter | +| [**getFakeArrayofenums**](FakeApi.md#getFakeArrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**getFakeHealth**](FakeApi.md#getFakeHealth) | **GET** /fake/health | Health check endpoint | +| [**getParameterNameMapping**](FakeApi.md#getParameterNameMapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test | +| [**testAdditionalPropertiesReference**](FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | +| [**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 | +| [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 | +| [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters | +| [**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) | +| [**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties | +| [**testInlineFreeformAdditionalProperties**](FakeApi.md#testInlineFreeformAdditionalProperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties | +| [**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data | +| [**testNullableRequiredFieldsAnyOf**](FakeApi.md#testNullableRequiredFieldsAnyOf) | **GET** /fake/nullable-required-fields-anyof | test anyOf with map of objects containing nullable required fields | +| [**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | | +| [**testStringMapReference**](FakeApi.md#testStringMapReference) | **POST** /fake/stringMap-reference | test referenced string map | + + + +# **fakeGetFreeFormObjectGet** +> FreeFormObjectTestClass fakeGetFreeFormObjectGet() + + + +Get a free form object or Json string + +### 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 { + FreeFormObjectTestClass result = apiInstance.fakeGetFreeFormObjectGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeGetFreeFormObjectGet"); + 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 + +[**FreeFormObjectTestClass**](FreeFormObjectTestClass.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### 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); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **Boolean**| Input boolean as post body | [optional] | + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(outerComposite) + + + +Test serialization of object with outer number type + +### 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); + OuterComposite outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(outerComposite); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] | + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### 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); + BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **BigDecimal**| Input number as post body | [optional] | + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### 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); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **String**| Input string as post body | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + + +# **fakeRefParameter** +> fakeRefParameter(petId) + +fake reference parameter + + + +### 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); + FakeRefParameterPetIdParameter petId = new FakeRefParameterPetIdParameter(); // FakeRefParameterPetIdParameter | to test oneOf in parameter $ref + try { + apiInstance.fakeRefParameter(petId); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeRefParameter"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | [**FakeRefParameterPetIdParameter**](.md)| to test oneOf in parameter $ref | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **fakeRequiredNullableBodyGet** +> RequiredNullableBody fakeRequiredNullableBodyGet() + +fields in the response body, required and nullable are both true + + + +### 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 { + RequiredNullableBody result = apiInstance.fakeRequiredNullableBodyGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeRequiredNullableBodyGet"); + 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 + +[**RequiredNullableBody**](RequiredNullableBody.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | success | - | + + +# **fakeUploadRefRequestBodies** +> ModelApiResponse fakeUploadRefRequestBodies(petId, additionalMetadata, _file) + +fake reference parameter + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.fakeUploadRefRequestBodies(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeUploadRefRequestBodies"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getFakeArrayofenums** +> List<OuterEnum> getFakeArrayofenums() + +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.getFakeArrayofenums(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getFakeArrayofenums"); + 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 | - | + + +# **getFakeHealth** +> HealthCheckResult getFakeHealth() + +Health check endpoint + +### 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 { + HealthCheckResult result = apiInstance.getFakeHealth(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getFakeHealth"); + 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 + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | The instance started successfully | - | + + +# **getParameterNameMapping** +> getParameterNameMapping(underscoreType, type, typeWithUnderscore) + +parameter name mapping test + +### 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); + Long underscoreType = 56L; // Long | _type + String type = "type_example"; // String | type + String typeWithUnderscore = "typeWithUnderscore_example"; // String | type_ + try { + apiInstance.getParameterNameMapping(underscoreType, type, typeWithUnderscore); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getParameterNameMapping"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **underscoreType** | **Long**| _type | | +| **type** | **String**| type | | +| **typeWithUnderscore** | **String**| type_ | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +# **testAdditionalPropertiesReference** +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### 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); + Map requestBody = null; // Map | request body + try { + apiInstance.testAdditionalPropertiesReference(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testAdditionalPropertiesReference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, Object>**](Object.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +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); + FileSchemaTestClass fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(fileSchemaTestClass); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(query, user) + + + +### 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); + String query = "query_example"; // String | + User user = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, user); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **query** | **String**| | | +| **user** | [**User**](User.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testClientModel** +> Client testClientModel(client) + +To test \"client\" model + +To test \"client\" model + +### 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); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testEndpointParameters** +> testEndpointParameters(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 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(78); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = LocalDate.now(); // LocalDate | None + OffsetDateTime dateTime = OffsetDateTime.parse("2010-02-01T10:20:10.111110+01:00"); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **number** | **BigDecimal**| None | | +| **_double** | **Double**| None | | +| **patternWithoutDelimiter** | **String**| None | | +| **_byte** | **byte[]**| None | | +| **integer** | **Integer**| None | [optional] | +| **int32** | **Integer**| None | [optional] | +| **int64** | **Long**| None | [optional] | +| **_float** | **Float**| None | [optional] | +| **string** | **String**| None | [optional] | +| **binary** | **File**| None | [optional] | +| **date** | **LocalDate**| None | [optional] | +| **dateTime** | **OffsetDateTime**| None | [optional] [default to 2010-02-01T10:20:10.111110+01:00] | +| **password** | **String**| None | [optional] | +| **paramCallback** | **String**| None | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **testEnumParameters** +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### 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); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "_abc"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "_abc"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 1; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 1.1D; // Double | Query parameter enum test (double) + List enumFormStringArray = Arrays.asList("$"); // List | Form parameter enum test (string array) + String enumFormString = "_abc"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] | +| **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] | +| **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] | +| **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] | +| **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] | +| **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + + +# **testGroupParameters** +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group).stringGroup(stringGroup).booleanGroup(booleanGroup).int64Group(int64Group).execute(); + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP bearer authorization: bearer_test + HttpBearerAuth bearer_test = (HttpBearerAuth) defaultClient.getAuthentication("bearer_test"); + bearer_test.setBearerToken("BEARER TOKEN"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requiredStringGroup** | **Integer**| Required String in group parameters | | +| **requiredBooleanGroup** | **Boolean**| Required Boolean in group parameters | | +| **requiredInt64Group** | **Long**| Required Integer in group parameters | | +| **stringGroup** | **Integer**| String in group parameters | [optional] | +| **booleanGroup** | **Boolean**| Boolean in group parameters | [optional] | +| **int64Group** | **Long**| Integer in group parameters | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Something wrong | - | + + +# **testInlineAdditionalProperties** +> testInlineAdditionalProperties(requestBody) + +test inline additionalProperties + + + +### 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); + Map requestBody = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, String>**](String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testInlineFreeformAdditionalProperties** +> testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + + + +### 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); + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = new TestInlineFreeformAdditionalPropertiesRequest(); // TestInlineFreeformAdditionalPropertiesRequest | request body + try { + apiInstance.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineFreeformAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + + + +### 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); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **param** | **String**| field1 | | +| **param2** | **String**| field2 | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testNullableRequiredFieldsAnyOf** +> NullableFieldsMapResponse testNullableRequiredFieldsAnyOf() + +test anyOf with map of objects containing nullable required fields + +Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + +### 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 { + NullableFieldsMapResponse result = apiInstance.testNullableRequiredFieldsAnyOf(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testNullableRequiredFieldsAnyOf"); + 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 + +[**NullableFieldsMapResponse**](NullableFieldsMapResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + + +To test the collection format in query parameters + +### 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); + List pipe = Arrays.asList(); // List | + List ioutil = Arrays.asList(); // List | + List http = Arrays.asList(); // List | + List url = Arrays.asList(); // List | + List context = Arrays.asList(); // List | + try { + apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pipe** | [**List<String>**](String.md)| | | +| **ioutil** | [**List<String>**](String.md)| | | +| **http** | [**List<String>**](String.md)| | | +| **url** | [**List<String>**](String.md)| | | +| **context** | [**List<String>**](String.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testStringMapReference** +> testStringMapReference(requestBody) + +test referenced string map + + + +### 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); + Map requestBody = new HashMap(); // Map | request body + try { + apiInstance.testStringMapReference(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testStringMapReference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, String>**](String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/okhttp-jackson/docs/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..95a8c171fc34 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/FakeClassnameTags123Api.md @@ -0,0 +1,78 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case | + + + +# **testClassname** +> Client testClassname(client) + +To test class name in snake case + +To test class name in snake case + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); + + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/FakeOneOfWIthSameErasureGet200Response.md b/samples/client/petstore/java/okhttp-jackson/docs/FakeOneOfWIthSameErasureGet200Response.md new file mode 100644 index 000000000000..0a3fbf6f8fca --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/FakeOneOfWIthSameErasureGet200Response.md @@ -0,0 +1,12 @@ + + +# FakeOneOfWIthSameErasureGet200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/FakeRefParameterPetIdParameter.md b/samples/client/petstore/java/okhttp-jackson/docs/FakeRefParameterPetIdParameter.md new file mode 100644 index 000000000000..1328d3c125c4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/FakeRefParameterPetIdParameter.md @@ -0,0 +1,12 @@ + + +# FakeRefParameterPetIdParameter + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/FileSchemaTestClass.md b/samples/client/petstore/java/okhttp-jackson/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..85d1a0636694 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/FileSchemaTestClass.md @@ -0,0 +1,14 @@ + + +# FileSchemaTestClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_file** | [**ModelFile**](ModelFile.md) | | [optional] | +|**files** | [**List<ModelFile>**](ModelFile.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Foo.md b/samples/client/petstore/java/okhttp-jackson/docs/Foo.md new file mode 100644 index 000000000000..6b3f0556528a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Foo.md @@ -0,0 +1,13 @@ + + +# Foo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/FooGetDefaultResponse.md b/samples/client/petstore/java/okhttp-jackson/docs/FooGetDefaultResponse.md new file mode 100644 index 000000000000..ff3d7a3a56c3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/FooGetDefaultResponse.md @@ -0,0 +1,13 @@ + + +# FooGetDefaultResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**string** | [**Foo**](Foo.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/FormatTest.md b/samples/client/petstore/java/okhttp-jackson/docs/FormatTest.md new file mode 100644 index 000000000000..71790022c16d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/FormatTest.md @@ -0,0 +1,29 @@ + + +# FormatTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integer** | **Integer** | | [optional] | +|**int32** | **Integer** | | [optional] | +|**int64** | **Long** | | [optional] | +|**number** | **BigDecimal** | | | +|**_float** | **Float** | | [optional] | +|**_double** | **Double** | | [optional] | +|**decimal** | **BigDecimal** | | [optional] | +|**string** | **String** | | [optional] | +|**_byte** | **byte[]** | | | +|**binary** | **File** | | [optional] | +|**date** | **LocalDate** | | | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**uuid** | **UUID** | | [optional] | +|**uuidWithDefault** | **UUID** | | [optional] | +|**password** | **String** | | | +|**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] | +|**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/FreeFormObjectTestClass.md b/samples/client/petstore/java/okhttp-jackson/docs/FreeFormObjectTestClass.md new file mode 100644 index 000000000000..3bb6144bc90b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/FreeFormObjectTestClass.md @@ -0,0 +1,14 @@ + + +# FreeFormObjectTestClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**properties** | [**FreeFormObjectTestClassProperties**](FreeFormObjectTestClassProperties.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/FreeFormObjectTestClassProperties.md b/samples/client/petstore/java/okhttp-jackson/docs/FreeFormObjectTestClassProperties.md new file mode 100644 index 000000000000..8a7c9d2838a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/FreeFormObjectTestClassProperties.md @@ -0,0 +1,12 @@ + + +# FreeFormObjectTestClassProperties + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Fruit.md b/samples/client/petstore/java/okhttp-jackson/docs/Fruit.md new file mode 100644 index 000000000000..f1915ef9b5b6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Fruit.md @@ -0,0 +1,16 @@ + + +# Fruit + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**color** | **String** | | [optional] | +|**cultivar** | **String** | | [optional] | +|**origin** | **String** | | [optional] | +|**lengthCm** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/FruitReq.md b/samples/client/petstore/java/okhttp-jackson/docs/FruitReq.md new file mode 100644 index 000000000000..859a881b53ec --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/FruitReq.md @@ -0,0 +1,16 @@ + + +# FruitReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | | +|**mealy** | **Boolean** | | [optional] | +|**lengthCm** | **BigDecimal** | | | +|**sweet** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/GmFruit.md b/samples/client/petstore/java/okhttp-jackson/docs/GmFruit.md new file mode 100644 index 000000000000..1a301bf9600a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/GmFruit.md @@ -0,0 +1,16 @@ + + +# GmFruit + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**color** | **String** | | [optional] | +|**cultivar** | **String** | | [optional] | +|**origin** | **String** | | [optional] | +|**lengthCm** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/GrandparentAnimal.md b/samples/client/petstore/java/okhttp-jackson/docs/GrandparentAnimal.md new file mode 100644 index 000000000000..9737408f2724 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/GrandparentAnimal.md @@ -0,0 +1,13 @@ + + +# GrandparentAnimal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**petType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/okhttp-jackson/docs/HasOnlyReadOnly.md new file mode 100644 index 000000000000..29da5205dbba --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/HasOnlyReadOnly.md @@ -0,0 +1,14 @@ + + +# HasOnlyReadOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**foo** | **String** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/HealthCheckResult.md b/samples/client/petstore/java/okhttp-jackson/docs/HealthCheckResult.md new file mode 100644 index 000000000000..4885e6f1cada --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/HealthCheckResult.md @@ -0,0 +1,14 @@ + + +# HealthCheckResult + +Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**nullableMessage** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/IsoscelesTriangle.md b/samples/client/petstore/java/okhttp-jackson/docs/IsoscelesTriangle.md new file mode 100644 index 000000000000..0bd5045bc68f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/IsoscelesTriangle.md @@ -0,0 +1,14 @@ + + +# IsoscelesTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Mammal.md b/samples/client/petstore/java/okhttp-jackson/docs/Mammal.md new file mode 100644 index 000000000000..71f0fce48839 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Mammal.md @@ -0,0 +1,26 @@ + + +# Mammal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasBaleen** | **Boolean** | | [optional] | +|**hasTeeth** | **Boolean** | | [optional] | +|**className** | **String** | | | +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| PLAINS | "plains" | +| MOUNTAIN | "mountain" | +| GREVYS | "grevys" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/MammalAnyof.md b/samples/client/petstore/java/okhttp-jackson/docs/MammalAnyof.md new file mode 100644 index 000000000000..7a366e10da49 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/MammalAnyof.md @@ -0,0 +1,26 @@ + + +# MammalAnyof + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasBaleen** | **Boolean** | | [optional] | +|**hasTeeth** | **Boolean** | | [optional] | +|**className** | **String** | | | +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| PLAINS | "plains" | +| MOUNTAIN | "mountain" | +| GREVYS | "grevys" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/MapTest.md b/samples/client/petstore/java/okhttp-jackson/docs/MapTest.md new file mode 100644 index 000000000000..54380188e1d6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/MapTest.md @@ -0,0 +1,25 @@ + + +# MapTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapMapOfString** | **Map<String, Map<String, String>>** | | [optional] | +|**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] | +|**directMap** | **Map<String, Boolean>** | | [optional] | +|**indirectMap** | **Map<String, Boolean>** | | [optional] | + + + +## Enum: Map<String, InnerEnum> + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-jackson/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..a5ddf0faa6a9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,15 @@ + + +# MixedPropertiesAndAdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **UUID** | | [optional] | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**map** | [**Map<String, Animal>**](Animal.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Model200Response.md b/samples/client/petstore/java/okhttp-jackson/docs/Model200Response.md new file mode 100644 index 000000000000..109411580c62 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Model200Response.md @@ -0,0 +1,15 @@ + + +# Model200Response + +Model for testing model name starting with number + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | [optional] | +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-jackson/docs/ModelApiResponse.md new file mode 100644 index 000000000000..e374c2dd2dec --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ModelApiResponse.md @@ -0,0 +1,15 @@ + + +# ModelApiResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ModelFile.md b/samples/client/petstore/java/okhttp-jackson/docs/ModelFile.md new file mode 100644 index 000000000000..adcde984f527 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ModelFile.md @@ -0,0 +1,14 @@ + + +# ModelFile + +Must be named `File` for test. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**sourceURI** | **String** | Test capitalization | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ModelList.md b/samples/client/petstore/java/okhttp-jackson/docs/ModelList.md new file mode 100644 index 000000000000..f93ab7dde8d4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ModelList.md @@ -0,0 +1,13 @@ + + +# ModelList + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_123list** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ModelReturn.md b/samples/client/petstore/java/okhttp-jackson/docs/ModelReturn.md new file mode 100644 index 000000000000..0bd356861eb7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ModelReturn.md @@ -0,0 +1,14 @@ + + +# ModelReturn + +Model for testing reserved words + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_return** | **Integer** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ModelWithOneOfAnyOfProperties.md b/samples/client/petstore/java/okhttp-jackson/docs/ModelWithOneOfAnyOfProperties.md new file mode 100644 index 000000000000..64c1206365fd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ModelWithOneOfAnyOfProperties.md @@ -0,0 +1,14 @@ + + +# ModelWithOneOfAnyOfProperties + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**oneofProp** | [**ArrayOneOf**](ArrayOneOf.md) | | [optional] | +|**anyofProp** | [**ArrayAnyOf**](ArrayAnyOf.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Name.md b/samples/client/petstore/java/okhttp-jackson/docs/Name.md new file mode 100644 index 000000000000..c901d9435309 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Name.md @@ -0,0 +1,17 @@ + + +# Name + +Model for testing model name same as property name + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | | +|**snakeCase** | **Integer** | | [optional] [readonly] | +|**property** | **String** | | [optional] | +|**_123number** | **Integer** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/NestedArrayWithDefaultValues.md b/samples/client/petstore/java/okhttp-jackson/docs/NestedArrayWithDefaultValues.md new file mode 100644 index 000000000000..c5f272f1cb30 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/NestedArrayWithDefaultValues.md @@ -0,0 +1,13 @@ + + +# NestedArrayWithDefaultValues + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**nestedArray** | **List<List<String>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/NewPet.md b/samples/client/petstore/java/okhttp-jackson/docs/NewPet.md new file mode 100644 index 000000000000..3cfa8c0076fe --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/NewPet.md @@ -0,0 +1,31 @@ + + +# NewPet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**categoryInlineAllof** | [**NewPetCategoryInlineAllof**](NewPetCategoryInlineAllof.md) | | [optional] | +|**categoryAllOfRef** | [**Category**](Category.md) | | [optional] | +|**categoryAllOfRefDescription** | [**Category**](Category.md) | Adding description to property using allOf | [optional] | +|**categoryAllOfRefDescriptionReadonly** | [**Category**](Category.md) | Adding description to readonly property using allOf | [optional] [readonly] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/NewPetCategoryInlineAllof.md b/samples/client/petstore/java/okhttp-jackson/docs/NewPetCategoryInlineAllof.md new file mode 100644 index 000000000000..7e8872f8132d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/NewPetCategoryInlineAllof.md @@ -0,0 +1,15 @@ + + +# NewPetCategoryInlineAllof + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | +|**categoryTag** | [**NewPetCategoryInlineAllofAllOfCategoryTag**](NewPetCategoryInlineAllofAllOfCategoryTag.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md b/samples/client/petstore/java/okhttp-jackson/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md new file mode 100644 index 000000000000..d685440279e9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md @@ -0,0 +1,14 @@ + + +# NewPetCategoryInlineAllofAllOfCategoryTag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/NullableClass.md b/samples/client/petstore/java/okhttp-jackson/docs/NullableClass.md new file mode 100644 index 000000000000..fa98c5c6d984 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/NullableClass.md @@ -0,0 +1,24 @@ + + +# NullableClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integerProp** | **Integer** | | [optional] | +|**numberProp** | **BigDecimal** | | [optional] | +|**booleanProp** | **Boolean** | | [optional] | +|**stringProp** | **String** | | [optional] | +|**dateProp** | **LocalDate** | | [optional] | +|**datetimeProp** | **OffsetDateTime** | | [optional] | +|**arrayNullableProp** | **List<Object>** | | [optional] | +|**arrayAndItemsNullableProp** | **List<Object>** | | [optional] | +|**arrayItemsNullable** | **List<Object>** | | [optional] | +|**objectNullableProp** | **Map<String, Object>** | | [optional] | +|**objectAndItemsNullableProp** | **Map<String, Object>** | | [optional] | +|**objectItemsNullable** | **Map<String, Object>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/NullableEnum.md b/samples/client/petstore/java/okhttp-jackson/docs/NullableEnum.md new file mode 100644 index 000000000000..774c8d6b1d70 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/NullableEnum.md @@ -0,0 +1,11 @@ + + +# NullableEnum + +## Enum + + +* `CUSTOM` (value: `"custom"`) + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsMapError.md b/samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsMapError.md new file mode 100644 index 000000000000..c129f355904a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsMapError.md @@ -0,0 +1,15 @@ + + +# NullableFieldsMapError + +Error response + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | | +|**reason** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsMapResponse.md b/samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsMapResponse.md new file mode 100644 index 000000000000..de7b03be5807 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsMapResponse.md @@ -0,0 +1,15 @@ + + +# NullableFieldsMapResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | | +|**positions** | [**Map<String, NullableFieldsValue>**](NullableFieldsValue.md) | | | +|**reason** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsMapSuccess.md b/samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsMapSuccess.md new file mode 100644 index 000000000000..0ce60cd148f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsMapSuccess.md @@ -0,0 +1,15 @@ + + +# NullableFieldsMapSuccess + +Success response containing a map of objects with nullable fields + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | | +|**positions** | [**Map<String, NullableFieldsValue>**](NullableFieldsValue.md) | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsValue.md b/samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsValue.md new file mode 100644 index 000000000000..397f73f74007 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/NullableFieldsValue.md @@ -0,0 +1,15 @@ + + +# NullableFieldsValue + +Object with required but nullable string fields + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**before** | **String** | | | +|**after** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/NullableShape.md b/samples/client/petstore/java/okhttp-jackson/docs/NullableShape.md new file mode 100644 index 000000000000..9d40680fd2c2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/NullableShape.md @@ -0,0 +1,16 @@ + + +# NullableShape + +The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/NumberOnly.md b/samples/client/petstore/java/okhttp-jackson/docs/NumberOnly.md new file mode 100644 index 000000000000..b8ed1a4cfae1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/NumberOnly.md @@ -0,0 +1,13 @@ + + +# NumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justNumber** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ObjectWithDeprecatedFields.md b/samples/client/petstore/java/okhttp-jackson/docs/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..f1cf571f4c09 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ObjectWithDeprecatedFields.md @@ -0,0 +1,16 @@ + + +# ObjectWithDeprecatedFields + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **String** | | [optional] | +|**id** | **BigDecimal** | | [optional] | +|**deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] | +|**bars** | **List<String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Order.md b/samples/client/petstore/java/okhttp-jackson/docs/Order.md new file mode 100644 index 000000000000..27af32855c5c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Order.md @@ -0,0 +1,28 @@ + + +# Order + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/OuterComposite.md b/samples/client/petstore/java/okhttp-jackson/docs/OuterComposite.md new file mode 100644 index 000000000000..98b56e0763ff --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/OuterComposite.md @@ -0,0 +1,15 @@ + + +# OuterComposite + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**myNumber** | **BigDecimal** | | [optional] | +|**myString** | **String** | | [optional] | +|**myBoolean** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/OuterEnum.md b/samples/client/petstore/java/okhttp-jackson/docs/OuterEnum.md new file mode 100644 index 000000000000..e9228f060d25 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/OuterEnum.md @@ -0,0 +1,19 @@ + + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + +* `LOWER_CASE_S` (value: `"s"`) + +* `UPPER_CASE_S` (value: `"S"`) + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/OuterEnumDefaultValue.md b/samples/client/petstore/java/okhttp-jackson/docs/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..cbc7f4ba54d2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/OuterEnumDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumDefaultValue + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/OuterEnumInteger.md b/samples/client/petstore/java/okhttp-jackson/docs/OuterEnumInteger.md new file mode 100644 index 000000000000..f71dea30ad00 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/OuterEnumInteger.md @@ -0,0 +1,15 @@ + + +# OuterEnumInteger + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/java/okhttp-jackson/docs/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..99e6389f4278 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumIntegerDefaultValue + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ParentPet.md b/samples/client/petstore/java/okhttp-jackson/docs/ParentPet.md new file mode 100644 index 000000000000..4992b88a6710 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ParentPet.md @@ -0,0 +1,12 @@ + + +# ParentPet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Pet.md b/samples/client/petstore/java/okhttp-jackson/docs/Pet.md new file mode 100644 index 000000000000..08dfd8623602 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Pet.md @@ -0,0 +1,28 @@ + + +# Pet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/PetApi.md b/samples/client/petstore/java/okhttp-jackson/docs/PetApi.md new file mode 100644 index 000000000000..c7fa83cbbb77 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/PetApi.md @@ -0,0 +1,640 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | +| [**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) | + + + +# **addPet** +> addPet(pet) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(pet); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +# **updatePet** +> updatePet(pet) + +Update an existing pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(pet); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, contentType, additionalMetadata, _file) + +uploads an image + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String contentType = "contentType_example"; // String | Content type header parameter + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, contentType, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **contentType** | **String**| Content type header parameter | [optional] | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **uploadFileWithRequiredFile** +> ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **requiredFile** | **File**| file to upload | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/PetComposition.md b/samples/client/petstore/java/okhttp-jackson/docs/PetComposition.md new file mode 100644 index 000000000000..3f93a8972ddc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/PetComposition.md @@ -0,0 +1,28 @@ + + +# PetComposition + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/PetRef.md b/samples/client/petstore/java/okhttp-jackson/docs/PetRef.md new file mode 100644 index 000000000000..256faf704c49 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/PetRef.md @@ -0,0 +1,28 @@ + + +# PetRef + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/PetUsingAllOf.md b/samples/client/petstore/java/okhttp-jackson/docs/PetUsingAllOf.md new file mode 100644 index 000000000000..379da2dc359f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/PetUsingAllOf.md @@ -0,0 +1,28 @@ + + +# PetUsingAllOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | multi line description 2nd line last line | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/PetWithRequiredTags.md b/samples/client/petstore/java/okhttp-jackson/docs/PetWithRequiredTags.md new file mode 100644 index 000000000000..2f528f536e99 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/PetWithRequiredTags.md @@ -0,0 +1,28 @@ + + +# PetWithRequiredTags + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Pig.md b/samples/client/petstore/java/okhttp-jackson/docs/Pig.md new file mode 100644 index 000000000000..61079c61c498 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Pig.md @@ -0,0 +1,13 @@ + + +# Pig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/PropertyNameCollision.md b/samples/client/petstore/java/okhttp-jackson/docs/PropertyNameCollision.md new file mode 100644 index 000000000000..28775f9b7481 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/PropertyNameCollision.md @@ -0,0 +1,15 @@ + + +# PropertyNameCollision + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**underscoreType** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**typeWithUnderscore** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Quadrilateral.md b/samples/client/petstore/java/okhttp-jackson/docs/Quadrilateral.md new file mode 100644 index 000000000000..af9f89a6f710 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Quadrilateral.md @@ -0,0 +1,14 @@ + + +# Quadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/QuadrilateralInterface.md b/samples/client/petstore/java/okhttp-jackson/docs/QuadrilateralInterface.md new file mode 100644 index 000000000000..99451f3bd020 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/QuadrilateralInterface.md @@ -0,0 +1,13 @@ + + +# QuadrilateralInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ReadOnlyFirst.md b/samples/client/petstore/java/okhttp-jackson/docs/ReadOnlyFirst.md new file mode 100644 index 000000000000..ad6af7ee155f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ReadOnlyFirst.md @@ -0,0 +1,14 @@ + + +# ReadOnlyFirst + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**baz** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/RequiredNullableBody.md b/samples/client/petstore/java/okhttp-jackson/docs/RequiredNullableBody.md new file mode 100644 index 000000000000..b732ff05be76 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/RequiredNullableBody.md @@ -0,0 +1,34 @@ + + +# RequiredNullableBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integerProp** | **Integer** | | | +|**numberProp** | **BigDecimal** | | | +|**booleanProp** | **Boolean** | | | +|**stringProp** | **String** | | | +|**dateProp** | **LocalDate** | | | +|**datetimeProp** | **OffsetDateTime** | | | +|**arrayNullableProp** | **List<Object>** | | | +|**arrayAndItemsNullableProp** | **List<Object>** | | | +|**arrayItemsNullable** | **List<Object>** | | | +|**objectNullableProp** | **Map<String, Object>** | | | +|**objectAndItemsNullableProp** | **Map<String, Object>** | | | +|**objectItemsNullable** | **Map<String, Object>** | | | +|**customRefEnum** | **NullableEnum** | | | +|**customEnum** | [**CustomEnumEnum**](#CustomEnumEnum) | | | + + + +## Enum: CustomEnumEnum + +| Name | Value | +|---- | -----| +| CUSTOM | "custom" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Scalar.md b/samples/client/petstore/java/okhttp-jackson/docs/Scalar.md new file mode 100644 index 000000000000..45dbf799e91f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Scalar.md @@ -0,0 +1,13 @@ + + +# Scalar + +Values of scalar type + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ScalarAnyOf.md b/samples/client/petstore/java/okhttp-jackson/docs/ScalarAnyOf.md new file mode 100644 index 000000000000..767e9196023d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ScalarAnyOf.md @@ -0,0 +1,13 @@ + + +# ScalarAnyOf + +Values of scalar type using anyOf + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ScaleneTriangle.md b/samples/client/petstore/java/okhttp-jackson/docs/ScaleneTriangle.md new file mode 100644 index 000000000000..c578f6cbfaab --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ScaleneTriangle.md @@ -0,0 +1,14 @@ + + +# ScaleneTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Shape.md b/samples/client/petstore/java/okhttp-jackson/docs/Shape.md new file mode 100644 index 000000000000..51549d7b67f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Shape.md @@ -0,0 +1,15 @@ + + +# Shape + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ShapeInterface.md b/samples/client/petstore/java/okhttp-jackson/docs/ShapeInterface.md new file mode 100644 index 000000000000..b4f981e3b566 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ShapeInterface.md @@ -0,0 +1,13 @@ + + +# ShapeInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ShapeOrNull.md b/samples/client/petstore/java/okhttp-jackson/docs/ShapeOrNull.md new file mode 100644 index 000000000000..c4ae8f1b6720 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ShapeOrNull.md @@ -0,0 +1,16 @@ + + +# ShapeOrNull + +The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/SimpleQuadrilateral.md b/samples/client/petstore/java/okhttp-jackson/docs/SimpleQuadrilateral.md new file mode 100644 index 000000000000..52fb7d1a6a49 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/SimpleQuadrilateral.md @@ -0,0 +1,14 @@ + + +# SimpleQuadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/SpecialModelName.md b/samples/client/petstore/java/okhttp-jackson/docs/SpecialModelName.md new file mode 100644 index 000000000000..e17d0d797b7f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/SpecialModelName.md @@ -0,0 +1,14 @@ + + +# SpecialModelName + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**$specialPropertyName** | **Long** | | [optional] | +|**specialModelName** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/StoreApi.md b/samples/client/petstore/java/okhttp-jackson/docs/StoreApi.md new file mode 100644 index 000000000000..719f9df42478 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/StoreApi.md @@ -0,0 +1,266 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + 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 + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + + + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Tag.md b/samples/client/petstore/java/okhttp-jackson/docs/Tag.md new file mode 100644 index 000000000000..5088b2dd1c31 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Tag.md @@ -0,0 +1,14 @@ + + +# Tag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/client/petstore/java/okhttp-jackson/docs/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..dc066e6c7dac --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,13 @@ + + +# TestInlineFreeformAdditionalPropertiesRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someProperty** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Triangle.md b/samples/client/petstore/java/okhttp-jackson/docs/Triangle.md new file mode 100644 index 000000000000..71de2174f744 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Triangle.md @@ -0,0 +1,14 @@ + + +# Triangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/TriangleInterface.md b/samples/client/petstore/java/okhttp-jackson/docs/TriangleInterface.md new file mode 100644 index 000000000000..ef5fc7575f34 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/TriangleInterface.md @@ -0,0 +1,13 @@ + + +# TriangleInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/User.md b/samples/client/petstore/java/okhttp-jackson/docs/User.md new file mode 100644 index 000000000000..9e97dc35485f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/User.md @@ -0,0 +1,24 @@ + + +# User + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | +|**objectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] | +|**objectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] | +|**anyTypeProp** | **Object** | 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 | [optional] | +|**anyTypePropNullable** | **Object** | 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. | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/UserApi.md b/samples/client/petstore/java/okhttp-jackson/docs/UserApi.md new file mode 100644 index 000000000000..2c5974674074 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/UserApi.md @@ -0,0 +1,511 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | + + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### 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 | - | + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + 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 + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Value.md b/samples/client/petstore/java/okhttp-jackson/docs/Value.md new file mode 100644 index 000000000000..54c8fc245e72 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Value.md @@ -0,0 +1,12 @@ + + +# Value + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/ValuesApi.md b/samples/client/petstore/java/okhttp-jackson/docs/ValuesApi.md new file mode 100644 index 000000000000..4210bff03ec9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/ValuesApi.md @@ -0,0 +1,68 @@ +# ValuesApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getSomeValues**](ValuesApi.md#getSomeValues) | **GET** /values | Get some primitive variable values | + + + +# **getSomeValues** +> Variable getSomeValues() + +Get some primitive variable values + + + +### 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.ValuesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + ValuesApi apiInstance = new ValuesApi(defaultClient); + try { + Variable result = apiInstance.getSomeValues(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ValuesApi#getSomeValues"); + 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 + +[**Variable**](Variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Value | - | + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Variable.md b/samples/client/petstore/java/okhttp-jackson/docs/Variable.md new file mode 100644 index 000000000000..d179fb1775cf --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Variable.md @@ -0,0 +1,15 @@ + + +# Variable + +Value object + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | | +|**value** | [**Value**](Value.md) | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Whale.md b/samples/client/petstore/java/okhttp-jackson/docs/Whale.md new file mode 100644 index 000000000000..30ce4bb82151 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Whale.md @@ -0,0 +1,15 @@ + + +# Whale + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasBaleen** | **Boolean** | | [optional] | +|**hasTeeth** | **Boolean** | | [optional] | +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/docs/Zebra.md b/samples/client/petstore/java/okhttp-jackson/docs/Zebra.md new file mode 100644 index 000000000000..f7c4389b6456 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/docs/Zebra.md @@ -0,0 +1,24 @@ + + +# Zebra + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | +|**className** | **String** | | | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| PLAINS | "plains" | +| MOUNTAIN | "mountain" | +| GREVYS | "grevys" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson/git_push.sh b/samples/client/petstore/java/okhttp-jackson/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp-jackson/gradle.properties b/samples/client/petstore/java/okhttp-jackson/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-jackson/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-jackson/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-jackson/gradlew.bat b/samples/client/petstore/java/okhttp-jackson/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp-jackson/pom.xml b/samples/client/petstore/java/okhttp-jackson/pom.xml new file mode 100644 index 000000000000..13e177395378 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/pom.xml @@ -0,0 +1,307 @@ + + 4.0.0 + org.openapitools + petstore-okhttp-jackson + jar + petstore-okhttp-jackson + 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-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-annotations-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + org.apache.commons + commons-lang3 + ${commons-lang3-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.17.1 + 2.21 + 3.18.0 + 0.2.10 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp-jackson/settings.gradle b/samples/client/petstore/java/okhttp-jackson/settings.gradle new file mode 100644 index 000000000000..8d36ac794f12 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-okhttp-jackson" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-jackson/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..e9ab7a8d7a60 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiCallback.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; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..86f742d40253 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1801 @@ +/* + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://petstore.swagger.io:80/v2"; + 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" + ) + ) + )); + }} + ), + new ServerConfiguration( + "https://127.0.0.1/no_variable", + "The local server without variables", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = ""; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io:80/v2) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 access token for the first Bearer authentication. + * @param bearerToken Bearer token + */ + public void setBearerToken(String bearerToken) { + setBearerToken(() -> bearerToken); + } + + /** + * Helper method to set the supplier of access tokens for Bearer authentication. + * + * @param tokenSupplier The supplier of bearer tokens + */ + public void setBearerToken(Supplier tokenSupplier) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(tokenSupplier); + return; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..0c0f52846910 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..fb13945bd775 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..79955372fb33 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..ef679edf5eb7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,344 @@ +/* + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.openapitools.jackson.nullable.JsonNullableModule; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static ObjectMapper mapper; + + public JSON() { + if (mapper == null) { + mapper = JsonMapper.builder() + .serializationInclusion(JsonInclude.Include.NON_NULL) + .disable(MapperFeature.ALLOW_COERCION_OF_SCALARS) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()) + .addModule(new JavaTimeModule()) + .build(); + mapper.registerModule(new JsonNullableModule()); + } + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + * @return the target model class. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asText(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + * @return the target model class. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + * @param visitedClasses The set of classes that have already been visited. + * @return true if inst is an instance of modelClass in the OpenAPI model hierarchy. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map> descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (Class childType : descendants.values()) { + if (isInstanceOf(childType, inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map>> modelDescendants = new HashMap<>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map> descendants) { + modelDescendants.put(modelClass, descendants); + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return mapper; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.mapper = (ObjectMapper) serializer; + } + + + public static ObjectMapper getMapper() { + return mapper; + } + + public static void setMapper(ObjectMapper mapper) { + JSON.mapper = mapper; + } + + public static void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + // TODO: implement for Jackson + } + + public static void setLenientOnJson(boolean lenientOnJson) { + // TODO: implement for Jackson + } + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + // TODO: implement for Jackson + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + // TODO: implement for Jackson + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + try { + return mapper.writeValueAsString(obj); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + JavaType type = mapper.getTypeFactory().constructType(returnType); + return mapper.readValue(body, type); + } catch (IOException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw new RuntimeException(e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + JavaType type = mapper.getTypeFactory().constructType(returnType); + return mapper.readValue(inputStream, type); + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..505e6f786f4c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..924dd8668973 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..eee56669a4a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339DateFormat.java new file mode 100644 index 000000000000..f714c4f40799 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.text.DecimalFormat; +import java.util.GregorianCalendar; +import java.util.TimeZone; +import com.fasterxml.jackson.databind.util.StdDateFormat; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); + } + + @Override + public Date parse(String source) { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return super.clone(); + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java new file mode 100644 index 000000000000..7c21d936c8c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java @@ -0,0 +1,100 @@ +/* + * 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.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAccessor; +import java.util.function.BiFunction; +import java.util.function.Function; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; +import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class RFC3339InstantDeserializer extends InstantDeserializer { + private static final long serialVersionUID = 1L; + private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); + private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + = JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault(); + + public static final RFC3339InstantDeserializer INSTANT = new RFC3339InstantDeserializer<>( + Instant.class, DateTimeFormatter.ISO_INSTANT, + Instant::from, + a -> Instant.ofEpochMilli( a.value ), + a -> Instant.ofEpochSecond( a.integer, a.fraction ), + null, + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer OFFSET_DATE_TIME = new RFC3339InstantDeserializer<>( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + OffsetDateTime::from, + a -> OffsetDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> OffsetDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + (d, z) -> ( d.isEqual( OffsetDateTime.MIN ) || d.isEqual( OffsetDateTime.MAX ) ? + d : + d.withOffsetSameInstant( z.getRules().getOffset( d.toLocalDateTime() ) ) ), + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer ZONED_DATE_TIME = new RFC3339InstantDeserializer<>( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + ZonedDateTime::from, + a -> ZonedDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> ZonedDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + ZonedDateTime::withZoneSameInstant, + false, // keep zero offset and Z separate since zones explicitly supported + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + protected RFC3339InstantDeserializer( + Class supportedType, + DateTimeFormatter formatter, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust, + boolean replaceZeroOffsetAsZ, + boolean normalizeZoneId, + boolean readNumericStringsAsTimestamp) { + super( + supportedType, + formatter, + parsedToValue, + fromMilliseconds, + fromNanoseconds, + adjust, + replaceZeroOffsetAsZ, + normalizeZoneId, + readNumericStringsAsTimestamp + ); + } + + @Override + protected T _fromString(JsonParser p, DeserializationContext ctxt, String string0) throws IOException { + return super._fromString(p, ctxt, string0.replace( ' ', 'T' )); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java new file mode 100644 index 000000000000..b5d92286f00a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.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; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; + +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.Module.SetupContext; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class RFC3339JavaTimeModule extends SimpleModule { + private static final long serialVersionUID = 1L; + + public RFC3339JavaTimeModule() { + super("RFC3339JavaTimeModule"); + } + + @Override + public void setupModule(SetupContext context) { + super.setupModule(context); + + addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT); + addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME); + addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME); + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..1787a231e76b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..bc81f54d83a6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..6473166843d5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java new file mode 100644 index 000000000000..45e574d1ff7c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -0,0 +1,458 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AnotherFakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AnotherFakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public AnotherFakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for call123testSpecialTags + * @param client client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = client; + + // create path and map variables + String localVarPath = "/another-fake/dummy"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call call123testSpecialTagsValidateBeforeCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException("Missing the required parameter 'client' when calling call123testSpecialTags(Async)"); + } + + return call123testSpecialTagsCall(client, _callback); + + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client call123testSpecialTags(@javax.annotation.Nonnull Client client) throws ApiException { + ApiResponse localVarResp = call123testSpecialTagsWithHttpInfo(client); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(client, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test special tags (asynchronously) + * To test special tags and operation ID starting with number + * @param client client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsAsync(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(client, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getParameterArrayNumber + * @param array array integer (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterArrayNumberCall(@javax.annotation.Nonnull List array, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/parameter-array-number"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (array != null) { + localVarHeaderParams.put("array", localVarApiClient.parameterToString(array)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getParameterArrayNumberValidateBeforeCall(@javax.annotation.Nonnull List array, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'array' is set + if (array == null) { + throw new ApiException("Missing the required parameter 'array' when calling getParameterArrayNumber(Async)"); + } + + return getParameterArrayNumberCall(array, _callback); + + } + + /** + * parameter array number default value + * + * @param array array integer (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getParameterArrayNumber(@javax.annotation.Nonnull List array) throws ApiException { + getParameterArrayNumberWithHttpInfo(array); + } + + /** + * parameter array number default value + * + * @param array array integer (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getParameterArrayNumberWithHttpInfo(@javax.annotation.Nonnull List array) throws ApiException { + okhttp3.Call localVarCall = getParameterArrayNumberValidateBeforeCall(array, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * parameter array number default value (asynchronously) + * + * @param array array integer (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterArrayNumberAsync(@javax.annotation.Nonnull List array, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getParameterArrayNumberValidateBeforeCall(array, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getParameterStringNumber + * @param stringNumber string number (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterStringNumberCall(@javax.annotation.Nonnull BigDecimal stringNumber, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/parameter-string-number"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (stringNumber != null) { + localVarHeaderParams.put("string_number", localVarApiClient.parameterToString(stringNumber)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getParameterStringNumberValidateBeforeCall(@javax.annotation.Nonnull BigDecimal stringNumber, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'stringNumber' is set + if (stringNumber == null) { + throw new ApiException("Missing the required parameter 'stringNumber' when calling getParameterStringNumber(Async)"); + } + + return getParameterStringNumberCall(stringNumber, _callback); + + } + + /** + * parameter string number + * + * @param stringNumber string number (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getParameterStringNumber(@javax.annotation.Nonnull BigDecimal stringNumber) throws ApiException { + getParameterStringNumberWithHttpInfo(stringNumber); + } + + /** + * parameter string number + * + * @param stringNumber string number (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getParameterStringNumberWithHttpInfo(@javax.annotation.Nonnull BigDecimal stringNumber) throws ApiException { + okhttp3.Call localVarCall = getParameterStringNumberValidateBeforeCall(stringNumber, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * parameter string number (asynchronously) + * + * @param stringNumber string number (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterStringNumberAsync(@javax.annotation.Nonnull BigDecimal stringNumber, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getParameterStringNumberValidateBeforeCall(stringNumber, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..7fe06392c8c4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,563 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import org.openapitools.client.model.FakeAnyOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FakeOneOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FooGetDefaultResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DefaultApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for fakeAnyOfWIthSameErasureGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeAnyOfWIthSameErasureGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/anyOfWIthSameErasure"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeAnyOfWIthSameErasureGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeAnyOfWIthSameErasureGetCall(_callback); + + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return FakeAnyOfWIthSameErasureGet200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public FakeAnyOfWIthSameErasureGet200Response fakeAnyOfWIthSameErasureGet() throws ApiException { + ApiResponse localVarResp = fakeAnyOfWIthSameErasureGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return ApiResponse<FakeAnyOfWIthSameErasureGet200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public ApiResponse fakeAnyOfWIthSameErasureGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeAnyOfWIthSameErasureGetValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test route, this shouldn't cause a compiler error + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeAnyOfWIthSameErasureGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeAnyOfWIthSameErasureGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeFreeFormQueryParametersGet + * @param fixed (optional) + * @param freeForm (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call fakeFreeFormQueryParametersGetCall(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/free-form-query-parameters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (fixed != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fixed", fixed)); + } + + if (freeForm != null) { + localVarQueryParams.addAll(localVarApiClient.freeFormParameterToPairs(freeForm)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeFreeFormQueryParametersGetValidateBeforeCall(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm, final ApiCallback _callback) throws ApiException { + return fakeFreeFormQueryParametersGetCall(fixed, freeForm, _callback); + + } + + /** + * + * + * @param fixed (optional) + * @param freeForm (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void fakeFreeFormQueryParametersGet(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm) throws ApiException { + fakeFreeFormQueryParametersGetWithHttpInfo(fixed, freeForm); + } + + /** + * + * + * @param fixed (optional) + * @param freeForm (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse fakeFreeFormQueryParametersGetWithHttpInfo(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm) throws ApiException { + okhttp3.Call localVarCall = fakeFreeFormQueryParametersGetValidateBeforeCall(fixed, freeForm, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param fixed (optional) + * @param freeForm (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call fakeFreeFormQueryParametersGetAsync(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeFreeFormQueryParametersGetValidateBeforeCall(fixed, freeForm, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for fakeOneOfWIthSameErasureGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeOneOfWIthSameErasureGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/oneOfWIthSameErasure"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOneOfWIthSameErasureGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeOneOfWIthSameErasureGetCall(_callback); + + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return FakeOneOfWIthSameErasureGet200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public FakeOneOfWIthSameErasureGet200Response fakeOneOfWIthSameErasureGet() throws ApiException { + ApiResponse localVarResp = fakeOneOfWIthSameErasureGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return ApiResponse<FakeOneOfWIthSameErasureGet200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public ApiResponse fakeOneOfWIthSameErasureGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeOneOfWIthSameErasureGetValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test route, this shouldn't cause a compiler error + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeOneOfWIthSameErasureGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOneOfWIthSameErasureGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fooGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public okhttp3.Call fooGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/foo"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fooGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fooGetCall(_callback); + + } + + /** + * + * + * @return FooGetDefaultResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public FooGetDefaultResponse fooGet() throws ApiException { + ApiResponse localVarResp = fooGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * + * @return ApiResponse<FooGetDefaultResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public ApiResponse fooGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fooGetValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public okhttp3.Call fooGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fooGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 000000000000..b274561074d5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,3457 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import org.openapitools.client.model.FakeRefParameterPetIdParameter; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.FreeFormObjectTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.NullableFieldsMapResponse; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.RequiredNullableBody; +import org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for fakeGetFreeFormObjectGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call fakeGetFreeFormObjectGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/get-free-form-object"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeGetFreeFormObjectGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeGetFreeFormObjectGetCall(_callback); + + } + + /** + * + * Get a free form object or Json string + * @return FreeFormObjectTestClass + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public FreeFormObjectTestClass fakeGetFreeFormObjectGet() throws ApiException { + ApiResponse localVarResp = fakeGetFreeFormObjectGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * Get a free form object or Json string + * @return ApiResponse<FreeFormObjectTestClass> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse fakeGetFreeFormObjectGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeGetFreeFormObjectGetValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get a free form object or Json string + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call fakeGetFreeFormObjectGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeGetFreeFormObjectGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterBooleanSerialize + * @param body Input boolean as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeCall(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterBooleanSerializeValidateBeforeCall(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + return fakeOuterBooleanSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public Boolean fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body) throws ApiException { + ApiResponse localVarResp = fakeOuterBooleanSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return ApiResponse<Boolean> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(@javax.annotation.Nullable Boolean body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterBooleanSerializeValidateBeforeCall(body, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeAsync(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterBooleanSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterCompositeSerialize + * @param outerComposite Input composite as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeCall(@javax.annotation.Nullable OuterComposite outerComposite, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = outerComposite; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterCompositeSerializeValidateBeforeCall(@javax.annotation.Nullable OuterComposite outerComposite, final ApiCallback _callback) throws ApiException { + return fakeOuterCompositeSerializeCall(outerComposite, _callback); + + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public OuterComposite fakeOuterCompositeSerialize(@javax.annotation.Nullable OuterComposite outerComposite) throws ApiException { + ApiResponse localVarResp = fakeOuterCompositeSerializeWithHttpInfo(outerComposite); + return localVarResp.getData(); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return ApiResponse<OuterComposite> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(@javax.annotation.Nullable OuterComposite outerComposite) throws ApiException { + okhttp3.Call localVarCall = fakeOuterCompositeSerializeValidateBeforeCall(outerComposite, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeAsync(@javax.annotation.Nullable OuterComposite outerComposite, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterCompositeSerializeValidateBeforeCall(outerComposite, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterNumberSerialize + * @param body Input number as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeCall(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterNumberSerializeValidateBeforeCall(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + return fakeOuterNumberSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public BigDecimal fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal body) throws ApiException { + ApiResponse localVarResp = fakeOuterNumberSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return ApiResponse<BigDecimal> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public ApiResponse fakeOuterNumberSerializeWithHttpInfo(@javax.annotation.Nullable BigDecimal body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterNumberSerializeValidateBeforeCall(body, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeAsync(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterNumberSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterStringSerialize + * @param body Input string as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeCall(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterStringSerializeValidateBeforeCall(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + return fakeOuterStringSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public String fakeOuterStringSerialize(@javax.annotation.Nullable String body) throws ApiException { + ApiResponse localVarResp = fakeOuterStringSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public ApiResponse fakeOuterStringSerializeWithHttpInfo(@javax.annotation.Nullable String body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterStringSerializeValidateBeforeCall(body, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeAsync(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterStringSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeRefParameter + * @param petId to test oneOf in parameter $ref (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeRefParameterCall(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/pet/{petId}/reference/parameter" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeRefParameterValidateBeforeCall(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling fakeRefParameter(Async)"); + } + + return fakeRefParameterCall(petId, _callback); + + } + + /** + * fake reference parameter + * + * @param petId to test oneOf in parameter $ref (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void fakeRefParameter(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId) throws ApiException { + fakeRefParameterWithHttpInfo(petId); + } + + /** + * fake reference parameter + * + * @param petId to test oneOf in parameter $ref (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse fakeRefParameterWithHttpInfo(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId) throws ApiException { + okhttp3.Call localVarCall = fakeRefParameterValidateBeforeCall(petId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * fake reference parameter (asynchronously) + * + * @param petId to test oneOf in parameter $ref (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeRefParameterAsync(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeRefParameterValidateBeforeCall(petId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for fakeRequiredNullableBodyGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public okhttp3.Call fakeRequiredNullableBodyGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/required-nullable-body"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeRequiredNullableBodyGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeRequiredNullableBodyGetCall(_callback); + + } + + /** + * fields in the response body, required and nullable are both true + * + * @return RequiredNullableBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public RequiredNullableBody fakeRequiredNullableBodyGet() throws ApiException { + ApiResponse localVarResp = fakeRequiredNullableBodyGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * fields in the response body, required and nullable are both true + * + * @return ApiResponse<RequiredNullableBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public ApiResponse fakeRequiredNullableBodyGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeRequiredNullableBodyGetValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * fields in the response body, required and nullable are both true (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public okhttp3.Call fakeRequiredNullableBodyGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeRequiredNullableBodyGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeUploadRefRequestBodies + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeUploadRefRequestBodiesCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeUploadRefRequestBodiesValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling fakeUploadRefRequestBodies(Async)"); + } + + return fakeUploadRefRequestBodiesCall(petId, additionalMetadata, _file, _callback); + + } + + /** + * fake reference parameter + * + * @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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse fakeUploadRefRequestBodies(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = fakeUploadRefRequestBodiesWithHttpInfo(petId, additionalMetadata, _file); + return localVarResp.getData(); + } + + /** + * fake reference parameter + * + * @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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse fakeUploadRefRequestBodiesWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = fakeUploadRefRequestBodiesValidateBeforeCall(petId, additionalMetadata, _file, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * fake reference parameter (asynchronously) + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeUploadRefRequestBodiesAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeUploadRefRequestBodiesValidateBeforeCall(petId, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getFakeArrayofenums + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public okhttp3.Call getFakeArrayofenumsCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/array-of-enums"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFakeArrayofenumsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getFakeArrayofenumsCall(_callback); + + } + + /** + * Array of Enums + * + * @return List<OuterEnum> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public List getFakeArrayofenums() throws ApiException { + ApiResponse> localVarResp = getFakeArrayofenumsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Array of Enums + * + * @return ApiResponse<List<OuterEnum>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public ApiResponse> getFakeArrayofenumsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getFakeArrayofenumsValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference>(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Array of Enums (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public okhttp3.Call getFakeArrayofenumsAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getFakeArrayofenumsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getFakeHealth + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public okhttp3.Call getFakeHealthCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/health"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFakeHealthValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getFakeHealthCall(_callback); + + } + + /** + * Health check endpoint + * + * @return HealthCheckResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public HealthCheckResult getFakeHealth() throws ApiException { + ApiResponse localVarResp = getFakeHealthWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Health check endpoint + * + * @return ApiResponse<HealthCheckResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public ApiResponse getFakeHealthWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getFakeHealthValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Health check endpoint (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public okhttp3.Call getFakeHealthAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getFakeHealthValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getParameterNameMapping + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterNameMappingCall(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/parameter-name-mapping"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (type != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("type", type)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (underscoreType != null) { + localVarHeaderParams.put("_type", localVarApiClient.parameterToString(underscoreType)); + } + + + if (typeWithUnderscore != null) { + localVarHeaderParams.put("type_", localVarApiClient.parameterToString(typeWithUnderscore)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getParameterNameMappingValidateBeforeCall(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'underscoreType' is set + if (underscoreType == null) { + throw new ApiException("Missing the required parameter 'underscoreType' when calling getParameterNameMapping(Async)"); + } + + // verify the required parameter 'type' is set + if (type == null) { + throw new ApiException("Missing the required parameter 'type' when calling getParameterNameMapping(Async)"); + } + + // verify the required parameter 'typeWithUnderscore' is set + if (typeWithUnderscore == null) { + throw new ApiException("Missing the required parameter 'typeWithUnderscore' when calling getParameterNameMapping(Async)"); + } + + return getParameterNameMappingCall(underscoreType, type, typeWithUnderscore, _callback); + + } + + /** + * parameter name mapping test + * + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getParameterNameMapping(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore) throws ApiException { + getParameterNameMappingWithHttpInfo(underscoreType, type, typeWithUnderscore); + } + + /** + * parameter name mapping test + * + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getParameterNameMappingWithHttpInfo(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore) throws ApiException { + okhttp3.Call localVarCall = getParameterNameMappingValidateBeforeCall(underscoreType, type, typeWithUnderscore, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * parameter name mapping test (asynchronously) + * + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterNameMappingAsync(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getParameterNameMappingValidateBeforeCall(underscoreType, type, typeWithUnderscore, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testAdditionalPropertiesReference + * @param requestBody request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testAdditionalPropertiesReferenceCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/fake/additionalProperties-reference"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testAdditionalPropertiesReferenceValidateBeforeCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference(Async)"); + } + + return testAdditionalPropertiesReferenceCall(requestBody, _callback); + + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testAdditionalPropertiesReference(@javax.annotation.Nonnull Map requestBody) throws ApiException { + testAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { + okhttp3.Call localVarCall = testAdditionalPropertiesReferenceValidateBeforeCall(requestBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test referenced additionalProperties (asynchronously) + * + * @param requestBody request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testAdditionalPropertiesReferenceAsync(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testAdditionalPropertiesReferenceValidateBeforeCall(requestBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testBodyWithFileSchema + * @param fileSchemaTestClass (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaCall(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = fileSchemaTestClass; + + // create path and map variables + String localVarPath = "/fake/body-with-file-schema"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithFileSchemaValidateBeforeCall(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) { + throw new ApiException("Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema(Async)"); + } + + return testBodyWithFileSchemaCall(fileSchemaTestClass, _callback); + + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithFileSchema(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithFileSchemaWithHttpInfo(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { + okhttp3.Call localVarCall = testBodyWithFileSchemaValidateBeforeCall(fileSchemaTestClass, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaAsync(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyWithFileSchemaValidateBeforeCall(fileSchemaTestClass, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testBodyWithQueryParams + * @param query (required) + * @param user (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsCall(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (query != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithQueryParamsValidateBeforeCall(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException("Missing the required parameter 'query' when calling testBodyWithQueryParams(Async)"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling testBodyWithQueryParams(Async)"); + } + + return testBodyWithQueryParamsCall(query, user, _callback); + + } + + /** + * + * + * @param query (required) + * @param user (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithQueryParams(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(query, user); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = testBodyWithQueryParamsValidateBeforeCall(query, user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param query (required) + * @param user (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsAsync(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyWithQueryParamsValidateBeforeCall(query, user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testClientModel + * @param client client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = client; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClientModelValidateBeforeCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException("Missing the required parameter 'client' when calling testClientModel(Async)"); + } + + return testClientModelCall(client, _callback); + + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClientModel(@javax.annotation.Nonnull Client client) throws ApiException { + ApiResponse localVarResp = testClientModelWithHttpInfo(client); + return localVarResp.getData(); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return ApiResponse<Client> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClientModelWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { + okhttp3.Call localVarCall = testClientModelValidateBeforeCall(client, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test \"client\" model (asynchronously) + * To test \"client\" model + * @param client client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelAsync(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testClientModelValidateBeforeCall(client, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testEndpointParameters + * @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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersCall(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "http_basic_test" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEndpointParametersValidateBeforeCall(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException("Missing the required parameter 'number' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException("Missing the required parameter '_double' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) { + throw new ApiException("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException("Missing the required parameter '_byte' when calling testEndpointParameters(Async)"); + } + + return testEndpointParametersCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, _callback); + + } + + /** + * 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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable 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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse testEndpointParametersWithHttpInfo(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { + okhttp3.Call localVarCall = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 (asynchronously) + * 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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersAsync(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testEnumParameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersCall(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (enumFormStringArray != null) { + localVarFormParams.put("enum_form_string_array", enumFormStringArray); + } + + if (enumFormString != null) { + localVarFormParams.put("enum_form_string", enumFormString); + } + + if (enumQueryStringArray != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "enum_query_string_array", enumQueryStringArray)); + } + + if (enumQueryString != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_string", enumQueryString)); + } + + if (enumQueryInteger != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_integer", enumQueryInteger)); + } + + if (enumQueryDouble != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_double", enumQueryDouble)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (enumHeaderStringArray != null) { + localVarHeaderParams.put("enum_header_string_array", localVarApiClient.parameterToString(enumHeaderStringArray)); + } + + + if (enumHeaderString != null) { + localVarHeaderParams.put("enum_header_string", localVarApiClient.parameterToString(enumHeaderString)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEnumParametersValidateBeforeCall(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + return testEnumParametersCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, _callback); + + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public void testEnumParameters(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable 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) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public ApiResponse testEnumParametersWithHttpInfo(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString) throws ApiException { + okhttp3.Call localVarCall = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * To test enum parameters (asynchronously) + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersAsync(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + private okhttp3.Call testGroupParametersCall(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (requiredStringGroup != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("required_string_group", requiredStringGroup)); + } + + if (requiredInt64Group != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("required_int64_group", requiredInt64Group)); + } + + if (stringGroup != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("string_group", stringGroup)); + } + + if (int64Group != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("int64_group", int64Group)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (requiredBooleanGroup != null) { + localVarHeaderParams.put("required_boolean_group", localVarApiClient.parameterToString(requiredBooleanGroup)); + } + + + if (booleanGroup != null) { + localVarHeaderParams.put("boolean_group", localVarApiClient.parameterToString(booleanGroup)); + } + + + String[] localVarAuthNames = new String[] { "bearer_test" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testGroupParametersValidateBeforeCall(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requiredStringGroup' is set + if (requiredStringGroup == null) { + throw new ApiException("Missing the required parameter 'requiredStringGroup' when calling testGroupParameters(Async)"); + } + + // verify the required parameter 'requiredBooleanGroup' is set + if (requiredBooleanGroup == null) { + throw new ApiException("Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters(Async)"); + } + + // verify the required parameter 'requiredInt64Group' is set + if (requiredInt64Group == null) { + throw new ApiException("Missing the required parameter 'requiredInt64Group' when calling testGroupParameters(Async)"); + } + + return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + + } + + + private ApiResponse testGroupParametersWithHttpInfo(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { + okhttp3.Call localVarCall = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call testGroupParametersAsync(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APItestGroupParametersRequest { + @javax.annotation.Nonnull + private final Integer requiredStringGroup; + @javax.annotation.Nonnull + private final Boolean requiredBooleanGroup; + @javax.annotation.Nonnull + private final Long requiredInt64Group; + @javax.annotation.Nullable + private Integer stringGroup; + @javax.annotation.Nullable + private Boolean booleanGroup; + @javax.annotation.Nullable + private Long int64Group; + + private APItestGroupParametersRequest(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group) { + this.requiredStringGroup = requiredStringGroup; + this.requiredBooleanGroup = requiredBooleanGroup; + this.requiredInt64Group = requiredInt64Group; + } + + /** + * Set stringGroup + * @param stringGroup String in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest stringGroup(@javax.annotation.Nullable Integer stringGroup) { + this.stringGroup = stringGroup; + return this; + } + + /** + * Set booleanGroup + * @param booleanGroup Boolean in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest booleanGroup(@javax.annotation.Nullable Boolean booleanGroup) { + this.booleanGroup = booleanGroup; + return this; + } + + /** + * Set int64Group + * @param int64Group Integer in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest int64Group(@javax.annotation.Nullable Long int64Group) { + this.int64Group = int64Group; + return this; + } + + /** + * Build call for testGroupParameters + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + } + + /** + * Execute testGroupParameters request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public void execute() throws ApiException { + testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /** + * Execute testGroupParameters request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /** + * Execute testGroupParameters request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return testGroupParametersAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + } + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @return APItestGroupParametersRequest + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public APItestGroupParametersRequest testGroupParameters(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group) { + return new APItestGroupParametersRequest(requiredStringGroup, requiredBooleanGroup, requiredInt64Group); + } + /** + * Build call for testInlineAdditionalProperties + * @param requestBody request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineAdditionalPropertiesCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/fake/inline-additionalProperties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testInlineAdditionalPropertiesValidateBeforeCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties(Async)"); + } + + return testInlineAdditionalPropertiesCall(requestBody, _callback); + + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testInlineAdditionalProperties(@javax.annotation.Nonnull Map requestBody) throws ApiException { + testInlineAdditionalPropertiesWithHttpInfo(requestBody); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { + okhttp3.Call localVarCall = testInlineAdditionalPropertiesValidateBeforeCall(requestBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test inline additionalProperties (asynchronously) + * + * @param requestBody request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineAdditionalPropertiesAsync(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testInlineAdditionalPropertiesValidateBeforeCall(requestBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testInlineFreeformAdditionalProperties + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineFreeformAdditionalPropertiesCall(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = testInlineFreeformAdditionalPropertiesRequest; + + // create path and map variables + String localVarPath = "/fake/inline-freeform-additionalProperties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testInlineFreeformAdditionalPropertiesValidateBeforeCall(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set + if (testInlineFreeformAdditionalPropertiesRequest == null) { + throw new ApiException("Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties(Async)"); + } + + return testInlineFreeformAdditionalPropertiesCall(testInlineFreeformAdditionalPropertiesRequest, _callback); + + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testInlineFreeformAdditionalProperties(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { + testInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest); + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testInlineFreeformAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { + okhttp3.Call localVarCall = testInlineFreeformAdditionalPropertiesValidateBeforeCall(testInlineFreeformAdditionalPropertiesRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test inline free-form additionalProperties (asynchronously) + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineFreeformAdditionalPropertiesAsync(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testInlineFreeformAdditionalPropertiesValidateBeforeCall(testInlineFreeformAdditionalPropertiesRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testJsonFormData + * @param param field1 (required) + * @param param2 field2 (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testJsonFormDataCall(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/jsonFormData"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testJsonFormDataValidateBeforeCall(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'param' is set + if (param == null) { + throw new ApiException("Missing the required parameter 'param' when calling testJsonFormData(Async)"); + } + + // verify the required parameter 'param2' is set + if (param2 == null) { + throw new ApiException("Missing the required parameter 'param2' when calling testJsonFormData(Async)"); + } + + return testJsonFormDataCall(param, param2, _callback); + + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testJsonFormData(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testJsonFormDataWithHttpInfo(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { + okhttp3.Call localVarCall = testJsonFormDataValidateBeforeCall(param, param2, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test json serialization of form data (asynchronously) + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testJsonFormDataAsync(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testJsonFormDataValidateBeforeCall(param, param2, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testNullableRequiredFieldsAnyOf + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testNullableRequiredFieldsAnyOfCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/nullable-required-fields-anyof"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testNullableRequiredFieldsAnyOfValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return testNullableRequiredFieldsAnyOfCall(_callback); + + } + + /** + * test anyOf with map of objects containing nullable required fields + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * @return NullableFieldsMapResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public NullableFieldsMapResponse testNullableRequiredFieldsAnyOf() throws ApiException { + ApiResponse localVarResp = testNullableRequiredFieldsAnyOfWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * test anyOf with map of objects containing nullable required fields + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * @return ApiResponse<NullableFieldsMapResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testNullableRequiredFieldsAnyOfWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = testNullableRequiredFieldsAnyOfValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * test anyOf with map of objects containing nullable required fields (asynchronously) + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testNullableRequiredFieldsAnyOfAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testNullableRequiredFieldsAnyOfValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryParameterCollectionFormat + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testQueryParameterCollectionFormatCall(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/test-query-parameters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pipe != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "pipe", pipe)); + } + + if (ioutil != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "ioutil", ioutil)); + } + + if (http != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("ssv", "http", http)); + } + + if (url != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "url", url)); + } + + if (context != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "context", context)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryParameterCollectionFormatValidateBeforeCall(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pipe' is set + if (pipe == null) { + throw new ApiException("Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) { + throw new ApiException("Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'http' is set + if (http == null) { + throw new ApiException("Missing the required parameter 'http' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'url' is set + if (url == null) { + throw new ApiException("Missing the required parameter 'url' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'context' is set + if (context == null) { + throw new ApiException("Missing the required parameter 'context' when calling testQueryParameterCollectionFormat(Async)"); + } + + return testQueryParameterCollectionFormatCall(pipe, ioutil, http, url, context, _callback); + + } + + /** + * + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testQueryParameterCollectionFormat(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testQueryParameterCollectionFormatAsync(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testStringMapReference + * @param requestBody request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testStringMapReferenceCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/fake/stringMap-reference"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testStringMapReferenceValidateBeforeCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling testStringMapReference(Async)"); + } + + return testStringMapReferenceCall(requestBody, _callback); + + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testStringMapReference(@javax.annotation.Nonnull Map requestBody) throws ApiException { + testStringMapReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testStringMapReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { + okhttp3.Call localVarCall = testStringMapReferenceValidateBeforeCall(requestBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test referenced string map (asynchronously) + * + * @param requestBody request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testStringMapReferenceAsync(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testStringMapReferenceValidateBeforeCall(requestBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java new file mode 100644 index 000000000000..54bc8b101ab2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,205 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import org.openapitools.client.model.Client; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeClassnameTags123Api { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for testClassname + * @param client client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = client; + + // create path and map variables + String localVarPath = "/fake_classname_test"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key_query" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClassnameValidateBeforeCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException("Missing the required parameter 'client' when calling testClassname(Async)"); + } + + return testClassnameCall(client, _callback); + + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClassname(@javax.annotation.Nonnull Client client) throws ApiException { + ApiResponse localVarResp = testClassnameWithHttpInfo(client); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClassnameWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { + okhttp3.Call localVarCall = testClassnameValidateBeforeCall(client, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test class name in snake case (asynchronously) + * To test class name in snake case + * @param client client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameAsync(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testClassnameValidateBeforeCall(client, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..79a1c958665c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1329 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PetApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addPet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call addPetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addPetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling addPet(Async)"); + } + + return addPetCall(pet, _callback); + + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void addPet(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Add a new pet to the store (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call addPetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deletePet + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePetValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); + } + + return deletePetCall(petId, apiKey, _callback); + + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deletes a pet (asynchronously) + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for findPetsByStatus + * @param status Status values that need to be considered for filter (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "status", status)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByStatusValidateBeforeCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + + return findPetsByStatusCall(status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + ApiResponse> localVarResp = findPetsByStatusWithHttpInfo(status); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null); + + Type localVarReturnType = new TypeReference>(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by status (asynchronously) + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusAsync(@javax.annotation.Nonnull List status, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback); + Type localVarReturnType = new TypeReference>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for findPetsByTags + * @param tags Tags to filter by (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByTagsValidateBeforeCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); + } + + return findPetsByTagsCall(tags, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { + ApiResponse> localVarResp = findPetsByTagsWithHttpInfo(tags); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null); + + Type localVarReturnType = new TypeReference>(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by tags (asynchronously) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsAsync(@javax.annotation.Nonnull List tags, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback); + Type localVarReturnType = new TypeReference>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPetById + * @param petId ID of pet to return (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + return getPetByIdCall(petId, _callback); + + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + ApiResponse localVarResp = getPetByIdWithHttpInfo(petId); + return localVarResp.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find pet by ID (asynchronously) + * Returns a single pet + * @param petId ID of pet to return (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdAsync(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling updatePet(Async)"); + } + + return updatePetCall(pet, _callback); + + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public void updatePet(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update an existing pet (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updatePetWithForm + * @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) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetWithFormValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); + } + + return updatePetWithFormCall(petId, name, status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updates a pet in the store with form data (asynchronously) + * + * @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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for uploadFile + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (contentType != null) { + localVarHeaderParams.put("Content-Type", localVarApiClient.parameterToString(contentType)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); + } + + return uploadFileCall(petId, contentType, additionalMetadata, _file, _callback); + + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = uploadFileWithHttpInfo(petId, contentType, additionalMetadata, _file); + return localVarResp.getData(); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, contentType, additionalMetadata, _file, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (asynchronously) + * + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, contentType, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for uploadFileWithRequiredFile + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileWithRequiredFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFileWithRequiredFile(Async)"); + } + + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) { + throw new ApiException("Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile(Async)"); + } + + return uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + ApiResponse localVarResp = uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (required) (asynchronously) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..4a91dd4e1836 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,593 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import org.openapitools.client.model.Order; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class StoreApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteOrder + * @param orderId ID of the order that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replace("{" + "order_id" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOrderValidateBeforeCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); + } + + return deleteOrderCall(orderId, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete purchase order by ID (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderAsync(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getInventory + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getInventoryCall(_callback); + + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Map getInventory() throws ApiException { + ApiResponse> localVarResp = getInventoryWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference>(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Returns pet inventories by status (asynchronously) + * Returns a map of status codes to quantities + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderById + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replace("{" + "order_id" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderByIdValidateBeforeCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); + } + + return getOrderByIdCall(orderId, _callback); + + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + ApiResponse localVarResp = getOrderByIdWithHttpInfo(orderId); + return localVarResp.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find purchase order by ID (asynchronously) + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdAsync(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for placeOrder + * @param order order placed for purchasing the pet (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = order; + + // create path and map variables + String localVarPath = "/store/order"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException("Missing the required parameter 'order' when calling placeOrder(Async)"); + } + + return placeOrderCall(order, _callback); + + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { + ApiResponse localVarResp = placeOrderWithHttpInfo(order); + return localVarResp.getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Place an order for a pet (asynchronously) + * + * @param order order placed for purchasing the pet (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderAsync(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..6473b33d6cbb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,1105 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UserApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createUser + * @param user Created user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUserValidateBeforeCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUser(Async)"); + } + + return createUserCall(user, _callback); + + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create user (asynchronously) + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserAsync(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithArrayInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithArrayInput(Async)"); + } + + return createUsersWithArrayInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithListInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithList"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithListInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithListInput(Async)"); + } + + return createUsersWithListInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteUser + * @param username The name that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteUserValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); + } + + return deleteUserCall(username, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete user (asynchronously) + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getUserByName + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByNameValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); + } + + return getUserByNameCall(username, _callback); + + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + ApiResponse localVarResp = getUserByNameWithHttpInfo(username); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get user by user name (asynchronously) + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for loginUser + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
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 okhttp3.Call loginUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (username != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); + } + + if (password != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("password", password)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call loginUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); + } + + return loginUserCall(username, password, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + ApiResponse localVarResp = loginUserWithHttpInfo(username, password); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Logs user into the system (asynchronously) + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
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 okhttp3.Call loginUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for logoutUser + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return logoutUserCall(_callback); + + } + + /** + * Logs out current logged in user session + * + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Logs out current logged in user session (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateUser + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling updateUser(Async)"); + } + + return updateUserCall(username, user, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updated user (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/ValuesApi.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/ValuesApi.java new file mode 100644 index 000000000000..530178058a12 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/api/ValuesApi.java @@ -0,0 +1,199 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import org.openapitools.client.model.Variable; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ValuesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ValuesApi() { + this(Configuration.getDefaultApiClient()); + } + + public ValuesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getSomeValues + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public okhttp3.Call getSomeValuesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/values"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSomeValuesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getSomeValuesCall(_callback); + + } + + /** + * Get some primitive variable values + * + * @return Variable + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public Variable getSomeValues() throws ApiException { + ApiResponse localVarResp = getSomeValuesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get some primitive variable values + * + * @return ApiResponse<Variable> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public ApiResponse getSomeValuesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getSomeValuesValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get some primitive variable values (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public okhttp3.Call getSomeValuesAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSomeValuesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..ed5f5fbc16ef --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..bd5e463d0b42 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..f655936f3a78 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..5aff174aff81 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..6f945f45ed46 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,43 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..59009502c11e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * 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; + +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..cefbf4af907b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * 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 okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..5521ee31599c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * 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.ApiException; +import org.openapitools.client.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..1ec47bee4310 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,144 @@ +/* + * 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 com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..66b4cf7a5a8b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,435 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("AdditionalPropertiesClass") +public class AdditionalPropertiesClass { + public static final String JSON_PROPERTY_MAP_PROPERTY = "map_property"; + @JsonProperty(JSON_PROPERTY_MAP_PROPERTY) + @javax.annotation.Nullable + private Map mapProperty = new HashMap<>(); + + public static final String JSON_PROPERTY_MAP_OF_MAP_PROPERTY = "map_of_map_property"; + @JsonProperty(JSON_PROPERTY_MAP_OF_MAP_PROPERTY) + @javax.annotation.Nullable + private Map> mapOfMapProperty = new HashMap<>(); + + public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1"; + @JsonProperty(JSON_PROPERTY_ANYTYPE1) + @javax.annotation.Nullable + private Object anytype1 = null; + + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1 = "map_with_undeclared_properties_anytype_1"; + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1) + @javax.annotation.Nullable + private Object mapWithUndeclaredPropertiesAnytype1; + + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2 = "map_with_undeclared_properties_anytype_2"; + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2) + @javax.annotation.Nullable + private Object mapWithUndeclaredPropertiesAnytype2; + + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3 = "map_with_undeclared_properties_anytype_3"; + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3) + @javax.annotation.Nullable + private Map mapWithUndeclaredPropertiesAnytype3 = new HashMap<>(); + + public static final String JSON_PROPERTY_EMPTY_MAP = "empty_map"; + @JsonProperty(JSON_PROPERTY_EMPTY_MAP) + @javax.annotation.Nullable + private Object emptyMap; + + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING = "map_with_undeclared_properties_string"; + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING) + @javax.annotation.Nullable + private Map mapWithUndeclaredPropertiesString = new HashMap<>(); + + public AdditionalPropertiesClass() { + } + + public AdditionalPropertiesClass mapProperty(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapProperty() { + return mapProperty; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapProperty(@javax.annotation.Nullable Map mapProperty) { + this.mapProperty = mapProperty; + } + + + public AdditionalPropertiesClass mapOfMapProperty(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP_OF_MAP_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_OF_MAP_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapOfMapProperty(@javax.annotation.Nullable Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + public AdditionalPropertiesClass anytype1(@javax.annotation.Nullable Object anytype1) { + this.anytype1 = anytype1; + return this; + } + + /** + * Get anytype1 + * @return anytype1 + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ANYTYPE1, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getAnytype1() { + return anytype1; + } + + @JsonProperty(value = JSON_PROPERTY_ANYTYPE1, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAnytype1(@javax.annotation.Nullable Object anytype1) { + this.anytype1 = anytype1; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype1(@javax.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype1) { + this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; + return this; + } + + /** + * Get mapWithUndeclaredPropertiesAnytype1 + * @return mapWithUndeclaredPropertiesAnytype1 + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getMapWithUndeclaredPropertiesAnytype1() { + return mapWithUndeclaredPropertiesAnytype1; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapWithUndeclaredPropertiesAnytype1(@javax.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype1) { + this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype2(@javax.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype2) { + this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; + return this; + } + + /** + * Get mapWithUndeclaredPropertiesAnytype2 + * @return mapWithUndeclaredPropertiesAnytype2 + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getMapWithUndeclaredPropertiesAnytype2() { + return mapWithUndeclaredPropertiesAnytype2; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapWithUndeclaredPropertiesAnytype2(@javax.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype2) { + this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype3(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapWithUndeclaredPropertiesAnytype3() { + return mapWithUndeclaredPropertiesAnytype3; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public void setMapWithUndeclaredPropertiesAnytype3(@javax.annotation.Nullable Map mapWithUndeclaredPropertiesAnytype3) { + this.mapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; + } + + + public AdditionalPropertiesClass emptyMap(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_EMPTY_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getEmptyMap() { + return emptyMap; + } + + @JsonProperty(value = JSON_PROPERTY_EMPTY_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmptyMap(@javax.annotation.Nullable Object emptyMap) { + this.emptyMap = emptyMap; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesString(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapWithUndeclaredPropertiesString() { + return mapWithUndeclaredPropertiesString; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapWithUndeclaredPropertiesString(@javax.annotation.Nullable Map mapWithUndeclaredPropertiesString) { + this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesClass instance itself + */ + public AdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("map_property", "map_of_map_property", "anytype_1", "map_with_undeclared_properties_anytype_1", "map_with_undeclared_properties_anytype_2", "map_with_undeclared_properties_anytype_3", "empty_map", "map_with_undeclared_properties_string")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java new file mode 100644 index 000000000000..4311c60ce2e5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java @@ -0,0 +1,264 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributes; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfModelArrayAnyOf + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AllOfModelArrayAnyOf.JSON_PROPERTY_ID, + AllOfModelArrayAnyOf.JSON_PROPERTY_NAME, + AllOfModelArrayAnyOf.JSON_PROPERTY_LINK_LIST_COLUMN1, + AllOfModelArrayAnyOf.JSON_PROPERTY_ATTRIBUTES +}) +@JsonTypeName("AllOfModelArrayAnyOf") +public class AllOfModelArrayAnyOf { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name = "default-name"; + + public static final String JSON_PROPERTY_LINK_LIST_COLUMN1 = "linkListColumn1"; + @JsonProperty(JSON_PROPERTY_LINK_LIST_COLUMN1) + @javax.annotation.Nullable + private AllOfModelArrayAnyOfAllOfLinkListColumn1 linkListColumn1; + + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @javax.annotation.Nullable + private AllOfModelArrayAnyOfAllOfAttributes attributes; + + public AllOfModelArrayAnyOf() { + } + + public AllOfModelArrayAnyOf id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public AllOfModelArrayAnyOf name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public AllOfModelArrayAnyOf linkListColumn1(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfLinkListColumn1 linkListColumn1) { + this.linkListColumn1 = linkListColumn1; + return this; + } + + /** + * Get linkListColumn1 + * @return linkListColumn1 + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_LINK_LIST_COLUMN1, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AllOfModelArrayAnyOfAllOfLinkListColumn1 getLinkListColumn1() { + return linkListColumn1; + } + + @JsonProperty(value = JSON_PROPERTY_LINK_LIST_COLUMN1, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLinkListColumn1(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfLinkListColumn1 linkListColumn1) { + this.linkListColumn1 = linkListColumn1; + } + + + public AllOfModelArrayAnyOf attributes(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ATTRIBUTES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AllOfModelArrayAnyOfAllOfAttributes getAttributes() { + return attributes; + } + + @JsonProperty(value = JSON_PROPERTY_ATTRIBUTES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAttributes(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributes attributes) { + this.attributes = attributes; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfModelArrayAnyOf instance itself + */ + public AllOfModelArrayAnyOf putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfModelArrayAnyOf {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" linkListColumn1: ").append(toIndentedString(linkListColumn1)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name", "linkListColumn1", "attributes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java new file mode 100644 index 000000000000..627ce13f13ce --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java @@ -0,0 +1,170 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributesC; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfModelArrayAnyOfAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AllOfModelArrayAnyOfAllOfAttributes.JSON_PROPERTY_C +}) +@JsonTypeName("AllOfModelArrayAnyOf_allOf_attributes") +public class AllOfModelArrayAnyOfAllOfAttributes { + public static final String JSON_PROPERTY_C = "C"; + @JsonProperty(JSON_PROPERTY_C) + @javax.annotation.Nullable + private AllOfModelArrayAnyOfAllOfAttributesC C; + + public AllOfModelArrayAnyOfAllOfAttributes() { + } + + public AllOfModelArrayAnyOfAllOfAttributes C(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributesC C) { + this.C = C; + return this; + } + + /** + * Get C + * @return C + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_C, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AllOfModelArrayAnyOfAllOfAttributesC getC() { + return C; + } + + @JsonProperty(value = JSON_PROPERTY_C, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setC(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributesC C) { + this.C = C; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfModelArrayAnyOfAllOfAttributes instance itself + */ + public AllOfModelArrayAnyOfAllOfAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfModelArrayAnyOfAllOfAttributes {\n"); + sb.append(" C: ").append(toIndentedString(C)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("C")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java new file mode 100644 index 000000000000..a5c5ad165d97 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Order; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.Tag; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = AllOfModelArrayAnyOfAllOfAttributesC.AllOfModelArrayAnyOfAllOfAttributesCDeserializer.class) +@JsonSerialize(using = AllOfModelArrayAnyOfAllOfAttributesC.AllOfModelArrayAnyOfAllOfAttributesCSerializer.class) +public class AllOfModelArrayAnyOfAllOfAttributesC extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AllOfModelArrayAnyOfAllOfAttributesC.class.getName()); + + + public static class AllOfModelArrayAnyOfAllOfAttributesCSerializer extends StdSerializer { + public AllOfModelArrayAnyOfAllOfAttributesCSerializer(Class t) { + super(t); + } + + public AllOfModelArrayAnyOfAllOfAttributesCSerializer() { + this(null); + } + + @Override + public void serialize(AllOfModelArrayAnyOfAllOfAttributesC value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class AllOfModelArrayAnyOfAllOfAttributesCDeserializer extends StdDeserializer { + public AllOfModelArrayAnyOfAllOfAttributesCDeserializer() { + this(AllOfModelArrayAnyOfAllOfAttributesC.class); + } + + public AllOfModelArrayAnyOfAllOfAttributesCDeserializer(Class vc) { + super(vc); + } + + @Override + public AllOfModelArrayAnyOfAllOfAttributesC deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Order + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Order.class.equals(Integer.class) || Order.class.equals(Long.class) || Order.class.equals(Float.class) || Order.class.equals(Double.class) || Order.class.equals(Boolean.class) || Order.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Order.class.equals(Integer.class) || Order.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Order.class.equals(Float.class) || Order.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Order.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Order.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Order.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Order'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Order'", e); + } + + // deserialize Pet + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Pet.class.equals(Integer.class) || Pet.class.equals(Long.class) || Pet.class.equals(Float.class) || Pet.class.equals(Double.class) || Pet.class.equals(Boolean.class) || Pet.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Pet.class.equals(Integer.class) || Pet.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Pet.class.equals(Float.class) || Pet.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Pet.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Pet.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Pet.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Pet'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Pet'", e); + } + + if (match == 1) { + AllOfModelArrayAnyOfAllOfAttributesC ret = new AllOfModelArrayAnyOfAllOfAttributesC(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for AllOfModelArrayAnyOfAllOfAttributesC: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public AllOfModelArrayAnyOfAllOfAttributesC getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "AllOfModelArrayAnyOfAllOfAttributesC cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public AllOfModelArrayAnyOfAllOfAttributesC() { + super("oneOf", Boolean.FALSE); + } + + public AllOfModelArrayAnyOfAllOfAttributesC(Order o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public AllOfModelArrayAnyOfAllOfAttributesC(Pet o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Order", Order.class); + schemas.put("Pet", Pet.class); + JSON.registerDescendants(AllOfModelArrayAnyOfAllOfAttributesC.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return AllOfModelArrayAnyOfAllOfAttributesC.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Order, Pet + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Order.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Pet.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Order, Pet"); + } + + /** + * Get the actual instance, which can be the following: + * Order, Pet + * + * @return The actual instance (Order, Pet) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Order`. If the actual instance is not `Order`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Order` + * @throws ClassCastException if the instance is not `Order` + */ + public Order getOrder() throws ClassCastException { + return (Order)super.getActualInstance(); + } + + /** + * Get the actual instance of `Pet`. If the actual instance is not `Pet`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Pet` + * @throws ClassCastException if the instance is not `Pet` + */ + public Pet getPet() throws ClassCastException { + return (Pet)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java new file mode 100644 index 000000000000..817d6ac39847 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java @@ -0,0 +1,181 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1Value; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AllOfModelArrayAnyOfAllOfLinkListColumn1.JSON_PROPERTY_VALUE +}) +@JsonTypeName("AllOfModelArrayAnyOf_allOf_linkListColumn1") +public class AllOfModelArrayAnyOfAllOfLinkListColumn1 { + public static final String JSON_PROPERTY_VALUE = "value"; + @JsonProperty(JSON_PROPERTY_VALUE) + @javax.annotation.Nonnull + private List value = new ArrayList<>(); + + public AllOfModelArrayAnyOfAllOfLinkListColumn1() { + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1 value(@javax.annotation.Nonnull List value) { + this.value = value; + return this; + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1 addValueItem(AllOfModelArrayAnyOfAllOfLinkListColumn1Value valueItem) { + if (this.value == null) { + this.value = new ArrayList<>(); + } + this.value.add(valueItem); + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getValue() { + return value; + } + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@javax.annotation.Nonnull List value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfModelArrayAnyOfAllOfLinkListColumn1 instance itself + */ + public AllOfModelArrayAnyOfAllOfLinkListColumn1 putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfModelArrayAnyOfAllOfLinkListColumn1 {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("value")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java new file mode 100644 index 000000000000..914754b642d1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java @@ -0,0 +1,217 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Tag; +import org.openapitools.client.model.User; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = AllOfModelArrayAnyOfAllOfLinkListColumn1Value.AllOfModelArrayAnyOfAllOfLinkListColumn1ValueDeserializer.class) +@JsonSerialize(using = AllOfModelArrayAnyOfAllOfLinkListColumn1Value.AllOfModelArrayAnyOfAllOfLinkListColumn1ValueSerializer.class) +public class AllOfModelArrayAnyOfAllOfLinkListColumn1Value extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AllOfModelArrayAnyOfAllOfLinkListColumn1Value.class.getName()); + + + public static class AllOfModelArrayAnyOfAllOfLinkListColumn1ValueSerializer extends StdSerializer { + public AllOfModelArrayAnyOfAllOfLinkListColumn1ValueSerializer(Class t) { + super(t); + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1ValueSerializer() { + this(null); + } + + @Override + public void serialize(AllOfModelArrayAnyOfAllOfLinkListColumn1Value value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class AllOfModelArrayAnyOfAllOfLinkListColumn1ValueDeserializer extends StdDeserializer { + public AllOfModelArrayAnyOfAllOfLinkListColumn1ValueDeserializer() { + this(AllOfModelArrayAnyOfAllOfLinkListColumn1Value.class); + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1ValueDeserializer(Class vc) { + super(vc); + } + + @Override + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + // deserialize Tag + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Tag.class); + AllOfModelArrayAnyOfAllOfLinkListColumn1Value ret = new AllOfModelArrayAnyOfAllOfLinkListColumn1Value(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Tag'", e); + } + + // deserialize User + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(User.class); + AllOfModelArrayAnyOfAllOfLinkListColumn1Value ret = new AllOfModelArrayAnyOfAllOfLinkListColumn1Value(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'User'", e); + } + + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for AllOfModelArrayAnyOfAllOfLinkListColumn1Value: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "AllOfModelArrayAnyOfAllOfLinkListColumn1Value cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value() { + super("anyOf", Boolean.FALSE); + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(Tag o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(User o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Tag", Tag.class); + schemas.put("User", User.class); + JSON.registerDescendants(AllOfModelArrayAnyOfAllOfLinkListColumn1Value.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return AllOfModelArrayAnyOfAllOfLinkListColumn1Value.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Tag, User + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Tag.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(User.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Tag, User"); + } + + /** + * Get the actual instance, which can be the following: + * Tag, User + * + * @return The actual instance (Tag, User) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Tag`. If the actual instance is not `Tag`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Tag` + * @throws ClassCastException if the instance is not `Tag` + */ + public Tag getTag() throws ClassCastException { + return (Tag)super.getActualInstance(); + } + + /** + * Get the actual instance of `User`. If the actual instance is not `User`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `User` + * @throws ClassCastException if the instance is not `User` + */ + public User getUser() throws ClassCastException { + return (User)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java new file mode 100644 index 000000000000..655538e37aeb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to double + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AllOfRefToDouble.JSON_PROPERTY_HEIGHT +}) +@JsonTypeName("AllOfRefToDouble") +public class AllOfRefToDouble { + public static final String JSON_PROPERTY_HEIGHT = "height"; + @JsonProperty(JSON_PROPERTY_HEIGHT) + @javax.annotation.Nullable + private Double height = 32.1d; + + public AllOfRefToDouble() { + } + + public AllOfRefToDouble height(@javax.annotation.Nullable Double height) { + this.height = height; + return this; + } + + /** + * Height as double + * @return height + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_HEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Double getHeight() { + return height; + } + + @JsonProperty(value = JSON_PROPERTY_HEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHeight(@javax.annotation.Nullable Double height) { + this.height = height; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToDouble instance itself + */ + public AllOfRefToDouble putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToDouble {\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("height")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java new file mode 100644 index 000000000000..945e824a80ca --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to float + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AllOfRefToFloat.JSON_PROPERTY_WEIGHT +}) +@JsonTypeName("AllOfRefToFloat") +public class AllOfRefToFloat { + public static final String JSON_PROPERTY_WEIGHT = "weight"; + @JsonProperty(JSON_PROPERTY_WEIGHT) + @javax.annotation.Nullable + private Float weight = 7.89f; + + public AllOfRefToFloat() { + } + + public AllOfRefToFloat weight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + return this; + } + + /** + * Weight as float + * @return weight + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_WEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Float getWeight() { + return weight; + } + + @JsonProperty(value = JSON_PROPERTY_WEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWeight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToFloat instance itself + */ + public AllOfRefToFloat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToFloat {\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("weight")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToLong.java new file mode 100644 index 000000000000..cea0e86f9aeb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to long + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AllOfRefToLong.JSON_PROPERTY_ID +}) +@JsonTypeName("AllOfRefToLong") +public class AllOfRefToLong { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id = 10l; + + public AllOfRefToLong() { + } + + public AllOfRefToLong id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Id as long + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToLong instance itself + */ + public AllOfRefToLong putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToLong {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 000000000000..afd67c54d3d9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Animal.java @@ -0,0 +1,214 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Animal + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the className to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = Dog.class, name = "Dog"), +}) + +@JsonPropertyOrder({ + Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_COLOR +}) +@JsonTypeName("Animal") +public class Animal { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @javax.annotation.Nonnull + protected String className; + + public static final String JSON_PROPERTY_COLOR = "color"; + @JsonProperty(JSON_PROPERTY_COLOR) + @javax.annotation.Nullable + private String color = "red"; + + public Animal() { + this.className = this.getClass().getSimpleName(); + } + + public Animal className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + + public Animal color(@javax.annotation.Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getColor() { + return color; + } + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setColor(@javax.annotation.Nullable String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Animal instance itself + */ + public Animal putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Apple.java new file mode 100644 index 000000000000..63a133309e83 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Apple.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Apple + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Apple.JSON_PROPERTY_CULTIVAR, + Apple.JSON_PROPERTY_ORIGIN +}) +@JsonTypeName("apple") +public class Apple { + public static final String JSON_PROPERTY_CULTIVAR = "cultivar"; + @JsonProperty(JSON_PROPERTY_CULTIVAR) + @javax.annotation.Nullable + private String cultivar; + + public static final String JSON_PROPERTY_ORIGIN = "origin"; + @JsonProperty(JSON_PROPERTY_ORIGIN) + @javax.annotation.Nullable + private String origin; + + public Apple() { + } + + public Apple cultivar(@javax.annotation.Nullable String cultivar) { + this.cultivar = cultivar; + return this; + } + + /** + * Get cultivar + * @return cultivar + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CULTIVAR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCultivar() { + return cultivar; + } + + @JsonProperty(value = JSON_PROPERTY_CULTIVAR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCultivar(@javax.annotation.Nullable String cultivar) { + this.cultivar = cultivar; + } + + + public Apple origin(@javax.annotation.Nullable String origin) { + this.origin = origin; + return this; + } + + /** + * Get origin + * @return origin + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ORIGIN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getOrigin() { + return origin; + } + + @JsonProperty(value = JSON_PROPERTY_ORIGIN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOrigin(@javax.annotation.Nullable String origin) { + this.origin = origin; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Apple instance itself + */ + public Apple putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("cultivar", "origin")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AppleReq.java new file mode 100644 index 000000000000..a4f68e5be9fe --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AppleReq.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AppleReq + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AppleReq.JSON_PROPERTY_CULTIVAR, + AppleReq.JSON_PROPERTY_MEALY +}) +@JsonTypeName("appleReq") +public class AppleReq { + public static final String JSON_PROPERTY_CULTIVAR = "cultivar"; + @JsonProperty(JSON_PROPERTY_CULTIVAR) + @javax.annotation.Nonnull + private String cultivar; + + public static final String JSON_PROPERTY_MEALY = "mealy"; + @JsonProperty(JSON_PROPERTY_MEALY) + @javax.annotation.Nullable + private Boolean mealy; + + public AppleReq() { + } + + public AppleReq cultivar(@javax.annotation.Nonnull String cultivar) { + this.cultivar = cultivar; + return this; + } + + /** + * Get cultivar + * @return cultivar + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CULTIVAR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getCultivar() { + return cultivar; + } + + @JsonProperty(value = JSON_PROPERTY_CULTIVAR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCultivar(@javax.annotation.Nonnull String cultivar) { + this.cultivar = cultivar; + } + + + public AppleReq mealy(@javax.annotation.Nullable Boolean mealy) { + this.mealy = mealy; + return this; + } + + /** + * Get mealy + * @return mealy + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MEALY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMealy() { + return mealy; + } + + @JsonProperty(value = JSON_PROPERTY_MEALY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMealy(@javax.annotation.Nullable Boolean mealy) { + this.mealy = mealy; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AppleReq instance itself + */ + public AppleReq putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("cultivar", "mealy")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("cultivar")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayAnyOf.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayAnyOf.java new file mode 100644 index 000000000000..bdc32afca0fc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayAnyOf.java @@ -0,0 +1,207 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = ArrayAnyOf.ArrayAnyOfDeserializer.class) +@JsonSerialize(using = ArrayAnyOf.ArrayAnyOfSerializer.class) +public class ArrayAnyOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ArrayAnyOf.class.getName()); + + + public static class ArrayAnyOfSerializer extends StdSerializer { + public ArrayAnyOfSerializer(Class t) { + super(t); + } + + public ArrayAnyOfSerializer() { + this(null); + } + + @Override + public void serialize(ArrayAnyOf value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ArrayAnyOfDeserializer extends StdDeserializer { + public ArrayAnyOfDeserializer() { + this(ArrayAnyOf.class); + } + + public ArrayAnyOfDeserializer(Class vc) { + super(vc); + } + + @Override + public ArrayAnyOf deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + // deserialize Integer + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Integer.class); + ArrayAnyOf ret = new ArrayAnyOf(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + // deserialize List + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(List.class); + ArrayAnyOf ret = new ArrayAnyOf(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for ArrayAnyOf: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public ArrayAnyOf getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "ArrayAnyOf cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public ArrayAnyOf() { + super("anyOf", Boolean.FALSE); + } + + public ArrayAnyOf(Integer o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ArrayAnyOf(List o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("List", List.class); + JSON.registerDescendants(ArrayAnyOf.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return ArrayAnyOf.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Integer, List + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, List"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, List + * + * @return The actual instance (Integer, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayDefault.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayDefault.java new file mode 100644 index 000000000000..cbeb53bbebb8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayDefault.java @@ -0,0 +1,219 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayDefault + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ArrayDefault.JSON_PROPERTY_WITH_DEFAULT_EMPTY_BRACKET, + ArrayDefault.JSON_PROPERTY_WITHOUT_DEFAULT +}) +@JsonTypeName("ArrayDefault") +public class ArrayDefault { + public static final String JSON_PROPERTY_WITH_DEFAULT_EMPTY_BRACKET = "WithDefaultEmptyBracket"; + @JsonProperty(JSON_PROPERTY_WITH_DEFAULT_EMPTY_BRACKET) + @javax.annotation.Nullable + private List withDefaultEmptyBracket = new ArrayList<>(); + + public static final String JSON_PROPERTY_WITHOUT_DEFAULT = "WithoutDefault"; + @JsonProperty(JSON_PROPERTY_WITHOUT_DEFAULT) + @javax.annotation.Nullable + private List withoutDefault = new ArrayList<>(); + + public ArrayDefault() { + } + + public ArrayDefault withDefaultEmptyBracket(@javax.annotation.Nullable List withDefaultEmptyBracket) { + this.withDefaultEmptyBracket = withDefaultEmptyBracket; + return this; + } + + public ArrayDefault addWithDefaultEmptyBracketItem(String withDefaultEmptyBracketItem) { + if (this.withDefaultEmptyBracket == null) { + this.withDefaultEmptyBracket = new ArrayList<>(); + } + this.withDefaultEmptyBracket.add(withDefaultEmptyBracketItem); + return this; + } + + /** + * Get withDefaultEmptyBracket + * @return withDefaultEmptyBracket + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_WITH_DEFAULT_EMPTY_BRACKET, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getWithDefaultEmptyBracket() { + return withDefaultEmptyBracket; + } + + @JsonProperty(value = JSON_PROPERTY_WITH_DEFAULT_EMPTY_BRACKET, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWithDefaultEmptyBracket(@javax.annotation.Nullable List withDefaultEmptyBracket) { + this.withDefaultEmptyBracket = withDefaultEmptyBracket; + } + + + public ArrayDefault withoutDefault(@javax.annotation.Nullable List withoutDefault) { + this.withoutDefault = withoutDefault; + return this; + } + + public ArrayDefault addWithoutDefaultItem(String withoutDefaultItem) { + if (this.withoutDefault == null) { + this.withoutDefault = new ArrayList<>(); + } + this.withoutDefault.add(withoutDefaultItem); + return this; + } + + /** + * Get withoutDefault + * @return withoutDefault + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_WITHOUT_DEFAULT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getWithoutDefault() { + return withoutDefault; + } + + @JsonProperty(value = JSON_PROPERTY_WITHOUT_DEFAULT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWithoutDefault(@javax.annotation.Nullable List withoutDefault) { + this.withoutDefault = withoutDefault; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayDefault instance itself + */ + public ArrayDefault putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayDefault {\n"); + sb.append(" withDefaultEmptyBracket: ").append(toIndentedString(withDefaultEmptyBracket)).append("\n"); + sb.append(" withoutDefault: ").append(toIndentedString(withoutDefault)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("WithDefaultEmptyBracket", "WithoutDefault")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..55d8df1f17eb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,181 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfArrayOfNumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER +}) +@JsonTypeName("ArrayOfArrayOfNumberOnly") +public class ArrayOfArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) + @javax.annotation.Nullable + private List> arrayArrayNumber = new ArrayList<>(); + + public ArrayOfArrayOfNumberOnly() { + } + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayArrayNumber(@javax.annotation.Nullable List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfArrayOfNumberOnly instance itself + */ + public ArrayOfArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ArrayArrayNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java new file mode 100644 index 000000000000..aa9ca2954b56 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java @@ -0,0 +1,243 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ArrayOfInlineAllOfArrayAllofDogPropertyInner; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfInlineAllOf + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ArrayOfInlineAllOf.JSON_PROPERTY_ID, + ArrayOfInlineAllOf.JSON_PROPERTY_NAME, + ArrayOfInlineAllOf.JSON_PROPERTY_ARRAY_ALLOF_DOG_PROPERTY +}) +@JsonTypeName("ArrayOfInlineAllOf") +public class ArrayOfInlineAllOf { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_ARRAY_ALLOF_DOG_PROPERTY = "array_allof_dog_property"; + @JsonProperty(JSON_PROPERTY_ARRAY_ALLOF_DOG_PROPERTY) + @javax.annotation.Nullable + private List arrayAllofDogProperty = new ArrayList<>(); + + public ArrayOfInlineAllOf() { + } + + public ArrayOfInlineAllOf id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public ArrayOfInlineAllOf name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public ArrayOfInlineAllOf arrayAllofDogProperty(@javax.annotation.Nullable List arrayAllofDogProperty) { + this.arrayAllofDogProperty = arrayAllofDogProperty; + return this; + } + + public ArrayOfInlineAllOf addArrayAllofDogPropertyItem(ArrayOfInlineAllOfArrayAllofDogPropertyInner arrayAllofDogPropertyItem) { + if (this.arrayAllofDogProperty == null) { + this.arrayAllofDogProperty = new ArrayList<>(); + } + this.arrayAllofDogProperty.add(arrayAllofDogPropertyItem); + return this; + } + + /** + * Get arrayAllofDogProperty + * @return arrayAllofDogProperty + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ARRAY_ALLOF_DOG_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayAllofDogProperty() { + return arrayAllofDogProperty; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ALLOF_DOG_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayAllofDogProperty(@javax.annotation.Nullable List arrayAllofDogProperty) { + this.arrayAllofDogProperty = arrayAllofDogProperty; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfInlineAllOf instance itself + */ + public ArrayOfInlineAllOf putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfInlineAllOf {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" arrayAllofDogProperty: ").append(toIndentedString(arrayAllofDogProperty)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name", "array_allof_dog_property")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java new file mode 100644 index 000000000000..8b28de960822 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ArrayOfInlineAllOfArrayAllofDogPropertyInner.JSON_PROPERTY_BREED, + ArrayOfInlineAllOfArrayAllofDogPropertyInner.JSON_PROPERTY_COLOR +}) +@JsonTypeName("ArrayOfInlineAllOf_array_allof_dog_property_inner") +public class ArrayOfInlineAllOfArrayAllofDogPropertyInner { + public static final String JSON_PROPERTY_BREED = "breed"; + @JsonProperty(JSON_PROPERTY_BREED) + @javax.annotation.Nullable + private String breed; + + public static final String JSON_PROPERTY_COLOR = "color"; + @JsonProperty(JSON_PROPERTY_COLOR) + @javax.annotation.Nullable + private String color; + + public ArrayOfInlineAllOfArrayAllofDogPropertyInner() { + } + + public ArrayOfInlineAllOfArrayAllofDogPropertyInner breed(@javax.annotation.Nullable String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BREED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBreed() { + return breed; + } + + @JsonProperty(value = JSON_PROPERTY_BREED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBreed(@javax.annotation.Nullable String breed) { + this.breed = breed; + } + + + public ArrayOfInlineAllOfArrayAllofDogPropertyInner color(@javax.annotation.Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getColor() { + return color; + } + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setColor(@javax.annotation.Nullable String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfInlineAllOfArrayAllofDogPropertyInner instance itself + */ + public ArrayOfInlineAllOfArrayAllofDogPropertyInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfInlineAllOfArrayAllofDogPropertyInner {\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("breed", "color")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..7fb4614023ff --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -0,0 +1,181 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfNumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER +}) +@JsonTypeName("ArrayOfNumberOnly") +public class ArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber"; + @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) + @javax.annotation.Nullable + private List arrayNumber = new ArrayList<>(); + + public ArrayOfNumberOnly() { + } + + public ArrayOfNumberOnly arrayNumber(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayNumber() { + return arrayNumber; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayNumber(@javax.annotation.Nullable List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfNumberOnly instance itself + */ + public ArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ArrayNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOneOf.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOneOf.java new file mode 100644 index 000000000000..454e3fd5f59d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOneOf.java @@ -0,0 +1,245 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = ArrayOneOf.ArrayOneOfDeserializer.class) +@JsonSerialize(using = ArrayOneOf.ArrayOneOfSerializer.class) +public class ArrayOneOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ArrayOneOf.class.getName()); + + + public static class ArrayOneOfSerializer extends StdSerializer { + public ArrayOneOfSerializer(Class t) { + super(t); + } + + public ArrayOneOfSerializer() { + this(null); + } + + @Override + public void serialize(ArrayOneOf value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ArrayOneOfDeserializer extends StdDeserializer { + public ArrayOneOfDeserializer() { + this(ArrayOneOf.class); + } + + public ArrayOneOfDeserializer(Class vc) { + super(vc); + } + + @Override + public ArrayOneOf deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Integer + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Integer.class.equals(Integer.class) || Integer.class.equals(Long.class) || Integer.class.equals(Float.class) || Integer.class.equals(Double.class) || Integer.class.equals(Boolean.class) || Integer.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Integer.class.equals(Integer.class) || Integer.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Integer.class.equals(Float.class) || Integer.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Integer.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Integer.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Integer.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Integer'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + // deserialize List + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (List.class.equals(Integer.class) || List.class.equals(Long.class) || List.class.equals(Float.class) || List.class.equals(Double.class) || List.class.equals(Boolean.class) || List.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((List.class.equals(Integer.class) || List.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((List.class.equals(Float.class) || List.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (List.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (List.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(List.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'List'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + if (match == 1) { + ArrayOneOf ret = new ArrayOneOf(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for ArrayOneOf: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public ArrayOneOf getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "ArrayOneOf cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public ArrayOneOf() { + super("oneOf", Boolean.FALSE); + } + + public ArrayOneOf(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ArrayOneOf(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("List", List.class); + JSON.registerDescendants(ArrayOneOf.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return ArrayOneOf.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Integer, List + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, List"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, List + * + * @return The actual instance (Integer, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayTest.java new file mode 100644 index 000000000000..cc8722bd97c6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -0,0 +1,259 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL +}) +@JsonTypeName("ArrayTest") +public class ArrayTest { + public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string"; + @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) + @javax.annotation.Nullable + private List arrayOfString = new ArrayList<>(); + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) + @javax.annotation.Nullable + private List> arrayArrayOfInteger = new ArrayList<>(); + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) + @javax.annotation.Nullable + private List> arrayArrayOfModel = new ArrayList<>(); + + public ArrayTest() { + } + + public ArrayTest arrayOfString(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_OF_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayOfString() { + return arrayOfString; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_OF_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayOfString(@javax.annotation.Nullable List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + + public ArrayTest arrayArrayOfInteger(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayArrayOfInteger(@javax.annotation.Nullable List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + + public ArrayTest arrayArrayOfModel(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayArrayOfModel(@javax.annotation.Nullable List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayTest instance itself + */ + public ArrayTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("array_of_string", "array_array_of_integer", "array_array_of_model")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Banana.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Banana.java new file mode 100644 index 000000000000..a8151d252dfe --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Banana.java @@ -0,0 +1,170 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Banana + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Banana.JSON_PROPERTY_LENGTH_CM +}) +@JsonTypeName("banana") +public class Banana { + public static final String JSON_PROPERTY_LENGTH_CM = "lengthCm"; + @JsonProperty(JSON_PROPERTY_LENGTH_CM) + @javax.annotation.Nullable + private BigDecimal lengthCm; + + public Banana() { + } + + public Banana lengthCm(@javax.annotation.Nullable BigDecimal lengthCm) { + this.lengthCm = lengthCm; + return this; + } + + /** + * Get lengthCm + * @return lengthCm + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_LENGTH_CM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getLengthCm() { + return lengthCm; + } + + @JsonProperty(value = JSON_PROPERTY_LENGTH_CM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLengthCm(@javax.annotation.Nullable BigDecimal lengthCm) { + this.lengthCm = lengthCm; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Banana instance itself + */ + public Banana putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Banana {\n"); + sb.append(" lengthCm: ").append(toIndentedString(lengthCm)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("lengthCm")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BananaReq.java new file mode 100644 index 000000000000..f1cc630ef0b0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BananaReq.java @@ -0,0 +1,201 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BananaReq + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + BananaReq.JSON_PROPERTY_LENGTH_CM, + BananaReq.JSON_PROPERTY_SWEET +}) +@JsonTypeName("bananaReq") +public class BananaReq { + public static final String JSON_PROPERTY_LENGTH_CM = "lengthCm"; + @JsonProperty(JSON_PROPERTY_LENGTH_CM) + @javax.annotation.Nonnull + private BigDecimal lengthCm; + + public static final String JSON_PROPERTY_SWEET = "sweet"; + @JsonProperty(JSON_PROPERTY_SWEET) + @javax.annotation.Nullable + private Boolean sweet; + + public BananaReq() { + } + + public BananaReq lengthCm(@javax.annotation.Nonnull BigDecimal lengthCm) { + this.lengthCm = lengthCm; + return this; + } + + /** + * Get lengthCm + * @return lengthCm + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_LENGTH_CM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getLengthCm() { + return lengthCm; + } + + @JsonProperty(value = JSON_PROPERTY_LENGTH_CM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setLengthCm(@javax.annotation.Nonnull BigDecimal lengthCm) { + this.lengthCm = lengthCm; + } + + + public BananaReq sweet(@javax.annotation.Nullable Boolean sweet) { + this.sweet = sweet; + return this; + } + + /** + * Get sweet + * @return sweet + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SWEET, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getSweet() { + return sweet; + } + + @JsonProperty(value = JSON_PROPERTY_SWEET, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSweet(@javax.annotation.Nullable Boolean sweet) { + this.sweet = sweet; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BananaReq instance itself + */ + public BananaReq putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("lengthCm", "sweet")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("lengthCm")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BasquePig.java new file mode 100644 index 000000000000..71ac03a7cc6e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BasquePig.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BasquePig + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + BasquePig.JSON_PROPERTY_CLASS_NAME +}) +@JsonTypeName("BasquePig") +public class BasquePig { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @javax.annotation.Nonnull + private String className; + + public BasquePig() { + } + + public BasquePig className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BasquePig instance itself + */ + public BasquePig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BasquePig {\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Capitalization.java new file mode 100644 index 000000000000..1185c43743cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Capitalization.java @@ -0,0 +1,324 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Capitalization + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("Capitalization") +public class Capitalization { + public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel"; + @JsonProperty(JSON_PROPERTY_SMALL_CAMEL) + @javax.annotation.Nullable + private String smallCamel; + + public static final String JSON_PROPERTY_CAPITAL_CAMEL = "CapitalCamel"; + @JsonProperty(JSON_PROPERTY_CAPITAL_CAMEL) + @javax.annotation.Nullable + private String capitalCamel; + + public static final String JSON_PROPERTY_SMALL_SNAKE = "small_Snake"; + @JsonProperty(JSON_PROPERTY_SMALL_SNAKE) + @javax.annotation.Nullable + private String smallSnake; + + public static final String JSON_PROPERTY_CAPITAL_SNAKE = "Capital_Snake"; + @JsonProperty(JSON_PROPERTY_CAPITAL_SNAKE) + @javax.annotation.Nullable + private String capitalSnake; + + public static final String JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + @JsonProperty(JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS) + @javax.annotation.Nullable + private String scAETHFlowPoints; + + public static final String JSON_PROPERTY_A_T_T_N_A_M_E = "ATT_NAME"; + @JsonProperty(JSON_PROPERTY_A_T_T_N_A_M_E) + @javax.annotation.Nullable + private String ATT_NAME; + + public Capitalization() { + } + + public Capitalization smallCamel(@javax.annotation.Nullable String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SMALL_CAMEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSmallCamel() { + return smallCamel; + } + + @JsonProperty(value = JSON_PROPERTY_SMALL_CAMEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSmallCamel(@javax.annotation.Nullable String smallCamel) { + this.smallCamel = smallCamel; + } + + + public Capitalization capitalCamel(@javax.annotation.Nullable String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CAPITAL_CAMEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCapitalCamel() { + return capitalCamel; + } + + @JsonProperty(value = JSON_PROPERTY_CAPITAL_CAMEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCapitalCamel(@javax.annotation.Nullable String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + + public Capitalization smallSnake(@javax.annotation.Nullable String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SMALL_SNAKE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSmallSnake() { + return smallSnake; + } + + @JsonProperty(value = JSON_PROPERTY_SMALL_SNAKE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSmallSnake(@javax.annotation.Nullable String smallSnake) { + this.smallSnake = smallSnake; + } + + + public Capitalization capitalSnake(@javax.annotation.Nullable String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CAPITAL_SNAKE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCapitalSnake() { + return capitalSnake; + } + + @JsonProperty(value = JSON_PROPERTY_CAPITAL_SNAKE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCapitalSnake(@javax.annotation.Nullable String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + + public Capitalization scAETHFlowPoints(@javax.annotation.Nullable String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + @JsonProperty(value = JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setScAETHFlowPoints(@javax.annotation.Nullable String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + + public Capitalization ATT_NAME(@javax.annotation.Nullable String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_A_T_T_N_A_M_E, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getATTNAME() { + return ATT_NAME; + } + + @JsonProperty(value = JSON_PROPERTY_A_T_T_N_A_M_E, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setATTNAME(@javax.annotation.Nullable String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Capitalization instance itself + */ + public Capitalization putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 000000000000..b3c0e810e351 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,182 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Map; +import org.openapitools.client.model.Animal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Cat + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the className to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) + +@JsonPropertyOrder({ + Cat.JSON_PROPERTY_DECLAWED +}) +@JsonTypeName("Cat") +public class Cat extends Animal { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + @JsonProperty(JSON_PROPERTY_DECLAWED) + @javax.annotation.Nullable + private Boolean declawed; + + public Cat() { + this.className = this.getClass().getSimpleName(); + } + + public Cat declawed(@javax.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DECLAWED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDeclawed() { + return declawed; + } + + @JsonProperty(value = JSON_PROPERTY_DECLAWED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeclawed(@javax.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Cat instance itself + */ + public Cat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "declawed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..3fdfbf4488a6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Category + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) +@JsonTypeName("Category") +public class Category { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name = "default-name"; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ClassModel.java new file mode 100644 index 000000000000..d9efc8b877aa --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ClassModel.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model with \"_class\" property + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ClassModel.JSON_PROPERTY_PROPERTY_CLASS +}) +@JsonTypeName("ClassModel") +public class ClassModel { + public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class"; + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @javax.annotation.Nullable + private String propertyClass; + + public ClassModel() { + } + + public ClassModel propertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PROPERTY_CLASS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPropertyClass() { + return propertyClass; + } + + @JsonProperty(value = JSON_PROPERTY_PROPERTY_CLASS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ClassModel instance itself + */ + public ClassModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("_class")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Client.java new file mode 100644 index 000000000000..7e4e6e5e71ee --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Client.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Client.JSON_PROPERTY_CLIENT +}) +@JsonTypeName("Client") +public class Client { + public static final String JSON_PROPERTY_CLIENT = "client"; + @JsonProperty(JSON_PROPERTY_CLIENT) + @javax.annotation.Nullable + private String client; + + public Client() { + } + + public Client client(@javax.annotation.Nullable String client) { + this.client = client; + return this; + } + + /** + * Get client + * @return client + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CLIENT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getClient() { + return client; + } + + @JsonProperty(value = JSON_PROPERTY_CLIENT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setClient(@javax.annotation.Nullable String client) { + this.client = client; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Client instance itself + */ + public Client putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("client")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java new file mode 100644 index 000000000000..8b8b5d03b6ba --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ComplexQuadrilateral + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ComplexQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, + ComplexQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE +}) +@JsonTypeName("ComplexQuadrilateral") +public class ComplexQuadrilateral { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType"; + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @javax.annotation.Nonnull + private String quadrilateralType; + + public ComplexQuadrilateral() { + } + + public ComplexQuadrilateral shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public ComplexQuadrilateral quadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setQuadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ComplexQuadrilateral instance itself + */ + public ComplexQuadrilateral putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DanishPig.java new file mode 100644 index 000000000000..6cca04b81255 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DanishPig.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DanishPig + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + DanishPig.JSON_PROPERTY_CLASS_NAME +}) +@JsonTypeName("DanishPig") +public class DanishPig { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @javax.annotation.Nonnull + private String className; + + public DanishPig() { + } + + public DanishPig className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DanishPig instance itself + */ + public DanishPig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DanishPig {\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DeprecatedObject.java new file mode 100644 index 000000000000..950f3f417e17 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -0,0 +1,171 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DeprecatedObject + * @deprecated + */ +@Deprecated +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + DeprecatedObject.JSON_PROPERTY_NAME +}) +@JsonTypeName("DeprecatedObject") +public class DeprecatedObject { + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nullable + private String name; + + public DeprecatedObject() { + } + + public DeprecatedObject name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DeprecatedObject instance itself + */ + public DeprecatedObject putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeprecatedObject {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 000000000000..b622431d9d37 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,181 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Animal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Dog + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the className to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) + +@JsonPropertyOrder({ + Dog.JSON_PROPERTY_BREED +}) +@JsonTypeName("Dog") +public class Dog extends Animal { + public static final String JSON_PROPERTY_BREED = "breed"; + @JsonProperty(JSON_PROPERTY_BREED) + @javax.annotation.Nullable + private String breed; + + public Dog() { + this.className = this.getClass().getSimpleName(); + } + + public Dog breed(@javax.annotation.Nullable String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BREED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBreed() { + return breed; + } + + @JsonProperty(value = JSON_PROPERTY_BREED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBreed(@javax.annotation.Nullable String breed) { + this.breed = breed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Dog instance itself + */ + public Dog putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "breed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Drawing.java new file mode 100644 index 000000000000..3fbacecbcdd7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Drawing.java @@ -0,0 +1,292 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Fruit; +import org.openapitools.client.model.NullableShape; +import org.openapitools.client.model.Shape; +import org.openapitools.client.model.ShapeOrNull; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Drawing + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Drawing.JSON_PROPERTY_MAIN_SHAPE, + Drawing.JSON_PROPERTY_SHAPE_OR_NULL, + Drawing.JSON_PROPERTY_NULLABLE_SHAPE, + Drawing.JSON_PROPERTY_SHAPES +}) +@JsonTypeName("Drawing") +public class Drawing { + public static final String JSON_PROPERTY_MAIN_SHAPE = "mainShape"; + @JsonProperty(JSON_PROPERTY_MAIN_SHAPE) + @javax.annotation.Nullable + private Shape mainShape; + + public static final String JSON_PROPERTY_SHAPE_OR_NULL = "shapeOrNull"; + @JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL) + @javax.annotation.Nullable + private ShapeOrNull shapeOrNull; + + public static final String JSON_PROPERTY_NULLABLE_SHAPE = "nullableShape"; + @JsonProperty(JSON_PROPERTY_NULLABLE_SHAPE) + @javax.annotation.Nullable + private NullableShape nullableShape; + + public static final String JSON_PROPERTY_SHAPES = "shapes"; + @JsonProperty(JSON_PROPERTY_SHAPES) + @javax.annotation.Nullable + private List shapes = new ArrayList<>(); + + public Drawing() { + } + + public Drawing mainShape(@javax.annotation.Nullable Shape mainShape) { + this.mainShape = mainShape; + return this; + } + + /** + * Get mainShape + * @return mainShape + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MAIN_SHAPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Shape getMainShape() { + return mainShape; + } + + @JsonProperty(value = JSON_PROPERTY_MAIN_SHAPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMainShape(@javax.annotation.Nullable Shape mainShape) { + this.mainShape = mainShape; + } + + + public Drawing shapeOrNull(@javax.annotation.Nullable ShapeOrNull shapeOrNull) { + this.shapeOrNull = shapeOrNull; + return this; + } + + /** + * Get shapeOrNull + * @return shapeOrNull + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SHAPE_OR_NULL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ShapeOrNull getShapeOrNull() { + return shapeOrNull; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_OR_NULL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShapeOrNull(@javax.annotation.Nullable ShapeOrNull shapeOrNull) { + this.shapeOrNull = shapeOrNull; + } + + + public Drawing nullableShape(@javax.annotation.Nullable NullableShape nullableShape) { + this.nullableShape = nullableShape; + return this; + } + + /** + * Get nullableShape + * @return nullableShape + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NULLABLE_SHAPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public NullableShape getNullableShape() { + return nullableShape; + } + + @JsonProperty(value = JSON_PROPERTY_NULLABLE_SHAPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNullableShape(@javax.annotation.Nullable NullableShape nullableShape) { + this.nullableShape = nullableShape; + } + + + public Drawing shapes(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_SHAPES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getShapes() { + return shapes; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShapes(@javax.annotation.Nullable List shapes) { + this.shapes = shapes; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Drawing instance itself + */ + public Drawing putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Drawing {\n"); + sb.append(" mainShape: ").append(toIndentedString(mainShape)).append("\n"); + sb.append(" shapeOrNull: ").append(toIndentedString(shapeOrNull)).append("\n"); + sb.append(" nullableShape: ").append(toIndentedString(nullableShape)).append("\n"); + sb.append(" shapes: ").append(toIndentedString(shapes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("mainShape", "shapeOrNull", "nullableShape", "shapes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumArrays.java new file mode 100644 index 000000000000..2af92cd3a26b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -0,0 +1,283 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EnumArrays + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + EnumArrays.JSON_PROPERTY_JUST_SYMBOL, + EnumArrays.JSON_PROPERTY_ARRAY_ENUM +}) +@JsonTypeName("EnumArrays") +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"; + @JsonProperty(JSON_PROPERTY_JUST_SYMBOL) + @javax.annotation.Nullable + 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"; + @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) + @javax.annotation.Nullable + private List arrayEnum = new ArrayList<>(); + + public EnumArrays() { + } + + public EnumArrays justSymbol(@javax.annotation.Nullable JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_JUST_SYMBOL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + @JsonProperty(value = JSON_PROPERTY_JUST_SYMBOL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setJustSymbol(@javax.annotation.Nullable JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + + public EnumArrays arrayEnum(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayEnum() { + return arrayEnum; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayEnum(@javax.annotation.Nullable List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumArrays instance itself + */ + public EnumArrays putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("just_symbol", "array_enum")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumClass.java new file mode 100644 index 000000000000..5e4eb56e8483 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumClass.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.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +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/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java new file mode 100644 index 000000000000..6f379af414f1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * An object to test discriminator of enum string + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "enum_str_type", // ignore manually set enum_str_type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the enum_str_type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "enum_str_type", visible = true) + +@JsonPropertyOrder({ + EnumStringDiscriminator.JSON_PROPERTY_ENUM_STR_TYPE +}) +@JsonTypeName("EnumStringDiscriminator") +public class EnumStringDiscriminator { + /** + * enum string type + */ + public enum EnumStrTypeEnum { + A("type_a"), + + B("type_b"); + + private String value; + + EnumStrTypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStrTypeEnum fromValue(String value) { + for (EnumStrTypeEnum b : EnumStrTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + } + + public static final String JSON_PROPERTY_ENUM_STR_TYPE = "enum_str_type"; + @JsonProperty(JSON_PROPERTY_ENUM_STR_TYPE) + @javax.annotation.Nonnull + protected EnumStrTypeEnum enumStrType; + + public EnumStringDiscriminator() { + + } + + public EnumStringDiscriminator enumStrType(@javax.annotation.Nonnull EnumStrTypeEnum enumStrType) { + this.enumStrType = enumStrType; + return this; + } + + /** + * enum string type + * @return enumStrType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ENUM_STR_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public EnumStrTypeEnum getEnumStrType() { + return enumStrType; + } + + @JsonProperty(value = JSON_PROPERTY_ENUM_STR_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEnumStrType(@javax.annotation.Nonnull EnumStrTypeEnum enumStrType) { + this.enumStrType = enumStrType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumStringDiscriminator instance itself + */ + public EnumStringDiscriminator putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumStringDiscriminator {\n"); + sb.append(" enumStrType: ").append(toIndentedString(enumStrType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("enum_str_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("enum_str_type")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumTest.java new file mode 100644 index 000000000000..f9ed98626685 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumTest.java @@ -0,0 +1,625 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.OuterEnumDefaultValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.openapitools.client.model.OuterEnumIntegerDefaultValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EnumTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + EnumTest.JSON_PROPERTY_ENUM_STRING, + EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, + EnumTest.JSON_PROPERTY_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_ENUM_INTEGER_ONLY, + EnumTest.JSON_PROPERTY_ENUM_NUMBER, + EnumTest.JSON_PROPERTY_OUTER_ENUM, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE +}) +@JsonTypeName("Enum_Test") +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"; + @JsonProperty(JSON_PROPERTY_ENUM_STRING) + @javax.annotation.Nullable + 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"; + @JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED) + @javax.annotation.Nonnull + 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"; + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER) + @javax.annotation.Nullable + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumIntegerOnly + */ + public enum EnumIntegerOnlyEnum { + NUMBER_2(2), + + NUMBER_MINUS_2(-2); + + private Integer value; + + EnumIntegerOnlyEnum(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerOnlyEnum fromValue(Integer value) { + for (EnumIntegerOnlyEnum b : EnumIntegerOnlyEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + } + + public static final String JSON_PROPERTY_ENUM_INTEGER_ONLY = "enum_integer_only"; + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER_ONLY) + @javax.annotation.Nullable + private EnumIntegerOnlyEnum enumIntegerOnly; + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_ENUM_NUMBER) + @javax.annotation.Nullable + private EnumNumberEnum enumNumber; + + public static final String JSON_PROPERTY_OUTER_ENUM = "outerEnum"; + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + @javax.annotation.Nullable + private OuterEnum outerEnum; + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER = "outerEnumInteger"; + @Deprecated + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER) + @javax.annotation.Nullable + private OuterEnumInteger outerEnumInteger; + + public static final String JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE = "outerEnumDefaultValue"; + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE) + @javax.annotation.Nullable + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE = "outerEnumIntegerDefaultValue"; + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE) + @javax.annotation.Nullable + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + + public EnumTest() { + } + + public EnumTest enumString(@javax.annotation.Nullable EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ENUM_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumStringEnum getEnumString() { + return enumString; + } + + @JsonProperty(value = JSON_PROPERTY_ENUM_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumString(@javax.annotation.Nullable EnumStringEnum enumString) { + this.enumString = enumString; + } + + + public EnumTest enumStringRequired(@javax.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ENUM_STRING_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + @JsonProperty(value = JSON_PROPERTY_ENUM_STRING_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEnumStringRequired(@javax.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + + public EnumTest enumInteger(@javax.annotation.Nullable EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ENUM_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + @JsonProperty(value = JSON_PROPERTY_ENUM_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumInteger(@javax.annotation.Nullable EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + public EnumTest enumIntegerOnly(@javax.annotation.Nullable EnumIntegerOnlyEnum enumIntegerOnly) { + this.enumIntegerOnly = enumIntegerOnly; + return this; + } + + /** + * Get enumIntegerOnly + * @return enumIntegerOnly + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ENUM_INTEGER_ONLY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumIntegerOnlyEnum getEnumIntegerOnly() { + return enumIntegerOnly; + } + + @JsonProperty(value = JSON_PROPERTY_ENUM_INTEGER_ONLY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumIntegerOnly(@javax.annotation.Nullable EnumIntegerOnlyEnum enumIntegerOnly) { + this.enumIntegerOnly = enumIntegerOnly; + } + + + public EnumTest enumNumber(@javax.annotation.Nullable EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ENUM_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + @JsonProperty(value = JSON_PROPERTY_ENUM_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumNumber(@javax.annotation.Nullable EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + public EnumTest outerEnum(@javax.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnum getOuterEnum() { + return outerEnum; + } + + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnum(@javax.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + + @Deprecated + public EnumTest outerEnumInteger(@javax.annotation.Nullable OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return this; + } + + /** + * Get outerEnumInteger + * @return outerEnumInteger + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + @Deprecated + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnumInteger(@javax.annotation.Nullable OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + + public EnumTest outerEnumDefaultValue(@javax.annotation.Nullable OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + /** + * Get outerEnumDefaultValue + * @return outerEnumDefaultValue + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnumDefaultValue(@javax.annotation.Nullable OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + + public EnumTest outerEnumIntegerDefaultValue(@javax.annotation.Nullable OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + /** + * Get outerEnumIntegerDefaultValue + * @return outerEnumIntegerDefaultValue + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnumIntegerDefaultValue(@javax.annotation.Nullable OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumTest instance itself + */ + public EnumTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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(" enumIntegerOnly: ").append(toIndentedString(enumIntegerOnly)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); + sb.append(" outerEnumDefaultValue: ").append(toIndentedString(outerEnumDefaultValue)).append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ").append(toIndentedString(outerEnumIntegerDefaultValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("enum_string", "enum_string_required", "enum_integer", "enum_integer_only", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("enum_string_required")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java new file mode 100644 index 000000000000..d6783c618dd4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EquilateralTriangle + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + EquilateralTriangle.JSON_PROPERTY_SHAPE_TYPE, + EquilateralTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) +@JsonTypeName("EquilateralTriangle") +public class EquilateralTriangle { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @javax.annotation.Nonnull + private String triangleType; + + public EquilateralTriangle() { + } + + public EquilateralTriangle shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public EquilateralTriangle triangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTriangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EquilateralTriangle instance itself + */ + public EquilateralTriangle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java new file mode 100644 index 000000000000..fde11aa5df8e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java @@ -0,0 +1,208 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = FakeAnyOfWIthSameErasureGet200Response.FakeAnyOfWIthSameErasureGet200ResponseDeserializer.class) +@JsonSerialize(using = FakeAnyOfWIthSameErasureGet200Response.FakeAnyOfWIthSameErasureGet200ResponseSerializer.class) +public class FakeAnyOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FakeAnyOfWIthSameErasureGet200Response.class.getName()); + + + public static class FakeAnyOfWIthSameErasureGet200ResponseSerializer extends StdSerializer { + public FakeAnyOfWIthSameErasureGet200ResponseSerializer(Class t) { + super(t); + } + + public FakeAnyOfWIthSameErasureGet200ResponseSerializer() { + this(null); + } + + @Override + public void serialize(FakeAnyOfWIthSameErasureGet200Response value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class FakeAnyOfWIthSameErasureGet200ResponseDeserializer extends StdDeserializer { + public FakeAnyOfWIthSameErasureGet200ResponseDeserializer() { + this(FakeAnyOfWIthSameErasureGet200Response.class); + } + + public FakeAnyOfWIthSameErasureGet200ResponseDeserializer(Class vc) { + super(vc); + } + + @Override + public FakeAnyOfWIthSameErasureGet200Response deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + // deserialize List + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(List.class); + FakeAnyOfWIthSameErasureGet200Response ret = new FakeAnyOfWIthSameErasureGet200Response(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + // deserialize List + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(List.class); + FakeAnyOfWIthSameErasureGet200Response ret = new FakeAnyOfWIthSameErasureGet200Response(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for FakeAnyOfWIthSameErasureGet200Response: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public FakeAnyOfWIthSameErasureGet200Response getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "FakeAnyOfWIthSameErasureGet200Response cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public FakeAnyOfWIthSameErasureGet200Response() { + super("anyOf", Boolean.FALSE); + } + + public FakeAnyOfWIthSameErasureGet200Response(List o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public FakeAnyOfWIthSameErasureGet200Response(List o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List", List.class); + schemas.put("List", List.class); + JSON.registerDescendants(FakeAnyOfWIthSameErasureGet200Response.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return FakeAnyOfWIthSameErasureGet200Response.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * List, List + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List, List"); + } + + /** + * Get the actual instance, which can be the following: + * List, List + * + * @return The actual instance (List, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java new file mode 100644 index 000000000000..fb1adba68241 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java @@ -0,0 +1,246 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = FakeOneOfWIthSameErasureGet200Response.FakeOneOfWIthSameErasureGet200ResponseDeserializer.class) +@JsonSerialize(using = FakeOneOfWIthSameErasureGet200Response.FakeOneOfWIthSameErasureGet200ResponseSerializer.class) +public class FakeOneOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FakeOneOfWIthSameErasureGet200Response.class.getName()); + + + public static class FakeOneOfWIthSameErasureGet200ResponseSerializer extends StdSerializer { + public FakeOneOfWIthSameErasureGet200ResponseSerializer(Class t) { + super(t); + } + + public FakeOneOfWIthSameErasureGet200ResponseSerializer() { + this(null); + } + + @Override + public void serialize(FakeOneOfWIthSameErasureGet200Response value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class FakeOneOfWIthSameErasureGet200ResponseDeserializer extends StdDeserializer { + public FakeOneOfWIthSameErasureGet200ResponseDeserializer() { + this(FakeOneOfWIthSameErasureGet200Response.class); + } + + public FakeOneOfWIthSameErasureGet200ResponseDeserializer(Class vc) { + super(vc); + } + + @Override + public FakeOneOfWIthSameErasureGet200Response deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize List + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (List.class.equals(Integer.class) || List.class.equals(Long.class) || List.class.equals(Float.class) || List.class.equals(Double.class) || List.class.equals(Boolean.class) || List.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((List.class.equals(Integer.class) || List.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((List.class.equals(Float.class) || List.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (List.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (List.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(List.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'List'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + // deserialize List + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (List.class.equals(Integer.class) || List.class.equals(Long.class) || List.class.equals(Float.class) || List.class.equals(Double.class) || List.class.equals(Boolean.class) || List.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((List.class.equals(Integer.class) || List.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((List.class.equals(Float.class) || List.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (List.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (List.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(List.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'List'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + if (match == 1) { + FakeOneOfWIthSameErasureGet200Response ret = new FakeOneOfWIthSameErasureGet200Response(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for FakeOneOfWIthSameErasureGet200Response: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public FakeOneOfWIthSameErasureGet200Response getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "FakeOneOfWIthSameErasureGet200Response cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public FakeOneOfWIthSameErasureGet200Response() { + super("oneOf", Boolean.FALSE); + } + + public FakeOneOfWIthSameErasureGet200Response(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public FakeOneOfWIthSameErasureGet200Response(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List", List.class); + schemas.put("List", List.class); + JSON.registerDescendants(FakeOneOfWIthSameErasureGet200Response.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return FakeOneOfWIthSameErasureGet200Response.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * List, List + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List, List"); + } + + /** + * Get the actual instance, which can be the following: + * List, List + * + * @return The actual instance (List, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java new file mode 100644 index 000000000000..ad3dbffdca98 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java @@ -0,0 +1,245 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = FakeRefParameterPetIdParameter.FakeRefParameterPetIdParameterDeserializer.class) +@JsonSerialize(using = FakeRefParameterPetIdParameter.FakeRefParameterPetIdParameterSerializer.class) +public class FakeRefParameterPetIdParameter extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FakeRefParameterPetIdParameter.class.getName()); + + + public static class FakeRefParameterPetIdParameterSerializer extends StdSerializer { + public FakeRefParameterPetIdParameterSerializer(Class t) { + super(t); + } + + public FakeRefParameterPetIdParameterSerializer() { + this(null); + } + + @Override + public void serialize(FakeRefParameterPetIdParameter value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class FakeRefParameterPetIdParameterDeserializer extends StdDeserializer { + public FakeRefParameterPetIdParameterDeserializer() { + this(FakeRefParameterPetIdParameter.class); + } + + public FakeRefParameterPetIdParameterDeserializer(Class vc) { + super(vc); + } + + @Override + public FakeRefParameterPetIdParameter deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Integer + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Integer.class.equals(Integer.class) || Integer.class.equals(Long.class) || Integer.class.equals(Float.class) || Integer.class.equals(Double.class) || Integer.class.equals(Boolean.class) || Integer.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Integer.class.equals(Integer.class) || Integer.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Integer.class.equals(Float.class) || Integer.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Integer.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Integer.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Integer.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Integer'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + // deserialize String + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (String.class.equals(Integer.class) || String.class.equals(Long.class) || String.class.equals(Float.class) || String.class.equals(Double.class) || String.class.equals(Boolean.class) || String.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((String.class.equals(Integer.class) || String.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((String.class.equals(Float.class) || String.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (String.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (String.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(String.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + if (match == 1) { + FakeRefParameterPetIdParameter ret = new FakeRefParameterPetIdParameter(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for FakeRefParameterPetIdParameter: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public FakeRefParameterPetIdParameter getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "FakeRefParameterPetIdParameter cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public FakeRefParameterPetIdParameter() { + super("oneOf", Boolean.FALSE); + } + + public FakeRefParameterPetIdParameter(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public FakeRefParameterPetIdParameter(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("String", String.class); + JSON.registerDescendants(FakeRefParameterPetIdParameter.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return FakeRefParameterPetIdParameter.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Integer, String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, String"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, String + * + * @return The actual instance (Integer, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..6c5ac5830186 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,212 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FileSchemaTestClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + FileSchemaTestClass.JSON_PROPERTY_FILE, + FileSchemaTestClass.JSON_PROPERTY_FILES +}) +@JsonTypeName("FileSchemaTestClass") +public class FileSchemaTestClass { + public static final String JSON_PROPERTY_FILE = "file"; + @JsonProperty(JSON_PROPERTY_FILE) + @javax.annotation.Nullable + private ModelFile _file; + + public static final String JSON_PROPERTY_FILES = "files"; + @JsonProperty(JSON_PROPERTY_FILES) + @javax.annotation.Nullable + private List files = new ArrayList<>(); + + public FileSchemaTestClass() { + } + + public FileSchemaTestClass _file(@javax.annotation.Nullable ModelFile _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ModelFile getFile() { + return _file; + } + + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFile(@javax.annotation.Nullable ModelFile _file) { + this._file = _file; + } + + + public FileSchemaTestClass files(@javax.annotation.Nullable List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(ModelFile filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_FILES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getFiles() { + return files; + } + + @JsonProperty(value = JSON_PROPERTY_FILES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFiles(@javax.annotation.Nullable List files) { + this.files = files; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FileSchemaTestClass instance itself + */ + public FileSchemaTestClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("file", "files")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Foo.java new file mode 100644 index 000000000000..966b8f57c89a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Foo.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Foo + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Foo.JSON_PROPERTY_BAR +}) +@JsonTypeName("Foo") +public class Foo { + public static final String JSON_PROPERTY_BAR = "bar"; + @JsonProperty(JSON_PROPERTY_BAR) + @javax.annotation.Nullable + private String bar = "bar"; + + public Foo() { + } + + public Foo bar(@javax.annotation.Nullable String bar) { + this.bar = bar; + return this; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BAR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + @JsonProperty(value = JSON_PROPERTY_BAR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBar(@javax.annotation.Nullable String bar) { + this.bar = bar; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Foo instance itself + */ + public Foo putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Foo {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java new file mode 100644 index 000000000000..117141b28783 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -0,0 +1,170 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Foo; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FooGetDefaultResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + FooGetDefaultResponse.JSON_PROPERTY_STRING +}) +@JsonTypeName("_foo_get_default_response") +public class FooGetDefaultResponse { + public static final String JSON_PROPERTY_STRING = "string"; + @JsonProperty(JSON_PROPERTY_STRING) + @javax.annotation.Nullable + private Foo string; + + public FooGetDefaultResponse() { + } + + public FooGetDefaultResponse string(@javax.annotation.Nullable Foo string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Foo getString() { + return string; + } + + @JsonProperty(value = JSON_PROPERTY_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setString(@javax.annotation.Nullable Foo string) { + this.string = string; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FooGetDefaultResponse instance itself + */ + public FooGetDefaultResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("string")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FormatTest.java new file mode 100644 index 000000000000..e00e4d663914 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FormatTest.java @@ -0,0 +1,680 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FormatTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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_DECIMAL, + 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_UUID_WITH_DEFAULT, + FormatTest.JSON_PROPERTY_PASSWORD, + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS, + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER +}) +@JsonTypeName("format_test") +public class FormatTest { + public static final String JSON_PROPERTY_INTEGER = "integer"; + @JsonProperty(JSON_PROPERTY_INTEGER) + @javax.annotation.Nullable + private Integer integer; + + public static final String JSON_PROPERTY_INT32 = "int32"; + @JsonProperty(JSON_PROPERTY_INT32) + @javax.annotation.Nullable + private Integer int32; + + public static final String JSON_PROPERTY_INT64 = "int64"; + @JsonProperty(JSON_PROPERTY_INT64) + @javax.annotation.Nullable + private Long int64; + + public static final String JSON_PROPERTY_NUMBER = "number"; + @JsonProperty(JSON_PROPERTY_NUMBER) + @javax.annotation.Nonnull + private BigDecimal number; + + public static final String JSON_PROPERTY_FLOAT = "float"; + @JsonProperty(JSON_PROPERTY_FLOAT) + @javax.annotation.Nullable + private Float _float; + + public static final String JSON_PROPERTY_DOUBLE = "double"; + @JsonProperty(JSON_PROPERTY_DOUBLE) + @javax.annotation.Nullable + private Double _double; + + public static final String JSON_PROPERTY_DECIMAL = "decimal"; + @JsonProperty(JSON_PROPERTY_DECIMAL) + @javax.annotation.Nullable + private BigDecimal decimal; + + public static final String JSON_PROPERTY_STRING = "string"; + @JsonProperty(JSON_PROPERTY_STRING) + @javax.annotation.Nullable + private String string; + + public static final String JSON_PROPERTY_BYTE = "byte"; + @JsonProperty(JSON_PROPERTY_BYTE) + @javax.annotation.Nonnull + private byte[] _byte; + + public static final String JSON_PROPERTY_BINARY = "binary"; + @JsonProperty(JSON_PROPERTY_BINARY) + @javax.annotation.Nullable + private File binary; + + public static final String JSON_PROPERTY_DATE = "date"; + @JsonProperty(JSON_PROPERTY_DATE) + @javax.annotation.Nonnull + private LocalDate date; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @javax.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_UUID = "uuid"; + @JsonProperty(JSON_PROPERTY_UUID) + @javax.annotation.Nullable + private UUID uuid; + + public static final String JSON_PROPERTY_UUID_WITH_DEFAULT = "uuid_with_default"; + @JsonProperty(JSON_PROPERTY_UUID_WITH_DEFAULT) + @javax.annotation.Nullable + private UUID uuidWithDefault = UUID.fromString("11111111-206d-4f12-9f12-3d1e525a8e84"); + + public static final String JSON_PROPERTY_PASSWORD = "password"; + @JsonProperty(JSON_PROPERTY_PASSWORD) + @javax.annotation.Nonnull + private String password; + + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS = "pattern_with_digits"; + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS) + @javax.annotation.Nullable + private String patternWithDigits; + + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER = "pattern_with_digits_and_delimiter"; + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER) + @javax.annotation.Nullable + private String patternWithDigitsAndDelimiter; + + public FormatTest() { + } + + public FormatTest integer(@javax.annotation.Nullable Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInteger() { + return integer; + } + + @JsonProperty(value = JSON_PROPERTY_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInteger(@javax.annotation.Nullable Integer integer) { + this.integer = integer; + } + + + public FormatTest int32(@javax.annotation.Nullable Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_INT32, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInt32() { + return int32; + } + + @JsonProperty(value = JSON_PROPERTY_INT32, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInt32(@javax.annotation.Nullable Integer int32) { + this.int32 = int32; + } + + + public FormatTest int64(@javax.annotation.Nullable Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_INT64, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getInt64() { + return int64; + } + + @JsonProperty(value = JSON_PROPERTY_INT64, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInt64(@javax.annotation.Nullable Long int64) { + this.int64 = int64; + } + + + public FormatTest number(@javax.annotation.Nonnull BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NUMBER, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumber() { + return number; + } + + @JsonProperty(value = JSON_PROPERTY_NUMBER, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNumber(@javax.annotation.Nonnull BigDecimal number) { + this.number = number; + } + + + public FormatTest _float(@javax.annotation.Nullable Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_FLOAT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Float getFloat() { + return _float; + } + + @JsonProperty(value = JSON_PROPERTY_FLOAT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFloat(@javax.annotation.Nullable Float _float) { + this._float = _float; + } + + + public FormatTest _double(@javax.annotation.Nullable Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DOUBLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Double getDouble() { + return _double; + } + + @JsonProperty(value = JSON_PROPERTY_DOUBLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDouble(@javax.annotation.Nullable Double _double) { + this._double = _double; + } + + + public FormatTest decimal(@javax.annotation.Nullable BigDecimal decimal) { + this.decimal = decimal; + return this; + } + + /** + * Get decimal + * @return decimal + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DECIMAL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getDecimal() { + return decimal; + } + + @JsonProperty(value = JSON_PROPERTY_DECIMAL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDecimal(@javax.annotation.Nullable BigDecimal decimal) { + this.decimal = decimal; + } + + + public FormatTest string(@javax.annotation.Nullable String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getString() { + return string; + } + + @JsonProperty(value = JSON_PROPERTY_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setString(@javax.annotation.Nullable String string) { + this.string = string; + } + + + public FormatTest _byte(@javax.annotation.Nonnull byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_BYTE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public byte[] getByte() { + return _byte; + } + + @JsonProperty(value = JSON_PROPERTY_BYTE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setByte(@javax.annotation.Nonnull byte[] _byte) { + this._byte = _byte; + } + + + public FormatTest binary(@javax.annotation.Nullable File binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BINARY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public File getBinary() { + return binary; + } + + @JsonProperty(value = JSON_PROPERTY_BINARY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBinary(@javax.annotation.Nullable File binary) { + this.binary = binary; + } + + + public FormatTest date(@javax.annotation.Nonnull LocalDate date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public LocalDate getDate() { + return date; + } + + @JsonProperty(value = JSON_PROPERTY_DATE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setDate(@javax.annotation.Nonnull LocalDate date) { + this.date = date; + } + + + public FormatTest dateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DATE_TIME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + @JsonProperty(value = JSON_PROPERTY_DATE_TIME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public FormatTest uuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_UUID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuid() { + return uuid; + } + + @JsonProperty(value = JSON_PROPERTY_UUID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + + public FormatTest uuidWithDefault(@javax.annotation.Nullable UUID uuidWithDefault) { + this.uuidWithDefault = uuidWithDefault; + return this; + } + + /** + * Get uuidWithDefault + * @return uuidWithDefault + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_UUID_WITH_DEFAULT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuidWithDefault() { + return uuidWithDefault; + } + + @JsonProperty(value = JSON_PROPERTY_UUID_WITH_DEFAULT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuidWithDefault(@javax.annotation.Nullable UUID uuidWithDefault) { + this.uuidWithDefault = uuidWithDefault; + } + + + public FormatTest password(@javax.annotation.Nonnull String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PASSWORD, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPassword() { + return password; + } + + @JsonProperty(value = JSON_PROPERTY_PASSWORD, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPassword(@javax.annotation.Nonnull String password) { + this.password = password; + } + + + public FormatTest patternWithDigits(@javax.annotation.Nullable String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + return this; + } + + /** + * A string that is a 10 digit number. Can have leading zeros. + * @return patternWithDigits + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PATTERN_WITH_DIGITS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPatternWithDigits() { + return patternWithDigits; + } + + @JsonProperty(value = JSON_PROPERTY_PATTERN_WITH_DIGITS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPatternWithDigits(@javax.annotation.Nullable String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + } + + + public FormatTest patternWithDigitsAndDelimiter(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; + } + + @JsonProperty(value = JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPatternWithDigitsAndDelimiter(@javax.annotation.Nullable String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FormatTest instance itself + */ + public FormatTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" decimal: ").append(toIndentedString(decimal)).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(" uuidWithDefault: ").append(toIndentedString(uuidWithDefault)).append("\n"); + sb.append(" password: ").append("*").append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer", "int32", "int64", "number", "float", "double", "decimal", "string", "byte", "binary", "date", "dateTime", "uuid", "uuid_with_default", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("number", "byte", "date", "password")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java new file mode 100644 index 000000000000..cd49b5daab3a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java @@ -0,0 +1,201 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.FreeFormObjectTestClassProperties; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FreeFormObjectTestClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + FreeFormObjectTestClass.JSON_PROPERTY_NAME, + FreeFormObjectTestClass.JSON_PROPERTY_PROPERTIES +}) +@JsonTypeName("FreeFormObjectTestClass") +public class FreeFormObjectTestClass { + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nullable + private String name; + + public static final String JSON_PROPERTY_PROPERTIES = "properties"; + @JsonProperty(JSON_PROPERTY_PROPERTIES) + @javax.annotation.Nullable + private FreeFormObjectTestClassProperties properties; + + public FreeFormObjectTestClass() { + } + + public FreeFormObjectTestClass name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public FreeFormObjectTestClass properties(@javax.annotation.Nullable FreeFormObjectTestClassProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get properties + * @return properties + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PROPERTIES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public FreeFormObjectTestClassProperties getProperties() { + return properties; + } + + @JsonProperty(value = JSON_PROPERTY_PROPERTIES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setProperties(@javax.annotation.Nullable FreeFormObjectTestClassProperties properties) { + this.properties = properties; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FreeFormObjectTestClass instance itself + */ + public FreeFormObjectTestClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FreeFormObjectTestClass {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "properties")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java new file mode 100644 index 000000000000..b60fc21ebc46 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java @@ -0,0 +1,246 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = FreeFormObjectTestClassProperties.FreeFormObjectTestClassPropertiesDeserializer.class) +@JsonSerialize(using = FreeFormObjectTestClassProperties.FreeFormObjectTestClassPropertiesSerializer.class) +public class FreeFormObjectTestClassProperties extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FreeFormObjectTestClassProperties.class.getName()); + + + public static class FreeFormObjectTestClassPropertiesSerializer extends StdSerializer { + public FreeFormObjectTestClassPropertiesSerializer(Class t) { + super(t); + } + + public FreeFormObjectTestClassPropertiesSerializer() { + this(null); + } + + @Override + public void serialize(FreeFormObjectTestClassProperties value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class FreeFormObjectTestClassPropertiesDeserializer extends StdDeserializer { + public FreeFormObjectTestClassPropertiesDeserializer() { + this(FreeFormObjectTestClassProperties.class); + } + + public FreeFormObjectTestClassPropertiesDeserializer(Class vc) { + super(vc); + } + + @Override + public FreeFormObjectTestClassProperties deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Map + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Map.class.equals(Integer.class) || Map.class.equals(Long.class) || Map.class.equals(Float.class) || Map.class.equals(Double.class) || Map.class.equals(Boolean.class) || Map.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Map.class.equals(Integer.class) || Map.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Map.class.equals(Float.class) || Map.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Map.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Map.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Map.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Map'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Map'", e); + } + + // deserialize String + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (String.class.equals(Integer.class) || String.class.equals(Long.class) || String.class.equals(Float.class) || String.class.equals(Double.class) || String.class.equals(Boolean.class) || String.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((String.class.equals(Integer.class) || String.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((String.class.equals(Float.class) || String.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (String.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (String.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(String.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + if (match == 1) { + FreeFormObjectTestClassProperties ret = new FreeFormObjectTestClassProperties(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for FreeFormObjectTestClassProperties: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public FreeFormObjectTestClassProperties getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "FreeFormObjectTestClassProperties cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public FreeFormObjectTestClassProperties() { + super("oneOf", Boolean.FALSE); + } + + public FreeFormObjectTestClassProperties(Map o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public FreeFormObjectTestClassProperties(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Map", Map.class); + schemas.put("String", String.class); + JSON.registerDescendants(FreeFormObjectTestClassProperties.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return FreeFormObjectTestClassProperties.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Map, String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Map.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Map, String"); + } + + /** + * Get the actual instance, which can be the following: + * Map, String + * + * @return The actual instance (Map, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Map`. If the actual instance is not `Map`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Map` + * @throws ClassCastException if the instance is not `Map` + */ + public Map getMap() throws ClassCastException { + return (Map)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Fruit.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Fruit.java new file mode 100644 index 000000000000..9faef1e278d2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Fruit.java @@ -0,0 +1,252 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Fruit.FruitDeserializer.class) +@JsonSerialize(using = Fruit.FruitSerializer.class) +public class Fruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Fruit.class.getName()); + + + public static class FruitSerializer extends StdSerializer { + public FruitSerializer(Class t) { + super(t); + } + + public FruitSerializer() { + this(null); + } + + @Override + public void serialize(Fruit value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + 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 { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Apple + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Apple.class.equals(Integer.class) || Apple.class.equals(Long.class) || Apple.class.equals(Float.class) || Apple.class.equals(Double.class) || Apple.class.equals(Boolean.class) || Apple.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Apple.class.equals(Integer.class) || Apple.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Apple.class.equals(Float.class) || Apple.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Apple.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Apple.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Apple.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Apple'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Apple'", e); + } + + // deserialize Banana + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Banana.class.equals(Integer.class) || Banana.class.equals(Long.class) || Banana.class.equals(Float.class) || Banana.class.equals(Double.class) || Banana.class.equals(Boolean.class) || Banana.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Banana.class.equals(Integer.class) || Banana.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Banana.class.equals(Float.class) || Banana.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Banana.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Banana.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Banana.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Banana'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Banana'", e); + } + + if (match == 1) { + Fruit ret = new Fruit(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for Fruit: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Fruit getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Fruit cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Fruit() { + super("oneOf", Boolean.FALSE); + } + + public Fruit(Apple o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Fruit(Banana o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Apple", Apple.class); + schemas.put("Banana", Banana.class); + JSON.registerDescendants(Fruit.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return Fruit.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Apple, Banana + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Apple.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Banana.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } + + /** + * Get the actual instance, which can be the following: + * Apple, Banana + * + * @return The actual instance (Apple, Banana) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Apple`. If the actual instance is not `Apple`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Apple` + * @throws ClassCastException if the instance is not `Apple` + */ + public Apple getApple() throws ClassCastException { + return (Apple)super.getActualInstance(); + } + + /** + * Get the actual instance of `Banana`. If the actual instance is not `Banana`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Banana` + * @throws ClassCastException if the instance is not `Banana` + */ + public Banana getBanana() throws ClassCastException { + return (Banana)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FruitReq.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FruitReq.java new file mode 100644 index 000000000000..aef663ec802b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FruitReq.java @@ -0,0 +1,259 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = FruitReq.FruitReqDeserializer.class) +@JsonSerialize(using = FruitReq.FruitReqSerializer.class) +public class FruitReq extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FruitReq.class.getName()); + + + public static class FruitReqSerializer extends StdSerializer { + public FruitReqSerializer(Class t) { + super(t); + } + + public FruitReqSerializer() { + this(null); + } + + @Override + public void serialize(FruitReq value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + 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 { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize AppleReq + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AppleReq.class.equals(Integer.class) || AppleReq.class.equals(Long.class) || AppleReq.class.equals(Float.class) || AppleReq.class.equals(Double.class) || AppleReq.class.equals(Boolean.class) || AppleReq.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((AppleReq.class.equals(Integer.class) || AppleReq.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((AppleReq.class.equals(Float.class) || AppleReq.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (AppleReq.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (AppleReq.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(AppleReq.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'AppleReq'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AppleReq'", e); + } + + // deserialize BananaReq + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (BananaReq.class.equals(Integer.class) || BananaReq.class.equals(Long.class) || BananaReq.class.equals(Float.class) || BananaReq.class.equals(Double.class) || BananaReq.class.equals(Boolean.class) || BananaReq.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((BananaReq.class.equals(Integer.class) || BananaReq.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((BananaReq.class.equals(Float.class) || BananaReq.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (BananaReq.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (BananaReq.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(BananaReq.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'BananaReq'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'BananaReq'", e); + } + + if (match == 1) { + FruitReq ret = new FruitReq(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for FruitReq: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public FruitReq getNullValue(DeserializationContext ctxt) throws JsonMappingException { + return null; + } + } + + // store a list of schema names defined in oneOf + public static final 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", AppleReq.class); + schemas.put("BananaReq", BananaReq.class); + JSON.registerDescendants(FruitReq.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return FruitReq.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * AppleReq, BananaReq + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(AppleReq.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(BananaReq.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be AppleReq, BananaReq"); + } + + /** + * Get the actual instance, which can be the following: + * AppleReq, BananaReq + * + * @return The actual instance (AppleReq, BananaReq) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AppleReq`. If the actual instance is not `AppleReq`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `AppleReq` + * @throws ClassCastException if the instance is not `AppleReq` + */ + public AppleReq getAppleReq() throws ClassCastException { + return (AppleReq)super.getActualInstance(); + } + + /** + * Get the actual instance of `BananaReq`. If the actual instance is not `BananaReq`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BananaReq` + * @throws ClassCastException if the instance is not `BananaReq` + */ + public BananaReq getBananaReq() throws ClassCastException { + return (BananaReq)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GmFruit.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GmFruit.java new file mode 100644 index 000000000000..e10ae54d5749 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GmFruit.java @@ -0,0 +1,214 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = GmFruit.GmFruitDeserializer.class) +@JsonSerialize(using = GmFruit.GmFruitSerializer.class) +public class GmFruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GmFruit.class.getName()); + + + public static class GmFruitSerializer extends StdSerializer { + public GmFruitSerializer(Class t) { + super(t); + } + + public GmFruitSerializer() { + this(null); + } + + @Override + public void serialize(GmFruit value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + 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 { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + // deserialize Apple + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Apple.class); + GmFruit ret = new GmFruit(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Apple'", e); + } + + // deserialize Banana + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Banana.class); + GmFruit ret = new GmFruit(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Banana'", e); + } + + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for GmFruit: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public GmFruit getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "GmFruit cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> 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", Apple.class); + schemas.put("Banana", Banana.class); + JSON.registerDescendants(GmFruit.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return GmFruit.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Apple, Banana + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Apple.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Banana.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } + + /** + * Get the actual instance, which can be the following: + * Apple, Banana + * + * @return The actual instance (Apple, Banana) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Apple`. If the actual instance is not `Apple`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Apple` + * @throws ClassCastException if the instance is not `Apple` + */ + public Apple getApple() throws ClassCastException { + return (Apple)super.getActualInstance(); + } + + /** + * Get the actual instance of `Banana`. If the actual instance is not `Banana`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Banana` + * @throws ClassCastException if the instance is not `Banana` + */ + public Banana getBanana() throws ClassCastException { + return (Banana)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GrandparentAnimal.java new file mode 100644 index 000000000000..63cb68ffe0f3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -0,0 +1,182 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * GrandparentAnimal + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the pet_type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ParentPet.class, name = "ParentPet"), +}) + +@JsonPropertyOrder({ + GrandparentAnimal.JSON_PROPERTY_PET_TYPE +}) +@JsonTypeName("GrandparentAnimal") +public class GrandparentAnimal { + public static final String JSON_PROPERTY_PET_TYPE = "pet_type"; + @JsonProperty(JSON_PROPERTY_PET_TYPE) + @javax.annotation.Nonnull + protected String petType; + + public GrandparentAnimal() { + this.petType = this.getClass().getSimpleName(); + } + + public GrandparentAnimal petType(@javax.annotation.Nonnull String petType) { + this.petType = petType; + return this; + } + + /** + * Get petType + * @return petType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PET_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPetType() { + return petType; + } + + @JsonProperty(value = JSON_PROPERTY_PET_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPetType(@javax.annotation.Nonnull String petType) { + this.petType = petType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the GrandparentAnimal instance itself + */ + public GrandparentAnimal putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GrandparentAnimal {\n"); + sb.append(" petType: ").append(toIndentedString(petType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("pet_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("pet_type")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..c49db8e90a3c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * HasOnlyReadOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + HasOnlyReadOnly.JSON_PROPERTY_BAR, + HasOnlyReadOnly.JSON_PROPERTY_FOO +}) +@JsonTypeName("hasOnlyReadOnly") +public class HasOnlyReadOnly { + public static final String JSON_PROPERTY_BAR = "bar"; + @JsonProperty(JSON_PROPERTY_BAR) + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @javax.annotation.Nullable + private String bar; + + public static final String JSON_PROPERTY_FOO = "foo"; + @JsonProperty(JSON_PROPERTY_FOO) + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @javax.annotation.Nullable + private String foo; + + public HasOnlyReadOnly() { + } + + public HasOnlyReadOnly( + String bar, + String foo + ) { + this(); + this.bar = bar; + this.foo = foo; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BAR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + /** + * Get foo + * @return foo + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_FOO, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getFoo() { + return foo; + } + + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the HasOnlyReadOnly instance itself + */ + public HasOnlyReadOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar", "foo")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HealthCheckResult.java new file mode 100644 index 000000000000..11121074badb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -0,0 +1,184 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + HealthCheckResult.JSON_PROPERTY_NULLABLE_MESSAGE +}) +@JsonTypeName("HealthCheckResult") +public class HealthCheckResult { + public static final String JSON_PROPERTY_NULLABLE_MESSAGE = "NullableMessage"; + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) + @javax.annotation.Nullable + private String nullableMessage; + + public HealthCheckResult() { + } + + public HealthCheckResult nullableMessage(@javax.annotation.Nullable String nullableMessage) { + this.nullableMessage = nullableMessage; + return this; + } + + /** + * Get nullableMessage + * @return nullableMessage + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NULLABLE_MESSAGE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getNullableMessage() { + return nullableMessage; + } + + @JsonProperty(value = JSON_PROPERTY_NULLABLE_MESSAGE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNullableMessage(@javax.annotation.Nullable String nullableMessage) { + this.nullableMessage = nullableMessage; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the HealthCheckResult instance itself + */ + public HealthCheckResult putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("NullableMessage")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java new file mode 100644 index 000000000000..30b14216a418 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IsoscelesTriangle + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + IsoscelesTriangle.JSON_PROPERTY_SHAPE_TYPE, + IsoscelesTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) +@JsonTypeName("IsoscelesTriangle") +public class IsoscelesTriangle { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @javax.annotation.Nonnull + private String triangleType; + + public IsoscelesTriangle() { + } + + public IsoscelesTriangle shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public IsoscelesTriangle triangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTriangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IsoscelesTriangle instance itself + */ + public IsoscelesTriangle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Mammal.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Mammal.java new file mode 100644 index 000000000000..b293bcba31dd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Mammal.java @@ -0,0 +1,332 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Mammal.MammalDeserializer.class) +@JsonSerialize(using = Mammal.MammalSerializer.class) +public class Mammal extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Mammal.class.getName()); + + + public static class MammalSerializer extends StdSerializer { + public MammalSerializer(Class t) { + super(t); + } + + public MammalSerializer() { + this(null); + } + + @Override + public void serialize(Mammal value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + 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 { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + Mammal newMammal = new Mammal(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("className"); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "Pig": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Pig.class); + newMammal.setActualInstance(deserialized); + return newMammal; + case "whale": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Whale.class); + newMammal.setActualInstance(deserialized); + return newMammal; + case "zebra": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Zebra.class); + newMammal.setActualInstance(deserialized); + return newMammal; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Mammal. Possible values: Pig whale zebra", discriminatorValue)); + } + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Pig + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Pig.class.equals(Integer.class) || Pig.class.equals(Long.class) || Pig.class.equals(Float.class) || Pig.class.equals(Double.class) || Pig.class.equals(Boolean.class) || Pig.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Pig.class.equals(Integer.class) || Pig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Pig.class.equals(Float.class) || Pig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Pig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Pig.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Pig.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Pig'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Pig'", e); + } + + // deserialize Whale + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Whale.class.equals(Integer.class) || Whale.class.equals(Long.class) || Whale.class.equals(Float.class) || Whale.class.equals(Double.class) || Whale.class.equals(Boolean.class) || Whale.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Whale.class.equals(Integer.class) || Whale.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Whale.class.equals(Float.class) || Whale.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Whale.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Whale.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Whale.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Whale'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Whale'", e); + } + + // deserialize Zebra + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Zebra.class.equals(Integer.class) || Zebra.class.equals(Long.class) || Zebra.class.equals(Float.class) || Zebra.class.equals(Double.class) || Zebra.class.equals(Boolean.class) || Zebra.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Zebra.class.equals(Integer.class) || Zebra.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Zebra.class.equals(Float.class) || Zebra.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Zebra.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Zebra.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Zebra.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Zebra'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Zebra'", e); + } + + if (match == 1) { + Mammal ret = new Mammal(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for Mammal: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Mammal getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Mammal cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Mammal() { + super("oneOf", Boolean.FALSE); + } + + public Mammal(Pig o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Mammal(Whale o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Mammal(Zebra o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Pig", Pig.class); + schemas.put("Whale", Whale.class); + schemas.put("Zebra", Zebra.class); + JSON.registerDescendants(Mammal.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Pig", Pig.class); + mappings.put("whale", Whale.class); + mappings.put("zebra", Zebra.class); + mappings.put("mammal", Mammal.class); + JSON.registerDiscriminator(Mammal.class, "className", mappings); + } + + @Override + public Map> getSchemas() { + return Mammal.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Pig, Whale, Zebra + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Pig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Whale.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Zebra.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Pig, Whale, Zebra"); + } + + /** + * Get the actual instance, which can be the following: + * Pig, Whale, Zebra + * + * @return The actual instance (Pig, Whale, Zebra) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Pig`. If the actual instance is not `Pig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Pig` + * @throws ClassCastException if the instance is not `Pig` + */ + public Pig getPig() throws ClassCastException { + return (Pig)super.getActualInstance(); + } + + /** + * Get the actual instance of `Whale`. If the actual instance is not `Whale`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Whale` + * @throws ClassCastException if the instance is not `Whale` + */ + public Whale getWhale() throws ClassCastException { + return (Whale)super.getActualInstance(); + } + + /** + * Get the actual instance of `Zebra`. If the actual instance is not `Zebra`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Zebra` + * @throws ClassCastException if the instance is not `Zebra` + */ + public Zebra getZebra() throws ClassCastException { + return (Zebra)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MammalAnyof.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MammalAnyof.java new file mode 100644 index 000000000000..3acecac86d58 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MammalAnyof.java @@ -0,0 +1,264 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = MammalAnyof.MammalAnyofDeserializer.class) +@JsonSerialize(using = MammalAnyof.MammalAnyofSerializer.class) +public class MammalAnyof extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(MammalAnyof.class.getName()); + + + public static class MammalAnyofSerializer extends StdSerializer { + public MammalAnyofSerializer(Class t) { + super(t); + } + + public MammalAnyofSerializer() { + this(null); + } + + @Override + public void serialize(MammalAnyof value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class MammalAnyofDeserializer extends StdDeserializer { + public MammalAnyofDeserializer() { + this(MammalAnyof.class); + } + + public MammalAnyofDeserializer(Class vc) { + super(vc); + } + + @Override + public MammalAnyof deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + Class cls = JSON.getClassForElement(tree, new MammalAnyof().getClass()); + if (cls != null) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(cls); + MammalAnyof ret = new MammalAnyof(); + ret.setActualInstance(deserialized); + return ret; + } + // deserialize Pig + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Pig.class); + MammalAnyof ret = new MammalAnyof(); + ret.setActualInstance(deserialized); + return ret; + } 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); + MammalAnyof ret = new MammalAnyof(); + ret.setActualInstance(deserialized); + return ret; + } 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); + MammalAnyof ret = new MammalAnyof(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Zebra'", e); + } + + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for MammalAnyof: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public MammalAnyof getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "MammalAnyof cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public MammalAnyof() { + super("anyOf", Boolean.FALSE); + } + + public MammalAnyof(Pig o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public MammalAnyof(Whale o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public MammalAnyof(Zebra o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Pig", Pig.class); + schemas.put("Whale", Whale.class); + schemas.put("Zebra", Zebra.class); + JSON.registerDescendants(MammalAnyof.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Pig", Pig.class); + mappings.put("whale", Whale.class); + mappings.put("zebra", Zebra.class); + mappings.put("mammal_anyof", MammalAnyof.class); + JSON.registerDiscriminator(MammalAnyof.class, "className", mappings); + } + + @Override + public Map> getSchemas() { + return MammalAnyof.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Pig, Whale, Zebra + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Pig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Whale.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Zebra.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Pig, Whale, Zebra"); + } + + /** + * Get the actual instance, which can be the following: + * Pig, Whale, Zebra + * + * @return The actual instance (Pig, Whale, Zebra) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Pig`. If the actual instance is not `Pig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Pig` + * @throws ClassCastException if the instance is not `Pig` + */ + public Pig getPig() throws ClassCastException { + return (Pig)super.getActualInstance(); + } + + /** + * Get the actual instance of `Whale`. If the actual instance is not `Whale`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Whale` + * @throws ClassCastException if the instance is not `Whale` + */ + public Whale getWhale() throws ClassCastException { + return (Whale)super.getActualInstance(); + } + + /** + * Get the actual instance of `Zebra`. If the actual instance is not `Zebra`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Zebra` + * @throws ClassCastException if the instance is not `Zebra` + */ + public Zebra getZebra() throws ClassCastException { + return (Zebra)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MapTest.java new file mode 100644 index 000000000000..bf74f8741a6f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,332 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * MapTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("MapTest") +public class MapTest { + public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string"; + @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) + @javax.annotation.Nullable + private Map> mapMapOfString = new HashMap<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) + @javax.annotation.Nullable + private Map mapOfEnumString = new HashMap<>(); + + public static final String JSON_PROPERTY_DIRECT_MAP = "direct_map"; + @JsonProperty(JSON_PROPERTY_DIRECT_MAP) + @javax.annotation.Nullable + private Map directMap = new HashMap<>(); + + public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map"; + @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) + @javax.annotation.Nullable + private Map indirectMap = new HashMap<>(); + + public MapTest() { + } + + public MapTest mapMapOfString(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP_MAP_OF_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map> getMapMapOfString() { + return mapMapOfString; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_MAP_OF_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapMapOfString(@javax.annotation.Nullable Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + + public MapTest mapOfEnumString(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP_OF_ENUM_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_OF_ENUM_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapOfEnumString(@javax.annotation.Nullable Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + + public MapTest directMap(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_DIRECT_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getDirectMap() { + return directMap; + } + + @JsonProperty(value = JSON_PROPERTY_DIRECT_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDirectMap(@javax.annotation.Nullable Map directMap) { + this.directMap = directMap; + } + + + public MapTest indirectMap(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_INDIRECT_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getIndirectMap() { + return indirectMap; + } + + @JsonProperty(value = JSON_PROPERTY_INDIRECT_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIndirectMap(@javax.annotation.Nullable Map indirectMap) { + this.indirectMap = indirectMap; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MapTest instance itself + */ + public MapTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..44b18c7d617a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,244 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_MAP +}) +@JsonTypeName("MixedPropertiesAndAdditionalPropertiesClass") +public class MixedPropertiesAndAdditionalPropertiesClass { + public static final String JSON_PROPERTY_UUID = "uuid"; + @JsonProperty(JSON_PROPERTY_UUID) + @javax.annotation.Nullable + private UUID uuid; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @javax.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_MAP = "map"; + @JsonProperty(JSON_PROPERTY_MAP) + @javax.annotation.Nullable + private Map map = new HashMap<>(); + + public MixedPropertiesAndAdditionalPropertiesClass() { + } + + public MixedPropertiesAndAdditionalPropertiesClass uuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_UUID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuid() { + return uuid; + } + + @JsonProperty(value = JSON_PROPERTY_UUID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DATE_TIME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + @JsonProperty(value = JSON_PROPERTY_DATE_TIME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public MixedPropertiesAndAdditionalPropertiesClass map(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMap() { + return map; + } + + @JsonProperty(value = JSON_PROPERTY_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMap(@javax.annotation.Nullable Map map) { + this.map = map; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MixedPropertiesAndAdditionalPropertiesClass instance itself + */ + public MixedPropertiesAndAdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("uuid", "dateTime", "map")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Model200Response.java new file mode 100644 index 000000000000..e5d366c952db --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Model200Response.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model name starting with number + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Model200Response.JSON_PROPERTY_NAME, + Model200Response.JSON_PROPERTY_PROPERTY_CLASS +}) +@JsonTypeName("200_response") +public class Model200Response { + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nullable + private Integer name; + + public static final String JSON_PROPERTY_PROPERTY_CLASS = "class"; + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @javax.annotation.Nullable + private String propertyClass; + + public Model200Response() { + } + + public Model200Response name(@javax.annotation.Nullable Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable Integer name) { + this.name = name; + } + + + public Model200Response propertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PROPERTY_CLASS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPropertyClass() { + return propertyClass; + } + + @JsonProperty(value = JSON_PROPERTY_PROPERTY_CLASS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Model200Response instance itself + */ + public Model200Response putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "class")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..17dd00b0e149 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,231 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelApiResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) +@JsonTypeName("ApiResponse") +public class ModelApiResponse { + public static final String JSON_PROPERTY_CODE = "code"; + @JsonProperty(JSON_PROPERTY_CODE) + @javax.annotation.Nullable + private Integer code; + + public static final String JSON_PROPERTY_TYPE = "type"; + @JsonProperty(JSON_PROPERTY_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + @JsonProperty(JSON_PROPERTY_MESSAGE) + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getCode() { + return code; + } + + @JsonProperty(value = JSON_PROPERTY_CODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MESSAGE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMessage() { + return message; + } + + @JsonProperty(value = JSON_PROPERTY_MESSAGE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("code", "type", "message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelFile.java new file mode 100644 index 000000000000..203a61b27ee2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelFile.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Must be named `File` for test. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ModelFile.JSON_PROPERTY_SOURCE_U_R_I +}) +@JsonTypeName("File") +public class ModelFile { + public static final String JSON_PROPERTY_SOURCE_U_R_I = "sourceURI"; + @JsonProperty(JSON_PROPERTY_SOURCE_U_R_I) + @javax.annotation.Nullable + private String sourceURI; + + public ModelFile() { + } + + public ModelFile sourceURI(@javax.annotation.Nullable String sourceURI) { + this.sourceURI = sourceURI; + return this; + } + + /** + * Test capitalization + * @return sourceURI + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SOURCE_U_R_I, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSourceURI() { + return sourceURI; + } + + @JsonProperty(value = JSON_PROPERTY_SOURCE_U_R_I, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSourceURI(@javax.annotation.Nullable String sourceURI) { + this.sourceURI = sourceURI; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelFile instance itself + */ + public ModelFile putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelFile {\n"); + sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("sourceURI")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelList.java new file mode 100644 index 000000000000..6ce2a025f709 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelList.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ModelList.JSON_PROPERTY_123LIST +}) +@JsonTypeName("List") +public class ModelList { + public static final String JSON_PROPERTY_123LIST = "123-list"; + @JsonProperty(JSON_PROPERTY_123LIST) + @javax.annotation.Nullable + private String _123list; + + public ModelList() { + } + + public ModelList _123list(@javax.annotation.Nullable String _123list) { + this._123list = _123list; + return this; + } + + /** + * Get _123list + * @return _123list + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_123LIST, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String get123list() { + return _123list; + } + + @JsonProperty(value = JSON_PROPERTY_123LIST, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void set123list(@javax.annotation.Nullable String _123list) { + this._123list = _123list; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelList instance itself + */ + public ModelList putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelList {\n"); + sb.append(" _123list: ").append(toIndentedString(_123list)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("123-list")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelReturn.java new file mode 100644 index 000000000000..d088af9105fc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing reserved words + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ModelReturn.JSON_PROPERTY_RETURN +}) +@JsonTypeName("Return") +public class ModelReturn { + public static final String JSON_PROPERTY_RETURN = "return"; + @JsonProperty(JSON_PROPERTY_RETURN) + @javax.annotation.Nullable + private Integer _return; + + public ModelReturn() { + } + + public ModelReturn _return(@javax.annotation.Nullable Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_RETURN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getReturn() { + return _return; + } + + @JsonProperty(value = JSON_PROPERTY_RETURN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReturn(@javax.annotation.Nullable Integer _return) { + this._return = _return; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelReturn instance itself + */ + public ModelReturn putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("return")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java new file mode 100644 index 000000000000..38a7644c5816 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java @@ -0,0 +1,202 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.ArrayAnyOf; +import org.openapitools.client.model.ArrayOneOf; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelWithOneOfAnyOfProperties + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ModelWithOneOfAnyOfProperties.JSON_PROPERTY_ONEOF_PROP, + ModelWithOneOfAnyOfProperties.JSON_PROPERTY_ANYOF_PROP +}) +@JsonTypeName("ModelWithOneOfAnyOfProperties") +public class ModelWithOneOfAnyOfProperties { + public static final String JSON_PROPERTY_ONEOF_PROP = "oneof_prop"; + @JsonProperty(JSON_PROPERTY_ONEOF_PROP) + @javax.annotation.Nullable + private ArrayOneOf oneofProp; + + public static final String JSON_PROPERTY_ANYOF_PROP = "anyof_prop"; + @JsonProperty(JSON_PROPERTY_ANYOF_PROP) + @javax.annotation.Nullable + private ArrayAnyOf anyofProp; + + public ModelWithOneOfAnyOfProperties() { + } + + public ModelWithOneOfAnyOfProperties oneofProp(@javax.annotation.Nullable ArrayOneOf oneofProp) { + this.oneofProp = oneofProp; + return this; + } + + /** + * Get oneofProp + * @return oneofProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ONEOF_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ArrayOneOf getOneofProp() { + return oneofProp; + } + + @JsonProperty(value = JSON_PROPERTY_ONEOF_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOneofProp(@javax.annotation.Nullable ArrayOneOf oneofProp) { + this.oneofProp = oneofProp; + } + + + public ModelWithOneOfAnyOfProperties anyofProp(@javax.annotation.Nullable ArrayAnyOf anyofProp) { + this.anyofProp = anyofProp; + return this; + } + + /** + * Get anyofProp + * @return anyofProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ANYOF_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ArrayAnyOf getAnyofProp() { + return anyofProp; + } + + @JsonProperty(value = JSON_PROPERTY_ANYOF_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAnyofProp(@javax.annotation.Nullable ArrayAnyOf anyofProp) { + this.anyofProp = anyofProp; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelWithOneOfAnyOfProperties instance itself + */ + public ModelWithOneOfAnyOfProperties putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelWithOneOfAnyOfProperties {\n"); + sb.append(" oneofProp: ").append(toIndentedString(oneofProp)).append("\n"); + sb.append(" anyofProp: ").append(toIndentedString(anyofProp)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("oneof_prop", "anyof_prop")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Name.java new file mode 100644 index 000000000000..76b870a31a90 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Name.java @@ -0,0 +1,253 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model name same as property name + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Name.JSON_PROPERTY_NAME, + Name.JSON_PROPERTY_SNAKE_CASE, + Name.JSON_PROPERTY_PROPERTY, + Name.JSON_PROPERTY_123NUMBER +}) +@JsonTypeName("Name") +public class Name { + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private Integer name; + + public static final String JSON_PROPERTY_SNAKE_CASE = "snake_case"; + @JsonProperty(JSON_PROPERTY_SNAKE_CASE) + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @javax.annotation.Nullable + private Integer snakeCase; + + public static final String JSON_PROPERTY_PROPERTY = "property"; + @JsonProperty(JSON_PROPERTY_PROPERTY) + @javax.annotation.Nullable + private String property; + + public static final String JSON_PROPERTY_123NUMBER = "123Number"; + @JsonProperty(JSON_PROPERTY_123NUMBER) + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @javax.annotation.Nullable + private Integer _123number; + + public Name() { + } + + public Name( + Integer snakeCase, + Integer _123number + ) { + this(); + this.snakeCase = snakeCase; + this._123number = _123number; + } + + public Name name(@javax.annotation.Nonnull Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull Integer name) { + this.name = name; + } + + + /** + * Get snakeCase + * @return snakeCase + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SNAKE_CASE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getSnakeCase() { + return snakeCase; + } + + + + public Name property(@javax.annotation.Nullable String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getProperty() { + return property; + } + + @JsonProperty(value = JSON_PROPERTY_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setProperty(@javax.annotation.Nullable String property) { + this.property = property; + } + + + /** + * Get _123number + * @return _123number + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_123NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer get123number() { + return _123number; + } + + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Name instance itself + */ + public Name putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "snake_case", "property", "123Number")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java new file mode 100644 index 000000000000..cabe50bf5061 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java @@ -0,0 +1,180 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NestedArrayWithDefaultValues + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NestedArrayWithDefaultValues.JSON_PROPERTY_NESTED_ARRAY +}) +@JsonTypeName("NestedArrayWithDefaultValues") +public class NestedArrayWithDefaultValues { + public static final String JSON_PROPERTY_NESTED_ARRAY = "nestedArray"; + @JsonProperty(JSON_PROPERTY_NESTED_ARRAY) + @javax.annotation.Nullable + private List> nestedArray; + + public NestedArrayWithDefaultValues() { + } + + public NestedArrayWithDefaultValues nestedArray(@javax.annotation.Nullable List> nestedArray) { + this.nestedArray = nestedArray; + return this; + } + + public NestedArrayWithDefaultValues addNestedArrayItem(List nestedArrayItem) { + if (this.nestedArray == null) { + this.nestedArray = new ArrayList<>(); + } + this.nestedArray.add(nestedArrayItem); + return this; + } + + /** + * Get nestedArray + * @return nestedArray + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NESTED_ARRAY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getNestedArray() { + return nestedArray; + } + + @JsonProperty(value = JSON_PROPERTY_NESTED_ARRAY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNestedArray(@javax.annotation.Nullable List> nestedArray) { + this.nestedArray = nestedArray; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NestedArrayWithDefaultValues instance itself + */ + public NestedArrayWithDefaultValues putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NestedArrayWithDefaultValues {\n"); + sb.append(" nestedArray: ").append(toIndentedString(nestedArray)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("nestedArray")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPet.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPet.java new file mode 100644 index 000000000000..76a462ad38df --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPet.java @@ -0,0 +1,475 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.NewPetCategoryInlineAllof; +import org.openapitools.client.model.Tag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NewPet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NewPet.JSON_PROPERTY_ID, + NewPet.JSON_PROPERTY_CATEGORY_INLINE_ALLOF, + NewPet.JSON_PROPERTY_CATEGORY_ALL_OF_REF, + NewPet.JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION, + NewPet.JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION_READONLY, + NewPet.JSON_PROPERTY_NAME, + NewPet.JSON_PROPERTY_PHOTO_URLS, + NewPet.JSON_PROPERTY_TAGS, + NewPet.JSON_PROPERTY_STATUS +}) +@JsonTypeName("NewPet") +public class NewPet { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY_INLINE_ALLOF = "category_inline_allof"; + @JsonProperty(JSON_PROPERTY_CATEGORY_INLINE_ALLOF) + @javax.annotation.Nullable + private NewPetCategoryInlineAllof categoryInlineAllof; + + public static final String JSON_PROPERTY_CATEGORY_ALL_OF_REF = "category_allOf_ref"; + @JsonProperty(JSON_PROPERTY_CATEGORY_ALL_OF_REF) + @javax.annotation.Nullable + private Category categoryAllOfRef; + + public static final String JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION = "category_allOf_ref_description"; + @JsonProperty(JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION) + @javax.annotation.Nullable + private Category categoryAllOfRefDescription; + + public static final String JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION_READONLY = "category_allOf_ref_description_readonly"; + @JsonProperty(JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION_READONLY) + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @javax.annotation.Nullable + private Category categoryAllOfRefDescriptionReadonly; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @JsonProperty(JSON_PROPERTY_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public NewPet() { + } + + public NewPet( + Category categoryAllOfRefDescriptionReadonly + ) { + this(); + this.categoryAllOfRefDescriptionReadonly = categoryAllOfRefDescriptionReadonly; + } + + public NewPet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public NewPet categoryInlineAllof(@javax.annotation.Nullable NewPetCategoryInlineAllof categoryInlineAllof) { + this.categoryInlineAllof = categoryInlineAllof; + return this; + } + + /** + * Get categoryInlineAllof + * @return categoryInlineAllof + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY_INLINE_ALLOF, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public NewPetCategoryInlineAllof getCategoryInlineAllof() { + return categoryInlineAllof; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY_INLINE_ALLOF, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategoryInlineAllof(@javax.annotation.Nullable NewPetCategoryInlineAllof categoryInlineAllof) { + this.categoryInlineAllof = categoryInlineAllof; + } + + + public NewPet categoryAllOfRef(@javax.annotation.Nullable Category categoryAllOfRef) { + this.categoryAllOfRef = categoryAllOfRef; + return this; + } + + /** + * Get categoryAllOfRef + * @return categoryAllOfRef + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY_ALL_OF_REF, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategoryAllOfRef() { + return categoryAllOfRef; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY_ALL_OF_REF, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategoryAllOfRef(@javax.annotation.Nullable Category categoryAllOfRef) { + this.categoryAllOfRef = categoryAllOfRef; + } + + + public NewPet categoryAllOfRefDescription(@javax.annotation.Nullable Category categoryAllOfRefDescription) { + this.categoryAllOfRefDescription = categoryAllOfRefDescription; + return this; + } + + /** + * Adding description to property using allOf + * @return categoryAllOfRefDescription + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategoryAllOfRefDescription() { + return categoryAllOfRefDescription; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategoryAllOfRefDescription(@javax.annotation.Nullable Category categoryAllOfRefDescription) { + this.categoryAllOfRefDescription = categoryAllOfRefDescription; + } + + + /** + * Adding description to readonly property using allOf + * @return categoryAllOfRefDescriptionReadonly + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION_READONLY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategoryAllOfRefDescriptionReadonly() { + return categoryAllOfRefDescriptionReadonly; + } + + + + public NewPet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public NewPet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public NewPet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public NewPet tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public NewPet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public NewPet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NewPet instance itself + */ + public NewPet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewPet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" categoryInlineAllof: ").append(toIndentedString(categoryInlineAllof)).append("\n"); + sb.append(" categoryAllOfRef: ").append(toIndentedString(categoryAllOfRef)).append("\n"); + sb.append(" categoryAllOfRefDescription: ").append(toIndentedString(categoryAllOfRefDescription)).append("\n"); + sb.append(" categoryAllOfRefDescriptionReadonly: ").append(toIndentedString(categoryAllOfRefDescriptionReadonly)).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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category_inline_allof", "category_allOf_ref", "category_allOf_ref_description", "category_allOf_ref_description_readonly", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java new file mode 100644 index 000000000000..20d65250a16d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java @@ -0,0 +1,232 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.NewPetCategoryInlineAllofAllOfCategoryTag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NewPetCategoryInlineAllof + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NewPetCategoryInlineAllof.JSON_PROPERTY_ID, + NewPetCategoryInlineAllof.JSON_PROPERTY_NAME, + NewPetCategoryInlineAllof.JSON_PROPERTY_CATEGORY_TAG +}) +@JsonTypeName("NewPet_category_inline_allof") +public class NewPetCategoryInlineAllof { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name = "default-name"; + + public static final String JSON_PROPERTY_CATEGORY_TAG = "category_tag"; + @JsonProperty(JSON_PROPERTY_CATEGORY_TAG) + @javax.annotation.Nullable + private NewPetCategoryInlineAllofAllOfCategoryTag categoryTag; + + public NewPetCategoryInlineAllof() { + } + + public NewPetCategoryInlineAllof id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public NewPetCategoryInlineAllof name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public NewPetCategoryInlineAllof categoryTag(@javax.annotation.Nullable NewPetCategoryInlineAllofAllOfCategoryTag categoryTag) { + this.categoryTag = categoryTag; + return this; + } + + /** + * Get categoryTag + * @return categoryTag + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY_TAG, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public NewPetCategoryInlineAllofAllOfCategoryTag getCategoryTag() { + return categoryTag; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY_TAG, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategoryTag(@javax.annotation.Nullable NewPetCategoryInlineAllofAllOfCategoryTag categoryTag) { + this.categoryTag = categoryTag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NewPetCategoryInlineAllof instance itself + */ + public NewPetCategoryInlineAllof putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewPetCategoryInlineAllof {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" categoryTag: ").append(toIndentedString(categoryTag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name", "category_tag")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java new file mode 100644 index 000000000000..8dc723a2c0f2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NewPetCategoryInlineAllofAllOfCategoryTag + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NewPetCategoryInlineAllofAllOfCategoryTag.JSON_PROPERTY_ID, + NewPetCategoryInlineAllofAllOfCategoryTag.JSON_PROPERTY_NAME +}) +@JsonTypeName("NewPet_category_inline_allof_allOf_category_tag") +public class NewPetCategoryInlineAllofAllOfCategoryTag { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nullable + private String name; + + public NewPetCategoryInlineAllofAllOfCategoryTag() { + } + + public NewPetCategoryInlineAllofAllOfCategoryTag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public NewPetCategoryInlineAllofAllOfCategoryTag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NewPetCategoryInlineAllofAllOfCategoryTag instance itself + */ + public NewPetCategoryInlineAllofAllOfCategoryTag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewPetCategoryInlineAllofAllOfCategoryTag {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableClass.java new file mode 100644 index 000000000000..95d86a18c506 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableClass.java @@ -0,0 +1,581 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NullableClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("NullableClass") +public class NullableClass { + public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + @javax.annotation.Nullable + private Integer integerProp; + + public static final String JSON_PROPERTY_NUMBER_PROP = "number_prop"; + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + @javax.annotation.Nullable + private BigDecimal numberProp; + + public static final String JSON_PROPERTY_BOOLEAN_PROP = "boolean_prop"; + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + @javax.annotation.Nullable + private Boolean booleanProp; + + public static final String JSON_PROPERTY_STRING_PROP = "string_prop"; + @JsonProperty(JSON_PROPERTY_STRING_PROP) + @javax.annotation.Nullable + private String stringProp; + + public static final String JSON_PROPERTY_DATE_PROP = "date_prop"; + @JsonProperty(JSON_PROPERTY_DATE_PROP) + @javax.annotation.Nullable + private LocalDate dateProp; + + public static final String JSON_PROPERTY_DATETIME_PROP = "datetime_prop"; + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + @javax.annotation.Nullable + private OffsetDateTime datetimeProp; + + public static final String JSON_PROPERTY_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + @javax.annotation.Nullable + private List arrayNullableProp; + + public static final String JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + @javax.annotation.Nullable + private List arrayAndItemsNullableProp; + + public static final String JSON_PROPERTY_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + @JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE) + @javax.annotation.Nullable + private List arrayItemsNullable = new ArrayList<>(); + + public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + @javax.annotation.Nullable + private Map objectNullableProp; + + public static final String JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + @javax.annotation.Nullable + private Map objectAndItemsNullableProp; + + public static final String JSON_PROPERTY_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + @JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE) + @javax.annotation.Nullable + private Map objectItemsNullable = new HashMap<>(); + + public NullableClass() { + } + + public NullableClass integerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + return this; + } + + /** + * Get integerProp + * @return integerProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_INTEGER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getIntegerProp() { + return integerProp; + } + + @JsonProperty(value = JSON_PROPERTY_INTEGER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIntegerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + } + + + public NullableClass numberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + return this; + } + + /** + * Get numberProp + * @return numberProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NUMBER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getNumberProp() { + return numberProp; + } + + @JsonProperty(value = JSON_PROPERTY_NUMBER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNumberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + } + + + public NullableClass booleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + return this; + } + + /** + * Get booleanProp + * @return booleanProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BOOLEAN_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getBooleanProp() { + return booleanProp; + } + + @JsonProperty(value = JSON_PROPERTY_BOOLEAN_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBooleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + } + + + public NullableClass stringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + return this; + } + + /** + * Get stringProp + * @return stringProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STRING_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getStringProp() { + return stringProp; + } + + @JsonProperty(value = JSON_PROPERTY_STRING_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + } + + + public NullableClass dateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + return this; + } + + /** + * Get dateProp + * @return dateProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DATE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public LocalDate getDateProp() { + return dateProp; + } + + @JsonProperty(value = JSON_PROPERTY_DATE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + } + + + public NullableClass datetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DATETIME_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDatetimeProp() { + return datetimeProp; + } + + @JsonProperty(value = JSON_PROPERTY_DATETIME_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDatetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + } + + + public NullableClass arrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + return this; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null) { + this.arrayNullableProp = new ArrayList<>(); + } + this.arrayNullableProp.add(arrayNullablePropItem); + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ARRAY_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayNullableProp() { + return arrayNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + + public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null) { + this.arrayAndItemsNullableProp = new ArrayList<>(); + } + this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem); + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + + public NullableClass arrayItemsNullable(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayItemsNullable(@javax.annotation.Nullable List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + + public NullableClass objectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + return this; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null) { + this.objectNullableProp = new HashMap<>(); + } + this.objectNullableProp.put(key, objectNullablePropItem); + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OBJECT_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getObjectNullableProp() { + return objectNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setObjectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + + public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null) { + this.objectAndItemsNullableProp = new HashMap<>(); + } + this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem); + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public void setObjectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + + public NullableClass objectItemsNullable(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_OBJECT_ITEMS_NULLABLE, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_ITEMS_NULLABLE, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public void setObjectItemsNullable(@javax.annotation.Nullable Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableClass instance itself + */ + public NullableClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableEnum.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableEnum.java new file mode 100644 index 000000000000..ba51d9f2c263 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableEnum.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets NullableEnum + */ +public enum NullableEnum { + + CUSTOM("custom"); + + private String value; + + NullableEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static NullableEnum fromValue(String value) { + for (NullableEnum b : NullableEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java new file mode 100644 index 000000000000..6a064949eeb0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Error response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NullableFieldsMapError.JSON_PROPERTY_STATUS, + NullableFieldsMapError.JSON_PROPERTY_REASON +}) +@JsonTypeName("NullableFieldsMapError") +public class NullableFieldsMapError { + public static final String JSON_PROPERTY_STATUS = "status"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String JSON_PROPERTY_REASON = "reason"; + @JsonProperty(JSON_PROPERTY_REASON) + @javax.annotation.Nonnull + private String reason; + + public NullableFieldsMapError() { + } + + public NullableFieldsMapError status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + + public NullableFieldsMapError reason(@javax.annotation.Nonnull String reason) { + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_REASON, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getReason() { + return reason; + } + + @JsonProperty(value = JSON_PROPERTY_REASON, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setReason(@javax.annotation.Nonnull String reason) { + this.reason = reason; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsMapError instance itself + */ + public NullableFieldsMapError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableFieldsMapError {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("status", "reason")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status", "reason")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java new file mode 100644 index 000000000000..8ebd2533c979 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java @@ -0,0 +1,216 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsMapError; +import org.openapitools.client.model.NullableFieldsMapSuccess; +import org.openapitools.client.model.NullableFieldsValue; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = NullableFieldsMapResponse.NullableFieldsMapResponseDeserializer.class) +@JsonSerialize(using = NullableFieldsMapResponse.NullableFieldsMapResponseSerializer.class) +public class NullableFieldsMapResponse extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(NullableFieldsMapResponse.class.getName()); + + + public static class NullableFieldsMapResponseSerializer extends StdSerializer { + public NullableFieldsMapResponseSerializer(Class t) { + super(t); + } + + public NullableFieldsMapResponseSerializer() { + this(null); + } + + @Override + public void serialize(NullableFieldsMapResponse value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class NullableFieldsMapResponseDeserializer extends StdDeserializer { + public NullableFieldsMapResponseDeserializer() { + this(NullableFieldsMapResponse.class); + } + + public NullableFieldsMapResponseDeserializer(Class vc) { + super(vc); + } + + @Override + public NullableFieldsMapResponse deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + // deserialize NullableFieldsMapError + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(NullableFieldsMapError.class); + NullableFieldsMapResponse ret = new NullableFieldsMapResponse(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'NullableFieldsMapError'", e); + } + + // deserialize NullableFieldsMapSuccess + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(NullableFieldsMapSuccess.class); + NullableFieldsMapResponse ret = new NullableFieldsMapResponse(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'NullableFieldsMapSuccess'", e); + } + + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for NullableFieldsMapResponse: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public NullableFieldsMapResponse getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "NullableFieldsMapResponse cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public NullableFieldsMapResponse() { + super("anyOf", Boolean.FALSE); + } + + public NullableFieldsMapResponse(NullableFieldsMapError o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public NullableFieldsMapResponse(NullableFieldsMapSuccess o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("NullableFieldsMapError", NullableFieldsMapError.class); + schemas.put("NullableFieldsMapSuccess", NullableFieldsMapSuccess.class); + JSON.registerDescendants(NullableFieldsMapResponse.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return NullableFieldsMapResponse.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * NullableFieldsMapError, NullableFieldsMapSuccess + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(NullableFieldsMapError.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(NullableFieldsMapSuccess.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be NullableFieldsMapError, NullableFieldsMapSuccess"); + } + + /** + * Get the actual instance, which can be the following: + * NullableFieldsMapError, NullableFieldsMapSuccess + * + * @return The actual instance (NullableFieldsMapError, NullableFieldsMapSuccess) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `NullableFieldsMapError`. If the actual instance is not `NullableFieldsMapError`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `NullableFieldsMapError` + * @throws ClassCastException if the instance is not `NullableFieldsMapError` + */ + public NullableFieldsMapError getNullableFieldsMapError() throws ClassCastException { + return (NullableFieldsMapError)super.getActualInstance(); + } + + /** + * Get the actual instance of `NullableFieldsMapSuccess`. If the actual instance is not `NullableFieldsMapSuccess`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `NullableFieldsMapSuccess` + * @throws ClassCastException if the instance is not `NullableFieldsMapSuccess` + */ + public NullableFieldsMapSuccess getNullableFieldsMapSuccess() throws ClassCastException { + return (NullableFieldsMapSuccess)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java new file mode 100644 index 000000000000..4058e725b9b8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java @@ -0,0 +1,211 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Success response containing a map of objects with nullable fields + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NullableFieldsMapSuccess.JSON_PROPERTY_STATUS, + NullableFieldsMapSuccess.JSON_PROPERTY_POSITIONS +}) +@JsonTypeName("NullableFieldsMapSuccess") +public class NullableFieldsMapSuccess { + public static final String JSON_PROPERTY_STATUS = "status"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String JSON_PROPERTY_POSITIONS = "positions"; + @JsonProperty(JSON_PROPERTY_POSITIONS) + @javax.annotation.Nonnull + private Map positions; + + public NullableFieldsMapSuccess() { + } + + public NullableFieldsMapSuccess status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + + public NullableFieldsMapSuccess positions(@javax.annotation.Nonnull Map positions) { + this.positions = positions; + return this; + } + + public NullableFieldsMapSuccess putPositionsItem(String key, NullableFieldsValue positionsItem) { + if (this.positions == null) { + this.positions = new HashMap<>(); + } + this.positions.put(key, positionsItem); + return this; + } + + /** + * Get positions + * @return positions + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_POSITIONS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Map getPositions() { + return positions; + } + + @JsonProperty(value = JSON_PROPERTY_POSITIONS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPositions(@javax.annotation.Nonnull Map positions) { + this.positions = positions; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsMapSuccess instance itself + */ + public NullableFieldsMapSuccess putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableFieldsMapSuccess {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" positions: ").append(toIndentedString(positions)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("status", "positions")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status", "positions")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsValue.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsValue.java new file mode 100644 index 000000000000..ef8499dabe52 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsValue.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with required but nullable string fields + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NullableFieldsValue.JSON_PROPERTY_BEFORE, + NullableFieldsValue.JSON_PROPERTY_AFTER +}) +@JsonTypeName("NullableFieldsValue") +public class NullableFieldsValue { + public static final String JSON_PROPERTY_BEFORE = "before"; + @JsonProperty(JSON_PROPERTY_BEFORE) + @javax.annotation.Nullable + private String before; + + public static final String JSON_PROPERTY_AFTER = "after"; + @JsonProperty(JSON_PROPERTY_AFTER) + @javax.annotation.Nullable + private String after; + + public NullableFieldsValue() { + } + + public NullableFieldsValue before(@javax.annotation.Nullable String before) { + this.before = before; + return this; + } + + /** + * Get before + * @return before + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BEFORE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getBefore() { + return before; + } + + @JsonProperty(value = JSON_PROPERTY_BEFORE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setBefore(@javax.annotation.Nullable String before) { + this.before = before; + } + + + public NullableFieldsValue after(@javax.annotation.Nullable String after) { + this.after = after; + return this; + } + + /** + * Get after + * @return after + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_AFTER, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAfter() { + return after; + } + + @JsonProperty(value = JSON_PROPERTY_AFTER, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAfter(@javax.annotation.Nullable String after) { + this.after = after; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsValue instance itself + */ + public NullableFieldsValue putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableFieldsValue {\n"); + sb.append(" before: ").append(toIndentedString(before)).append("\n"); + sb.append(" after: ").append(toIndentedString(after)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("before", "after")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("before", "after")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableShape.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableShape.java new file mode 100644 index 000000000000..d221210bfb58 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableShape.java @@ -0,0 +1,285 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = NullableShape.NullableShapeDeserializer.class) +@JsonSerialize(using = NullableShape.NullableShapeSerializer.class) +public class NullableShape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(NullableShape.class.getName()); + + + public static class NullableShapeSerializer extends StdSerializer { + public NullableShapeSerializer(Class t) { + super(t); + } + + public NullableShapeSerializer() { + this(null); + } + + @Override + public void serialize(NullableShape value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + 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 { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + NullableShape newNullableShape = new NullableShape(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("shapeType"); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "Quadrilateral": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + newNullableShape.setActualInstance(deserialized); + return newNullableShape; + case "Triangle": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + newNullableShape.setActualInstance(deserialized); + return newNullableShape; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for NullableShape. Possible values: Quadrilateral Triangle", discriminatorValue)); + } + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Quadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + // deserialize Triangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + if (match == 1) { + NullableShape ret = new NullableShape(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for NullableShape: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public NullableShape getNullValue(DeserializationContext ctxt) throws JsonMappingException { + return null; + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public NullableShape() { + super("oneOf", Boolean.TRUE); + } + + public NullableShape(Quadrilateral o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + public NullableShape(Triangle o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + static { + schemas.put("Quadrilateral", Quadrilateral.class); + schemas.put("Triangle", Triangle.class); + JSON.registerDescendants(NullableShape.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Quadrilateral", Quadrilateral.class); + mappings.put("Triangle", Triangle.class); + mappings.put("NullableShape", NullableShape.class); + JSON.registerDiscriminator(NullableShape.class, "shapeType", mappings); + } + + @Override + public Map> getSchemas() { + return NullableShape.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NumberOnly.java new file mode 100644 index 000000000000..360fdeb4b9c8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -0,0 +1,170 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NumberOnly.JSON_PROPERTY_JUST_NUMBER +}) +@JsonTypeName("NumberOnly") +public class NumberOnly { + public static final String JSON_PROPERTY_JUST_NUMBER = "JustNumber"; + @JsonProperty(JSON_PROPERTY_JUST_NUMBER) + @javax.annotation.Nullable + private BigDecimal justNumber; + + public NumberOnly() { + } + + public NumberOnly justNumber(@javax.annotation.Nullable BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_JUST_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getJustNumber() { + return justNumber; + } + + @JsonProperty(value = JSON_PROPERTY_JUST_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setJustNumber(@javax.annotation.Nullable BigDecimal justNumber) { + this.justNumber = justNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NumberOnly instance itself + */ + public NumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("JustNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java new file mode 100644 index 000000000000..2a8d8c3e614e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -0,0 +1,290 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.DeprecatedObject; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ObjectWithDeprecatedFields + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ObjectWithDeprecatedFields.JSON_PROPERTY_UUID, + ObjectWithDeprecatedFields.JSON_PROPERTY_ID, + ObjectWithDeprecatedFields.JSON_PROPERTY_DEPRECATED_REF, + ObjectWithDeprecatedFields.JSON_PROPERTY_BARS +}) +@JsonTypeName("ObjectWithDeprecatedFields") +public class ObjectWithDeprecatedFields { + public static final String JSON_PROPERTY_UUID = "uuid"; + @JsonProperty(JSON_PROPERTY_UUID) + @javax.annotation.Nullable + private String uuid; + + public static final String JSON_PROPERTY_ID = "id"; + @Deprecated + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private BigDecimal id; + + public static final String JSON_PROPERTY_DEPRECATED_REF = "deprecatedRef"; + @Deprecated + @JsonProperty(JSON_PROPERTY_DEPRECATED_REF) + @javax.annotation.Nullable + private DeprecatedObject deprecatedRef; + + public static final String JSON_PROPERTY_BARS = "bars"; + @Deprecated + @JsonProperty(JSON_PROPERTY_BARS) + @javax.annotation.Nullable + private List bars = new ArrayList<>(); + + public ObjectWithDeprecatedFields() { + } + + public ObjectWithDeprecatedFields uuid(@javax.annotation.Nullable String uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_UUID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUuid() { + return uuid; + } + + @JsonProperty(value = JSON_PROPERTY_UUID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuid(@javax.annotation.Nullable String uuid) { + this.uuid = uuid; + } + + + @Deprecated + public ObjectWithDeprecatedFields id(@javax.annotation.Nullable BigDecimal id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getId() { + return id; + } + + @Deprecated + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable BigDecimal id) { + this.id = id; + } + + + @Deprecated + public ObjectWithDeprecatedFields deprecatedRef(@javax.annotation.Nullable DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return this; + } + + /** + * Get deprecatedRef + * @return deprecatedRef + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DEPRECATED_REF, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public DeprecatedObject getDeprecatedRef() { + return deprecatedRef; + } + + @Deprecated + @JsonProperty(value = JSON_PROPERTY_DEPRECATED_REF, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeprecatedRef(@javax.annotation.Nullable DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + } + + + @Deprecated + public ObjectWithDeprecatedFields bars(@javax.annotation.Nullable List bars) { + this.bars = bars; + return this; + } + + public ObjectWithDeprecatedFields addBarsItem(String barsItem) { + if (this.bars == null) { + this.bars = new ArrayList<>(); + } + this.bars.add(barsItem); + return this; + } + + /** + * Get bars + * @return bars + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BARS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getBars() { + return bars; + } + + @Deprecated + @JsonProperty(value = JSON_PROPERTY_BARS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBars(@javax.annotation.Nullable List bars) { + this.bars = bars; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ObjectWithDeprecatedFields instance itself + */ + public ObjectWithDeprecatedFields putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObjectWithDeprecatedFields {\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" deprecatedRef: ").append(toIndentedString(deprecatedRef)).append("\n"); + sb.append(" bars: ").append(toIndentedString(bars)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("uuid", "id", "deprecatedRef", "bars")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..b61b3be46da7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,363 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Order + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("Order") +public class Order { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_PET_ID = "petId"; + @JsonProperty(JSON_PROPERTY_PET_ID) + @javax.annotation.Nullable + private Long petId; + + public static final String JSON_PROPERTY_QUANTITY = "quantity"; + @JsonProperty(JSON_PROPERTY_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @javax.annotation.Nullable + 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + @JsonProperty(JSON_PROPERTY_COMPLETE) + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PET_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getPetId() { + return petId; + } + + @JsonProperty(value = JSON_PROPERTY_PET_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_QUANTITY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getQuantity() { + return quantity; + } + + @JsonProperty(value = JSON_PROPERTY_QUANTITY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SHIP_DATE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getShipDate() { + return shipDate; + } + + @JsonProperty(value = JSON_PROPERTY_SHIP_DATE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_COMPLETE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getComplete() { + return complete; + } + + @JsonProperty(value = JSON_PROPERTY_COMPLETE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "petId", "quantity", "shipDate", "status", "complete")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterComposite.java new file mode 100644 index 000000000000..64950afa2c28 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -0,0 +1,232 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OuterComposite + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + OuterComposite.JSON_PROPERTY_MY_NUMBER, + OuterComposite.JSON_PROPERTY_MY_STRING, + OuterComposite.JSON_PROPERTY_MY_BOOLEAN +}) +@JsonTypeName("OuterComposite") +public class OuterComposite { + public static final String JSON_PROPERTY_MY_NUMBER = "my_number"; + @JsonProperty(JSON_PROPERTY_MY_NUMBER) + @javax.annotation.Nullable + private BigDecimal myNumber; + + public static final String JSON_PROPERTY_MY_STRING = "my_string"; + @JsonProperty(JSON_PROPERTY_MY_STRING) + @javax.annotation.Nullable + private String myString; + + public static final String JSON_PROPERTY_MY_BOOLEAN = "my_boolean"; + @JsonProperty(JSON_PROPERTY_MY_BOOLEAN) + @javax.annotation.Nullable + private Boolean myBoolean; + + public OuterComposite() { + } + + public OuterComposite myNumber(@javax.annotation.Nullable BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MY_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getMyNumber() { + return myNumber; + } + + @JsonProperty(value = JSON_PROPERTY_MY_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMyNumber(@javax.annotation.Nullable BigDecimal myNumber) { + this.myNumber = myNumber; + } + + + public OuterComposite myString(@javax.annotation.Nullable String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MY_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMyString() { + return myString; + } + + @JsonProperty(value = JSON_PROPERTY_MY_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMyString(@javax.annotation.Nullable String myString) { + this.myString = myString; + } + + + public OuterComposite myBoolean(@javax.annotation.Nullable Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MY_BOOLEAN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMyBoolean() { + return myBoolean; + } + + @JsonProperty(value = JSON_PROPERTY_MY_BOOLEAN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMyBoolean(@javax.annotation.Nullable Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OuterComposite instance itself + */ + public OuterComposite putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("my_number", "my_string", "my_boolean")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnum.java new file mode 100644 index 000000000000..d9a9210f4849 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -0,0 +1,66 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +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"), + + LOWER_CASE_S("s"), + + UPPER_CASE_S("S"); + + 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/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..2566002f1b54 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.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.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +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/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnumInteger.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnumInteger.java new file mode 100644 index 000000000000..f932cd106263 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnumInteger.java @@ -0,0 +1,63 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumInteger + */ +@Deprecated +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/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..81ec9e780ee9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.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.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +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/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ParentPet.java new file mode 100644 index 000000000000..b93ce4f0a5b5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ParentPet.java @@ -0,0 +1,150 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.GrandparentAnimal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ParentPet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the pet_type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true) + +@JsonPropertyOrder({ +}) +@JsonTypeName("ParentPet") +public class ParentPet extends GrandparentAnimal { + public ParentPet() { + this.petType = this.getClass().getSimpleName(); + } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ParentPet instance itself + */ + public ParentPet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParentPet {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(0); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("pet_type")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..c71cfe1939fd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,383 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("Pet") +public class Pet { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @JsonProperty(JSON_PROPERTY_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @JsonProperty(JSON_PROPERTY_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetComposition.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetComposition.java new file mode 100644 index 000000000000..206524cd04b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetComposition.java @@ -0,0 +1,383 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetComposition + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + PetComposition.JSON_PROPERTY_ID, + PetComposition.JSON_PROPERTY_CATEGORY, + PetComposition.JSON_PROPERTY_NAME, + PetComposition.JSON_PROPERTY_PHOTO_URLS, + PetComposition.JSON_PROPERTY_TAGS, + PetComposition.JSON_PROPERTY_STATUS +}) +@JsonTypeName("PetComposition") +public class PetComposition { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @JsonProperty(JSON_PROPERTY_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @JsonProperty(JSON_PROPERTY_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetComposition() { + } + + public PetComposition id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetComposition category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetComposition name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PetComposition photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetComposition addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetComposition tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetComposition addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public PetComposition status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetComposition instance itself + */ + public PetComposition putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetComposition {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetRef.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetRef.java new file mode 100644 index 000000000000..eaadbf8e6228 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetRef.java @@ -0,0 +1,383 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetRef + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + PetRef.JSON_PROPERTY_ID, + PetRef.JSON_PROPERTY_CATEGORY, + PetRef.JSON_PROPERTY_NAME, + PetRef.JSON_PROPERTY_PHOTO_URLS, + PetRef.JSON_PROPERTY_TAGS, + PetRef.JSON_PROPERTY_STATUS +}) +@JsonTypeName("PetRef") +public class PetRef { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @JsonProperty(JSON_PROPERTY_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @JsonProperty(JSON_PROPERTY_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetRef() { + } + + public PetRef id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetRef category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetRef name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PetRef photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetRef addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetRef tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetRef addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public PetRef status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetRef instance itself + */ + public PetRef putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetRef {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetUsingAllOf.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetUsingAllOf.java new file mode 100644 index 000000000000..ed49ce21bc2c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetUsingAllOf.java @@ -0,0 +1,383 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetUsingAllOf + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + PetUsingAllOf.JSON_PROPERTY_ID, + PetUsingAllOf.JSON_PROPERTY_CATEGORY, + PetUsingAllOf.JSON_PROPERTY_NAME, + PetUsingAllOf.JSON_PROPERTY_PHOTO_URLS, + PetUsingAllOf.JSON_PROPERTY_TAGS, + PetUsingAllOf.JSON_PROPERTY_STATUS +}) +@JsonTypeName("PetUsingAllOf") +public class PetUsingAllOf { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @JsonProperty(JSON_PROPERTY_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @JsonProperty(JSON_PROPERTY_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetUsingAllOf() { + } + + public PetUsingAllOf id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetUsingAllOf category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * multi line description 2nd line last line + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetUsingAllOf name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PetUsingAllOf photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetUsingAllOf addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetUsingAllOf tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetUsingAllOf addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public PetUsingAllOf status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetUsingAllOf instance itself + */ + public PetUsingAllOf putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetUsingAllOf {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java new file mode 100644 index 000000000000..7bbd3b753da4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java @@ -0,0 +1,383 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetWithRequiredTags + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + PetWithRequiredTags.JSON_PROPERTY_ID, + PetWithRequiredTags.JSON_PROPERTY_CATEGORY, + PetWithRequiredTags.JSON_PROPERTY_NAME, + PetWithRequiredTags.JSON_PROPERTY_PHOTO_URLS, + PetWithRequiredTags.JSON_PROPERTY_TAGS, + PetWithRequiredTags.JSON_PROPERTY_STATUS +}) +@JsonTypeName("PetWithRequiredTags") +public class PetWithRequiredTags { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @JsonProperty(JSON_PROPERTY_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @JsonProperty(JSON_PROPERTY_TAGS) + @javax.annotation.Nonnull + private List tags = new ArrayList<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetWithRequiredTags() { + } + + public PetWithRequiredTags id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetWithRequiredTags category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetWithRequiredTags name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PetWithRequiredTags photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetWithRequiredTags addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetWithRequiredTags tags(@javax.annotation.Nonnull List tags) { + this.tags = tags; + return this; + } + + public PetWithRequiredTags addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TAGS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTags(@javax.annotation.Nonnull List tags) { + this.tags = tags; + } + + + public PetWithRequiredTags status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetWithRequiredTags instance itself + */ + public PetWithRequiredTags putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetWithRequiredTags {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls", "tags")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pig.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pig.java new file mode 100644 index 000000000000..e212d155a028 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pig.java @@ -0,0 +1,278 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.DanishPig; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Pig.PigDeserializer.class) +@JsonSerialize(using = Pig.PigSerializer.class) +public class Pig extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Pig.class.getName()); + + + public static class PigSerializer extends StdSerializer { + public PigSerializer(Class t) { + super(t); + } + + public PigSerializer() { + this(null); + } + + @Override + public void serialize(Pig value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + 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 { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + Pig newPig = new Pig(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("className"); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "BasquePig": + deserialized = tree.traverse(jp.getCodec()).readValueAs(BasquePig.class); + newPig.setActualInstance(deserialized); + return newPig; + case "DanishPig": + deserialized = tree.traverse(jp.getCodec()).readValueAs(DanishPig.class); + newPig.setActualInstance(deserialized); + return newPig; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Pig. Possible values: BasquePig DanishPig", discriminatorValue)); + } + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize BasquePig + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (BasquePig.class.equals(Integer.class) || BasquePig.class.equals(Long.class) || BasquePig.class.equals(Float.class) || BasquePig.class.equals(Double.class) || BasquePig.class.equals(Boolean.class) || BasquePig.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((BasquePig.class.equals(Integer.class) || BasquePig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((BasquePig.class.equals(Float.class) || BasquePig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (BasquePig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (BasquePig.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(BasquePig.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'BasquePig'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'BasquePig'", e); + } + + // deserialize DanishPig + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DanishPig.class.equals(Integer.class) || DanishPig.class.equals(Long.class) || DanishPig.class.equals(Float.class) || DanishPig.class.equals(Double.class) || DanishPig.class.equals(Boolean.class) || DanishPig.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((DanishPig.class.equals(Integer.class) || DanishPig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((DanishPig.class.equals(Float.class) || DanishPig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (DanishPig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (DanishPig.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(DanishPig.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'DanishPig'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DanishPig'", e); + } + + if (match == 1) { + Pig ret = new Pig(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for Pig: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Pig getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Pig cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Pig() { + super("oneOf", Boolean.FALSE); + } + + public Pig(BasquePig o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Pig(DanishPig o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("BasquePig", BasquePig.class); + schemas.put("DanishPig", DanishPig.class); + JSON.registerDescendants(Pig.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("BasquePig", BasquePig.class); + mappings.put("DanishPig", DanishPig.class); + mappings.put("Pig", Pig.class); + JSON.registerDiscriminator(Pig.class, "className", mappings); + } + + @Override + public Map> getSchemas() { + return Pig.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * BasquePig, DanishPig + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(BasquePig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(DanishPig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BasquePig, DanishPig"); + } + + /** + * Get the actual instance, which can be the following: + * BasquePig, DanishPig + * + * @return The actual instance (BasquePig, DanishPig) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BasquePig`. If the actual instance is not `BasquePig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BasquePig` + * @throws ClassCastException if the instance is not `BasquePig` + */ + public BasquePig getBasquePig() throws ClassCastException { + return (BasquePig)super.getActualInstance(); + } + + /** + * Get the actual instance of `DanishPig`. If the actual instance is not `DanishPig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `DanishPig` + * @throws ClassCastException if the instance is not `DanishPig` + */ + public DanishPig getDanishPig() throws ClassCastException { + return (DanishPig)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PropertyNameCollision.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PropertyNameCollision.java new file mode 100644 index 000000000000..88391bfbfc93 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PropertyNameCollision.java @@ -0,0 +1,231 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PropertyNameCollision + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + PropertyNameCollision.JSON_PROPERTY_UNDERSCORE_TYPE, + PropertyNameCollision.JSON_PROPERTY_TYPE, + PropertyNameCollision.JSON_PROPERTY_TYPE_WITH_UNDERSCORE +}) +@JsonTypeName("PropertyNameCollision") +public class PropertyNameCollision { + public static final String JSON_PROPERTY_UNDERSCORE_TYPE = "_type"; + @JsonProperty(JSON_PROPERTY_UNDERSCORE_TYPE) + @javax.annotation.Nullable + private String underscoreType; + + public static final String JSON_PROPERTY_TYPE = "type"; + @JsonProperty(JSON_PROPERTY_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String JSON_PROPERTY_TYPE_WITH_UNDERSCORE = "type_"; + @JsonProperty(JSON_PROPERTY_TYPE_WITH_UNDERSCORE) + @javax.annotation.Nullable + private String typeWithUnderscore; + + public PropertyNameCollision() { + } + + public PropertyNameCollision underscoreType(@javax.annotation.Nullable String underscoreType) { + this.underscoreType = underscoreType; + return this; + } + + /** + * Get underscoreType + * @return underscoreType + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_UNDERSCORE_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUnderscoreType() { + return underscoreType; + } + + @JsonProperty(value = JSON_PROPERTY_UNDERSCORE_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUnderscoreType(@javax.annotation.Nullable String underscoreType) { + this.underscoreType = underscoreType; + } + + + public PropertyNameCollision type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public PropertyNameCollision typeWithUnderscore(@javax.annotation.Nullable String typeWithUnderscore) { + this.typeWithUnderscore = typeWithUnderscore; + return this; + } + + /** + * Get typeWithUnderscore + * @return typeWithUnderscore + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TYPE_WITH_UNDERSCORE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getTypeWithUnderscore() { + return typeWithUnderscore; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE_WITH_UNDERSCORE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTypeWithUnderscore(@javax.annotation.Nullable String typeWithUnderscore) { + this.typeWithUnderscore = typeWithUnderscore; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PropertyNameCollision instance itself + */ + public PropertyNameCollision putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertyNameCollision {\n"); + sb.append(" underscoreType: ").append(toIndentedString(underscoreType)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" typeWithUnderscore: ").append(toIndentedString(typeWithUnderscore)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("_type", "type", "type_")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Quadrilateral.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Quadrilateral.java new file mode 100644 index 000000000000..4f3bdf229d29 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Quadrilateral.java @@ -0,0 +1,278 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Quadrilateral.QuadrilateralDeserializer.class) +@JsonSerialize(using = Quadrilateral.QuadrilateralSerializer.class) +public class Quadrilateral extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Quadrilateral.class.getName()); + + + public static class QuadrilateralSerializer extends StdSerializer { + public QuadrilateralSerializer(Class t) { + super(t); + } + + public QuadrilateralSerializer() { + this(null); + } + + @Override + public void serialize(Quadrilateral value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + 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 { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + Quadrilateral newQuadrilateral = new Quadrilateral(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("quadrilateralType"); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "ComplexQuadrilateral": + deserialized = tree.traverse(jp.getCodec()).readValueAs(ComplexQuadrilateral.class); + newQuadrilateral.setActualInstance(deserialized); + return newQuadrilateral; + case "SimpleQuadrilateral": + deserialized = tree.traverse(jp.getCodec()).readValueAs(SimpleQuadrilateral.class); + newQuadrilateral.setActualInstance(deserialized); + return newQuadrilateral; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Quadrilateral. Possible values: ComplexQuadrilateral SimpleQuadrilateral", discriminatorValue)); + } + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize ComplexQuadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ComplexQuadrilateral.class.equals(Integer.class) || ComplexQuadrilateral.class.equals(Long.class) || ComplexQuadrilateral.class.equals(Float.class) || ComplexQuadrilateral.class.equals(Double.class) || ComplexQuadrilateral.class.equals(Boolean.class) || ComplexQuadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((ComplexQuadrilateral.class.equals(Integer.class) || ComplexQuadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((ComplexQuadrilateral.class.equals(Float.class) || ComplexQuadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (ComplexQuadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (ComplexQuadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(ComplexQuadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'ComplexQuadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ComplexQuadrilateral'", e); + } + + // deserialize SimpleQuadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SimpleQuadrilateral.class.equals(Integer.class) || SimpleQuadrilateral.class.equals(Long.class) || SimpleQuadrilateral.class.equals(Float.class) || SimpleQuadrilateral.class.equals(Double.class) || SimpleQuadrilateral.class.equals(Boolean.class) || SimpleQuadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((SimpleQuadrilateral.class.equals(Integer.class) || SimpleQuadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((SimpleQuadrilateral.class.equals(Float.class) || SimpleQuadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (SimpleQuadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (SimpleQuadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SimpleQuadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'SimpleQuadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SimpleQuadrilateral'", e); + } + + if (match == 1) { + Quadrilateral ret = new Quadrilateral(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for Quadrilateral: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Quadrilateral getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Quadrilateral cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Quadrilateral() { + super("oneOf", Boolean.FALSE); + } + + public Quadrilateral(ComplexQuadrilateral o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Quadrilateral(SimpleQuadrilateral o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("ComplexQuadrilateral", ComplexQuadrilateral.class); + schemas.put("SimpleQuadrilateral", SimpleQuadrilateral.class); + JSON.registerDescendants(Quadrilateral.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("ComplexQuadrilateral", ComplexQuadrilateral.class); + mappings.put("SimpleQuadrilateral", SimpleQuadrilateral.class); + mappings.put("Quadrilateral", Quadrilateral.class); + JSON.registerDiscriminator(Quadrilateral.class, "quadrilateralType", mappings); + } + + @Override + public Map> getSchemas() { + return Quadrilateral.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * ComplexQuadrilateral, SimpleQuadrilateral + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ComplexQuadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(SimpleQuadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be ComplexQuadrilateral, SimpleQuadrilateral"); + } + + /** + * Get the actual instance, which can be the following: + * ComplexQuadrilateral, SimpleQuadrilateral + * + * @return The actual instance (ComplexQuadrilateral, SimpleQuadrilateral) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ComplexQuadrilateral`. If the actual instance is not `ComplexQuadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ComplexQuadrilateral` + * @throws ClassCastException if the instance is not `ComplexQuadrilateral` + */ + public ComplexQuadrilateral getComplexQuadrilateral() throws ClassCastException { + return (ComplexQuadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `SimpleQuadrilateral`. If the actual instance is not `SimpleQuadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SimpleQuadrilateral` + * @throws ClassCastException if the instance is not `SimpleQuadrilateral` + */ + public SimpleQuadrilateral getSimpleQuadrilateral() throws ClassCastException { + return (SimpleQuadrilateral)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java new file mode 100644 index 000000000000..8f56679c5233 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * QuadrilateralInterface + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + QuadrilateralInterface.JSON_PROPERTY_QUADRILATERAL_TYPE +}) +@JsonTypeName("QuadrilateralInterface") +public class QuadrilateralInterface { + public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType"; + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @javax.annotation.Nonnull + private String quadrilateralType; + + public QuadrilateralInterface() { + } + + public QuadrilateralInterface quadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setQuadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the QuadrilateralInterface instance itself + */ + public QuadrilateralInterface putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuadrilateralInterface {\n"); + sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("quadrilateralType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("quadrilateralType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..44a818ddcfa1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -0,0 +1,198 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReadOnlyFirst + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ReadOnlyFirst.JSON_PROPERTY_BAR, + ReadOnlyFirst.JSON_PROPERTY_BAZ +}) +@JsonTypeName("ReadOnlyFirst") +public class ReadOnlyFirst { + public static final String JSON_PROPERTY_BAR = "bar"; + @JsonProperty(JSON_PROPERTY_BAR) + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @javax.annotation.Nullable + private String bar; + + public static final String JSON_PROPERTY_BAZ = "baz"; + @JsonProperty(JSON_PROPERTY_BAZ) + @javax.annotation.Nullable + private String baz; + + public ReadOnlyFirst() { + } + + public ReadOnlyFirst( + String bar + ) { + this(); + this.bar = bar; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BAR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + public ReadOnlyFirst baz(@javax.annotation.Nullable String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BAZ, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBaz() { + return baz; + } + + @JsonProperty(value = JSON_PROPERTY_BAZ, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBaz(@javax.annotation.Nullable String baz) { + this.baz = baz; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ReadOnlyFirst instance itself + */ + public ReadOnlyFirst putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar", "baz")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/RequiredNullableBody.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/RequiredNullableBody.java new file mode 100644 index 000000000000..73cc58231c49 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/RequiredNullableBody.java @@ -0,0 +1,663 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.client.model.NullableEnum; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RequiredNullableBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + RequiredNullableBody.JSON_PROPERTY_INTEGER_PROP, + RequiredNullableBody.JSON_PROPERTY_NUMBER_PROP, + RequiredNullableBody.JSON_PROPERTY_BOOLEAN_PROP, + RequiredNullableBody.JSON_PROPERTY_STRING_PROP, + RequiredNullableBody.JSON_PROPERTY_DATE_PROP, + RequiredNullableBody.JSON_PROPERTY_DATETIME_PROP, + RequiredNullableBody.JSON_PROPERTY_ARRAY_NULLABLE_PROP, + RequiredNullableBody.JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, + RequiredNullableBody.JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, + RequiredNullableBody.JSON_PROPERTY_OBJECT_NULLABLE_PROP, + RequiredNullableBody.JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, + RequiredNullableBody.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE, + RequiredNullableBody.JSON_PROPERTY_CUSTOM_REF_ENUM, + RequiredNullableBody.JSON_PROPERTY_CUSTOM_ENUM +}) +@JsonTypeName("RequiredNullableBody") +public class RequiredNullableBody { + public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + @javax.annotation.Nullable + private Integer integerProp; + + public static final String JSON_PROPERTY_NUMBER_PROP = "number_prop"; + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + @javax.annotation.Nullable + private BigDecimal numberProp; + + public static final String JSON_PROPERTY_BOOLEAN_PROP = "boolean_prop"; + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + @javax.annotation.Nullable + private Boolean booleanProp; + + public static final String JSON_PROPERTY_STRING_PROP = "string_prop"; + @JsonProperty(JSON_PROPERTY_STRING_PROP) + @javax.annotation.Nullable + private String stringProp; + + public static final String JSON_PROPERTY_DATE_PROP = "date_prop"; + @JsonProperty(JSON_PROPERTY_DATE_PROP) + @javax.annotation.Nullable + private LocalDate dateProp; + + public static final String JSON_PROPERTY_DATETIME_PROP = "datetime_prop"; + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + @javax.annotation.Nullable + private OffsetDateTime datetimeProp; + + public static final String JSON_PROPERTY_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + @javax.annotation.Nullable + private List arrayNullableProp; + + public static final String JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + @javax.annotation.Nullable + private List arrayAndItemsNullableProp; + + public static final String JSON_PROPERTY_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + @JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE) + @javax.annotation.Nonnull + private List arrayItemsNullable = new ArrayList<>(); + + public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + @javax.annotation.Nullable + private Map objectNullableProp; + + public static final String JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + @javax.annotation.Nullable + private Map objectAndItemsNullableProp; + + public static final String JSON_PROPERTY_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + @JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE) + @javax.annotation.Nonnull + private Map objectItemsNullable = new HashMap<>(); + + public static final String JSON_PROPERTY_CUSTOM_REF_ENUM = "custom_ref_enum"; + @JsonProperty(JSON_PROPERTY_CUSTOM_REF_ENUM) + @javax.annotation.Nullable + private NullableEnum customRefEnum; + + /** + * Gets or Sets customEnum + */ + public enum CustomEnumEnum { + CUSTOM("custom"); + + private String value; + + CustomEnumEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static CustomEnumEnum fromValue(String value) { + for (CustomEnumEnum b : CustomEnumEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + } + + public static final String JSON_PROPERTY_CUSTOM_ENUM = "custom_enum"; + @JsonProperty(JSON_PROPERTY_CUSTOM_ENUM) + @javax.annotation.Nullable + private CustomEnumEnum customEnum; + + public RequiredNullableBody() { + } + + public RequiredNullableBody integerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + return this; + } + + /** + * Get integerProp + * @return integerProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_INTEGER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getIntegerProp() { + return integerProp; + } + + @JsonProperty(value = JSON_PROPERTY_INTEGER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setIntegerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + } + + + public RequiredNullableBody numberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + return this; + } + + /** + * Get numberProp + * @return numberProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NUMBER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumberProp() { + return numberProp; + } + + @JsonProperty(value = JSON_PROPERTY_NUMBER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNumberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + } + + + public RequiredNullableBody booleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + return this; + } + + /** + * Get booleanProp + * @return booleanProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BOOLEAN_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Boolean getBooleanProp() { + return booleanProp; + } + + @JsonProperty(value = JSON_PROPERTY_BOOLEAN_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setBooleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + } + + + public RequiredNullableBody stringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + return this; + } + + /** + * Get stringProp + * @return stringProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STRING_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getStringProp() { + return stringProp; + } + + @JsonProperty(value = JSON_PROPERTY_STRING_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + } + + + public RequiredNullableBody dateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + return this; + } + + /** + * Get dateProp + * @return dateProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DATE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public LocalDate getDateProp() { + return dateProp; + } + + @JsonProperty(value = JSON_PROPERTY_DATE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setDateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + } + + + public RequiredNullableBody datetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DATETIME_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public OffsetDateTime getDatetimeProp() { + return datetimeProp; + } + + @JsonProperty(value = JSON_PROPERTY_DATETIME_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setDatetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + } + + + public RequiredNullableBody arrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + return this; + } + + public RequiredNullableBody addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null) { + this.arrayNullableProp = new ArrayList<>(); + } + this.arrayNullableProp.add(arrayNullablePropItem); + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ARRAY_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getArrayNullableProp() { + return arrayNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setArrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + + public RequiredNullableBody arrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + + public RequiredNullableBody addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null) { + this.arrayAndItemsNullableProp = new ArrayList<>(); + } + this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem); + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setArrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + + public RequiredNullableBody arrayItemsNullable(@javax.annotation.Nonnull List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + public RequiredNullableBody addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<>(); + } + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + /** + * Get arrayItemsNullable + * @return arrayItemsNullable + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setArrayItemsNullable(@javax.annotation.Nonnull List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + + public RequiredNullableBody objectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + return this; + } + + public RequiredNullableBody putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null) { + this.objectNullableProp = new HashMap<>(); + } + this.objectNullableProp.put(key, objectNullablePropItem); + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OBJECT_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Map getObjectNullableProp() { + return objectNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setObjectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + + public RequiredNullableBody objectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + + public RequiredNullableBody putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null) { + this.objectAndItemsNullableProp = new HashMap<>(); + } + this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem); + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.ALWAYS) + + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.ALWAYS) + public void setObjectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + + public RequiredNullableBody objectItemsNullable(@javax.annotation.Nonnull Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + return this; + } + + public RequiredNullableBody 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.Nonnull + @JsonProperty(value = JSON_PROPERTY_OBJECT_ITEMS_NULLABLE, required = true) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.ALWAYS) + + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_ITEMS_NULLABLE, required = true) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.ALWAYS) + public void setObjectItemsNullable(@javax.annotation.Nonnull Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + + public RequiredNullableBody customRefEnum(@javax.annotation.Nullable NullableEnum customRefEnum) { + this.customRefEnum = customRefEnum; + return this; + } + + /** + * Get customRefEnum + * @return customRefEnum + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CUSTOM_REF_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public NullableEnum getCustomRefEnum() { + return customRefEnum; + } + + @JsonProperty(value = JSON_PROPERTY_CUSTOM_REF_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCustomRefEnum(@javax.annotation.Nullable NullableEnum customRefEnum) { + this.customRefEnum = customRefEnum; + } + + + public RequiredNullableBody customEnum(@javax.annotation.Nullable CustomEnumEnum customEnum) { + this.customEnum = customEnum; + return this; + } + + /** + * Get customEnum + * @return customEnum + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CUSTOM_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public CustomEnumEnum getCustomEnum() { + return customEnum; + } + + @JsonProperty(value = JSON_PROPERTY_CUSTOM_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCustomEnum(@javax.annotation.Nullable CustomEnumEnum customEnum) { + this.customEnum = customEnum; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RequiredNullableBody instance itself + */ + public RequiredNullableBody putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequiredNullableBody {\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(" customRefEnum: ").append(toIndentedString(customRefEnum)).append("\n"); + sb.append(" customEnum: ").append(toIndentedString(customEnum)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable", "custom_ref_enum", "custom_enum")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable", "custom_ref_enum", "custom_enum")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Scalar.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Scalar.java new file mode 100644 index 000000000000..66c48b107722 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Scalar.java @@ -0,0 +1,342 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import java.util.UUID; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Scalar.ScalarDeserializer.class) +@JsonSerialize(using = Scalar.ScalarSerializer.class) +public class Scalar extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Scalar.class.getName()); + + + public static class ScalarSerializer extends StdSerializer { + public ScalarSerializer(Class t) { + super(t); + } + + public ScalarSerializer() { + this(null); + } + + @Override + public void serialize(Scalar value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ScalarDeserializer extends StdDeserializer { + public ScalarDeserializer() { + this(Scalar.class); + } + + public ScalarDeserializer(Class vc) { + super(vc); + } + + @Override + public Scalar deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize BigDecimal + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (BigDecimal.class.equals(Integer.class) || BigDecimal.class.equals(Long.class) || BigDecimal.class.equals(Float.class) || BigDecimal.class.equals(Double.class) || BigDecimal.class.equals(Boolean.class) || BigDecimal.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((BigDecimal.class.equals(Integer.class) || BigDecimal.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((BigDecimal.class.equals(Float.class) || BigDecimal.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (BigDecimal.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (BigDecimal.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(BigDecimal.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'BigDecimal'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'BigDecimal'", e); + } + + // deserialize Boolean + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Boolean.class.equals(Integer.class) || Boolean.class.equals(Long.class) || Boolean.class.equals(Float.class) || Boolean.class.equals(Double.class) || Boolean.class.equals(Boolean.class) || Boolean.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Boolean.class.equals(Integer.class) || Boolean.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Boolean.class.equals(Float.class) || Boolean.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Boolean.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Boolean.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Boolean.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Boolean'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Boolean'", e); + } + + // deserialize String + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (String.class.equals(Integer.class) || String.class.equals(Long.class) || String.class.equals(Float.class) || String.class.equals(Double.class) || String.class.equals(Boolean.class) || String.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((String.class.equals(Integer.class) || String.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((String.class.equals(Float.class) || String.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (String.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (String.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(String.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize UUID + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (UUID.class.equals(Integer.class) || UUID.class.equals(Long.class) || UUID.class.equals(Float.class) || UUID.class.equals(Double.class) || UUID.class.equals(Boolean.class) || UUID.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((UUID.class.equals(Integer.class) || UUID.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((UUID.class.equals(Float.class) || UUID.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (UUID.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (UUID.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(UUID.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'UUID'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'UUID'", e); + } + + if (match == 1) { + Scalar ret = new Scalar(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for Scalar: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Scalar getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Scalar cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Scalar() { + super("oneOf", Boolean.FALSE); + } + + public Scalar(BigDecimal o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Scalar(Boolean o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Scalar(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Scalar(UUID o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("BigDecimal", BigDecimal.class); + schemas.put("Boolean", Boolean.class); + schemas.put("String", String.class); + schemas.put("UUID", UUID.class); + JSON.registerDescendants(Scalar.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return Scalar.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * BigDecimal, Boolean, String, UUID + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(BigDecimal.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Boolean.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UUID.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BigDecimal, Boolean, String, UUID"); + } + + /** + * Get the actual instance, which can be the following: + * BigDecimal, Boolean, String, UUID + * + * @return The actual instance (BigDecimal, Boolean, String, UUID) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BigDecimal`. If the actual instance is not `BigDecimal`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BigDecimal` + * @throws ClassCastException if the instance is not `BigDecimal` + */ + public BigDecimal getBigDecimal() throws ClassCastException { + return (BigDecimal)super.getActualInstance(); + } + + /** + * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Boolean` + * @throws ClassCastException if the instance is not `Boolean` + */ + public Boolean getBoolean() throws ClassCastException { + return (Boolean)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + /** + * Get the actual instance of `UUID`. If the actual instance is not `UUID`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UUID` + * @throws ClassCastException if the instance is not `UUID` + */ + public UUID getUUID() throws ClassCastException { + return (UUID)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScalarAnyOf.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScalarAnyOf.java new file mode 100644 index 000000000000..4d46bac820b0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScalarAnyOf.java @@ -0,0 +1,274 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import java.util.UUID; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = ScalarAnyOf.ScalarAnyOfDeserializer.class) +@JsonSerialize(using = ScalarAnyOf.ScalarAnyOfSerializer.class) +public class ScalarAnyOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ScalarAnyOf.class.getName()); + + + public static class ScalarAnyOfSerializer extends StdSerializer { + public ScalarAnyOfSerializer(Class t) { + super(t); + } + + public ScalarAnyOfSerializer() { + this(null); + } + + @Override + public void serialize(ScalarAnyOf value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ScalarAnyOfDeserializer extends StdDeserializer { + public ScalarAnyOfDeserializer() { + this(ScalarAnyOf.class); + } + + public ScalarAnyOfDeserializer(Class vc) { + super(vc); + } + + @Override + public ScalarAnyOf deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + // deserialize BigDecimal + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(BigDecimal.class); + ScalarAnyOf ret = new ScalarAnyOf(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'BigDecimal'", e); + } + + // deserialize Boolean + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Boolean.class); + ScalarAnyOf ret = new ScalarAnyOf(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Boolean'", e); + } + + // deserialize String + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(String.class); + ScalarAnyOf ret = new ScalarAnyOf(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize UUID + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(UUID.class); + ScalarAnyOf ret = new ScalarAnyOf(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'UUID'", e); + } + + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for ScalarAnyOf: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public ScalarAnyOf getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "ScalarAnyOf cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public ScalarAnyOf() { + super("anyOf", Boolean.FALSE); + } + + public ScalarAnyOf(BigDecimal o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarAnyOf(Boolean o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarAnyOf(String o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarAnyOf(UUID o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("BigDecimal", BigDecimal.class); + schemas.put("Boolean", Boolean.class); + schemas.put("String", String.class); + schemas.put("UUID", UUID.class); + JSON.registerDescendants(ScalarAnyOf.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return ScalarAnyOf.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * BigDecimal, Boolean, String, UUID + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(BigDecimal.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Boolean.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UUID.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BigDecimal, Boolean, String, UUID"); + } + + /** + * Get the actual instance, which can be the following: + * BigDecimal, Boolean, String, UUID + * + * @return The actual instance (BigDecimal, Boolean, String, UUID) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BigDecimal`. If the actual instance is not `BigDecimal`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BigDecimal` + * @throws ClassCastException if the instance is not `BigDecimal` + */ + public BigDecimal getBigDecimal() throws ClassCastException { + return (BigDecimal)super.getActualInstance(); + } + + /** + * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Boolean` + * @throws ClassCastException if the instance is not `Boolean` + */ + public Boolean getBoolean() throws ClassCastException { + return (Boolean)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + /** + * Get the actual instance of `UUID`. If the actual instance is not `UUID`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UUID` + * @throws ClassCastException if the instance is not `UUID` + */ + public UUID getUUID() throws ClassCastException { + return (UUID)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java new file mode 100644 index 000000000000..339e35185b7b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ScaleneTriangle + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ScaleneTriangle.JSON_PROPERTY_SHAPE_TYPE, + ScaleneTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) +@JsonTypeName("ScaleneTriangle") +public class ScaleneTriangle { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @javax.annotation.Nonnull + private String triangleType; + + public ScaleneTriangle() { + } + + public ScaleneTriangle shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public ScaleneTriangle triangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTriangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ScaleneTriangle instance itself + */ + public ScaleneTriangle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Shape.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Shape.java new file mode 100644 index 000000000000..dcc46c50756c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Shape.java @@ -0,0 +1,278 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Shape.ShapeDeserializer.class) +@JsonSerialize(using = Shape.ShapeSerializer.class) +public class Shape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Shape.class.getName()); + + + public static class ShapeSerializer extends StdSerializer { + public ShapeSerializer(Class t) { + super(t); + } + + public ShapeSerializer() { + this(null); + } + + @Override + public void serialize(Shape value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + 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 { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + Shape newShape = new Shape(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("shapeType"); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "Quadrilateral": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + newShape.setActualInstance(deserialized); + return newShape; + case "Triangle": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + newShape.setActualInstance(deserialized); + return newShape; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Shape. Possible values: Quadrilateral Triangle", discriminatorValue)); + } + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Quadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + // deserialize Triangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + if (match == 1) { + Shape ret = new Shape(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for Shape: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Shape getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Shape cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Shape() { + super("oneOf", Boolean.FALSE); + } + + public Shape(Quadrilateral o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Shape(Triangle o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Quadrilateral", Quadrilateral.class); + schemas.put("Triangle", Triangle.class); + JSON.registerDescendants(Shape.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Quadrilateral", Quadrilateral.class); + mappings.put("Triangle", Triangle.class); + mappings.put("Shape", Shape.class); + JSON.registerDiscriminator(Shape.class, "shapeType", mappings); + } + + @Override + public Map> getSchemas() { + return Shape.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeInterface.java new file mode 100644 index 000000000000..fe0b8c0b7ac9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ShapeInterface + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ShapeInterface.JSON_PROPERTY_SHAPE_TYPE +}) +@JsonTypeName("ShapeInterface") +public class ShapeInterface { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public ShapeInterface() { + } + + public ShapeInterface shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ShapeInterface instance itself + */ + public ShapeInterface putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShapeInterface {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeOrNull.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeOrNull.java new file mode 100644 index 000000000000..d80538aff9ea --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeOrNull.java @@ -0,0 +1,285 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = ShapeOrNull.ShapeOrNullDeserializer.class) +@JsonSerialize(using = ShapeOrNull.ShapeOrNullSerializer.class) +public class ShapeOrNull extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ShapeOrNull.class.getName()); + + + public static class ShapeOrNullSerializer extends StdSerializer { + public ShapeOrNullSerializer(Class t) { + super(t); + } + + public ShapeOrNullSerializer() { + this(null); + } + + @Override + public void serialize(ShapeOrNull value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + 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 { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + ShapeOrNull newShapeOrNull = new ShapeOrNull(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("shapeType"); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "Quadrilateral": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + newShapeOrNull.setActualInstance(deserialized); + return newShapeOrNull; + case "Triangle": + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + newShapeOrNull.setActualInstance(deserialized); + return newShapeOrNull; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for ShapeOrNull. Possible values: Quadrilateral Triangle", discriminatorValue)); + } + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize Quadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + // deserialize Triangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + if (match == 1) { + ShapeOrNull ret = new ShapeOrNull(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for ShapeOrNull: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public ShapeOrNull getNullValue(DeserializationContext ctxt) throws JsonMappingException { + return null; + } + } + + // store a list of schema names defined in oneOf + public static final 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", Quadrilateral.class); + schemas.put("Triangle", Triangle.class); + JSON.registerDescendants(ShapeOrNull.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Quadrilateral", Quadrilateral.class); + mappings.put("Triangle", Triangle.class); + mappings.put("ShapeOrNull", ShapeOrNull.class); + JSON.registerDiscriminator(ShapeOrNull.class, "shapeType", mappings); + } + + @Override + public Map> getSchemas() { + return ShapeOrNull.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java new file mode 100644 index 000000000000..230c6e2863a4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SimpleQuadrilateral + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + SimpleQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, + SimpleQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE +}) +@JsonTypeName("SimpleQuadrilateral") +public class SimpleQuadrilateral { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType"; + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @javax.annotation.Nonnull + private String quadrilateralType; + + public SimpleQuadrilateral() { + } + + public SimpleQuadrilateral shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public SimpleQuadrilateral quadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setQuadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SimpleQuadrilateral instance itself + */ + public SimpleQuadrilateral putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SpecialModelName.java new file mode 100644 index 000000000000..52bfceee2175 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SpecialModelName + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME, + SpecialModelName.JSON_PROPERTY_SPECIAL_MODEL_NAME +}) +@JsonTypeName("_special_model.name_") +public class SpecialModelName { + public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + @JsonProperty(JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME) + @javax.annotation.Nullable + private Long $specialPropertyName; + + public static final String JSON_PROPERTY_SPECIAL_MODEL_NAME = "_special_model.name_"; + @JsonProperty(JSON_PROPERTY_SPECIAL_MODEL_NAME) + @javax.annotation.Nullable + private String specialModelName; + + public SpecialModelName() { + } + + public SpecialModelName $specialPropertyName(@javax.annotation.Nullable Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + @JsonProperty(value = JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void set$SpecialPropertyName(@javax.annotation.Nullable Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + public SpecialModelName specialModelName(@javax.annotation.Nullable String specialModelName) { + this.specialModelName = specialModelName; + return this; + } + + /** + * Get specialModelName + * @return specialModelName + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SPECIAL_MODEL_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSpecialModelName() { + return specialModelName; + } + + @JsonProperty(value = JSON_PROPERTY_SPECIAL_MODEL_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSpecialModelName(@javax.annotation.Nullable String specialModelName) { + this.specialModelName = specialModelName; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SpecialModelName instance itself + */ + public SpecialModelName putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append(" specialModelName: ").append(toIndentedString(specialModelName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("$special[property.name]", "_special_model.name_")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..1f4d3f731d74 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Tag + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) +@JsonTypeName("Tag") +public class Tag { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java new file mode 100644 index 000000000000..85b52d505172 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TestInlineFreeformAdditionalPropertiesRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + TestInlineFreeformAdditionalPropertiesRequest.JSON_PROPERTY_SOME_PROPERTY +}) +@JsonTypeName("testInlineFreeformAdditionalProperties_request") +public class TestInlineFreeformAdditionalPropertiesRequest { + public static final String JSON_PROPERTY_SOME_PROPERTY = "someProperty"; + @JsonProperty(JSON_PROPERTY_SOME_PROPERTY) + @javax.annotation.Nullable + private String someProperty; + + public TestInlineFreeformAdditionalPropertiesRequest() { + } + + public TestInlineFreeformAdditionalPropertiesRequest someProperty(@javax.annotation.Nullable String someProperty) { + this.someProperty = someProperty; + return this; + } + + /** + * Get someProperty + * @return someProperty + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SOME_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSomeProperty() { + return someProperty; + } + + @JsonProperty(value = JSON_PROPERTY_SOME_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeProperty(@javax.annotation.Nullable String someProperty) { + this.someProperty = someProperty; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TestInlineFreeformAdditionalPropertiesRequest instance itself + */ + public TestInlineFreeformAdditionalPropertiesRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); + sb.append(" someProperty: ").append(toIndentedString(someProperty)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("someProperty")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Triangle.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Triangle.java new file mode 100644 index 000000000000..e3803ca6a49e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Triangle.java @@ -0,0 +1,332 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.EquilateralTriangle; +import org.openapitools.client.model.IsoscelesTriangle; +import org.openapitools.client.model.ScaleneTriangle; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Triangle.TriangleDeserializer.class) +@JsonSerialize(using = Triangle.TriangleSerializer.class) +public class Triangle extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Triangle.class.getName()); + + + public static class TriangleSerializer extends StdSerializer { + public TriangleSerializer(Class t) { + super(t); + } + + public TriangleSerializer() { + this(null); + } + + @Override + public void serialize(Triangle value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + 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 { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + Triangle newTriangle = new Triangle(); + Map result2 = tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String)result2.get("triangleType"); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "EquilateralTriangle": + deserialized = tree.traverse(jp.getCodec()).readValueAs(EquilateralTriangle.class); + newTriangle.setActualInstance(deserialized); + return newTriangle; + case "IsoscelesTriangle": + deserialized = tree.traverse(jp.getCodec()).readValueAs(IsoscelesTriangle.class); + newTriangle.setActualInstance(deserialized); + return newTriangle; + case "ScaleneTriangle": + deserialized = tree.traverse(jp.getCodec()).readValueAs(ScaleneTriangle.class); + newTriangle.setActualInstance(deserialized); + return newTriangle; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Triangle. Possible values: EquilateralTriangle IsoscelesTriangle ScaleneTriangle", discriminatorValue)); + } + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize EquilateralTriangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (EquilateralTriangle.class.equals(Integer.class) || EquilateralTriangle.class.equals(Long.class) || EquilateralTriangle.class.equals(Float.class) || EquilateralTriangle.class.equals(Double.class) || EquilateralTriangle.class.equals(Boolean.class) || EquilateralTriangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((EquilateralTriangle.class.equals(Integer.class) || EquilateralTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((EquilateralTriangle.class.equals(Float.class) || EquilateralTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (EquilateralTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (EquilateralTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(EquilateralTriangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'EquilateralTriangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'EquilateralTriangle'", e); + } + + // deserialize IsoscelesTriangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (IsoscelesTriangle.class.equals(Integer.class) || IsoscelesTriangle.class.equals(Long.class) || IsoscelesTriangle.class.equals(Float.class) || IsoscelesTriangle.class.equals(Double.class) || IsoscelesTriangle.class.equals(Boolean.class) || IsoscelesTriangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((IsoscelesTriangle.class.equals(Integer.class) || IsoscelesTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((IsoscelesTriangle.class.equals(Float.class) || IsoscelesTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (IsoscelesTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (IsoscelesTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(IsoscelesTriangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'IsoscelesTriangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'IsoscelesTriangle'", e); + } + + // deserialize ScaleneTriangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ScaleneTriangle.class.equals(Integer.class) || ScaleneTriangle.class.equals(Long.class) || ScaleneTriangle.class.equals(Float.class) || ScaleneTriangle.class.equals(Double.class) || ScaleneTriangle.class.equals(Boolean.class) || ScaleneTriangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((ScaleneTriangle.class.equals(Integer.class) || ScaleneTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((ScaleneTriangle.class.equals(Float.class) || ScaleneTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (ScaleneTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (ScaleneTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(ScaleneTriangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'ScaleneTriangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ScaleneTriangle'", e); + } + + if (match == 1) { + Triangle ret = new Triangle(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for Triangle: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Triangle getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Triangle cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Triangle() { + super("oneOf", Boolean.FALSE); + } + + public Triangle(EquilateralTriangle o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Triangle(IsoscelesTriangle o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Triangle(ScaleneTriangle o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("EquilateralTriangle", EquilateralTriangle.class); + schemas.put("IsoscelesTriangle", IsoscelesTriangle.class); + schemas.put("ScaleneTriangle", ScaleneTriangle.class); + JSON.registerDescendants(Triangle.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("EquilateralTriangle", EquilateralTriangle.class); + mappings.put("IsoscelesTriangle", IsoscelesTriangle.class); + mappings.put("ScaleneTriangle", ScaleneTriangle.class); + mappings.put("Triangle", Triangle.class); + JSON.registerDiscriminator(Triangle.class, "triangleType", mappings); + } + + @Override + public Map> getSchemas() { + return Triangle.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(EquilateralTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(IsoscelesTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(ScaleneTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle"); + } + + /** + * Get the actual instance, which can be the following: + * EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle + * + * @return The actual instance (EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `EquilateralTriangle`. If the actual instance is not `EquilateralTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EquilateralTriangle` + * @throws ClassCastException if the instance is not `EquilateralTriangle` + */ + public EquilateralTriangle getEquilateralTriangle() throws ClassCastException { + return (EquilateralTriangle)super.getActualInstance(); + } + + /** + * Get the actual instance of `IsoscelesTriangle`. If the actual instance is not `IsoscelesTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `IsoscelesTriangle` + * @throws ClassCastException if the instance is not `IsoscelesTriangle` + */ + public IsoscelesTriangle getIsoscelesTriangle() throws ClassCastException { + return (IsoscelesTriangle)super.getActualInstance(); + } + + /** + * Get the actual instance of `ScaleneTriangle`. If the actual instance is not `ScaleneTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ScaleneTriangle` + * @throws ClassCastException if the instance is not `ScaleneTriangle` + */ + public ScaleneTriangle getScaleneTriangle() throws ClassCastException { + return (ScaleneTriangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TriangleInterface.java new file mode 100644 index 000000000000..3a17117ea063 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TriangleInterface + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + TriangleInterface.JSON_PROPERTY_TRIANGLE_TYPE +}) +@JsonTypeName("TriangleInterface") +public class TriangleInterface { + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @javax.annotation.Nonnull + private String triangleType; + + public TriangleInterface() { + } + + public TriangleInterface triangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTriangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TriangleInterface instance itself + */ + public TriangleInterface putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TriangleInterface {\n"); + sb.append(" triangleType: ").append(toIndentedString(triangleType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("triangleType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..0da80f57f7ef --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,525 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * User + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("User") +public class User { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_USERNAME = "username"; + @JsonProperty(JSON_PROPERTY_USERNAME) + @javax.annotation.Nullable + private String username; + + public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @javax.annotation.Nullable + private String firstName; + + public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @javax.annotation.Nullable + private String lastName; + + public static final String JSON_PROPERTY_EMAIL = "email"; + @JsonProperty(JSON_PROPERTY_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + @JsonProperty(JSON_PROPERTY_PASSWORD) + @javax.annotation.Nullable + private String password; + + public static final String JSON_PROPERTY_PHONE = "phone"; + @JsonProperty(JSON_PROPERTY_PHONE) + @javax.annotation.Nullable + private String phone; + + public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @javax.annotation.Nullable + private Integer userStatus; + + public static final String JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS = "objectWithNoDeclaredProps"; + @JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS) + @javax.annotation.Nullable + private Object objectWithNoDeclaredProps; + + public static final String JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE = "objectWithNoDeclaredPropsNullable"; + @JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE) + @javax.annotation.Nullable + private Object objectWithNoDeclaredPropsNullable; + + public static final String JSON_PROPERTY_ANY_TYPE_PROP = "anyTypeProp"; + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP) + @javax.annotation.Nullable + private Object anyTypeProp = null; + + public static final String JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE = "anyTypePropNullable"; + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE) + @javax.annotation.Nullable + private Object anyTypePropNullable = null; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_USERNAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUsername() { + return username; + } + + @JsonProperty(value = JSON_PROPERTY_USERNAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_FIRST_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getFirstName() { + return firstName; + } + + @JsonProperty(value = JSON_PROPERTY_FIRST_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_LAST_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getLastName() { + return lastName; + } + + @JsonProperty(value = JSON_PROPERTY_LAST_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_EMAIL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getEmail() { + return email; + } + + @JsonProperty(value = JSON_PROPERTY_EMAIL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PASSWORD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPassword() { + return password; + } + + @JsonProperty(value = JSON_PROPERTY_PASSWORD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PHONE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPhone() { + return phone; + } + + @JsonProperty(value = JSON_PROPERTY_PHONE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_USER_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getUserStatus() { + return userStatus; + } + + @JsonProperty(value = JSON_PROPERTY_USER_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + + public User objectWithNoDeclaredProps(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getObjectWithNoDeclaredProps() { + return objectWithNoDeclaredProps; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setObjectWithNoDeclaredProps(@javax.annotation.Nullable Object objectWithNoDeclaredProps) { + this.objectWithNoDeclaredProps = objectWithNoDeclaredProps; + } + + + public User objectWithNoDeclaredPropsNullable(@javax.annotation.Nullable Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = 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 + @JsonProperty(value = JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getObjectWithNoDeclaredPropsNullable() { + return objectWithNoDeclaredPropsNullable; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setObjectWithNoDeclaredPropsNullable(@javax.annotation.Nullable Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + } + + + public User anyTypeProp(@javax.annotation.Nullable Object anyTypeProp) { + this.anyTypeProp = 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 + @JsonProperty(value = JSON_PROPERTY_ANY_TYPE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getAnyTypeProp() { + return anyTypeProp; + } + + @JsonProperty(value = JSON_PROPERTY_ANY_TYPE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAnyTypeProp(@javax.annotation.Nullable Object anyTypeProp) { + this.anyTypeProp = anyTypeProp; + } + + + public User anyTypePropNullable(@javax.annotation.Nullable Object anyTypePropNullable) { + this.anyTypePropNullable = 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 + @JsonProperty(value = JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getAnyTypePropNullable() { + return anyTypePropNullable; + } + + @JsonProperty(value = JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAnyTypePropNullable(@javax.annotation.Nullable Object anyTypePropNullable) { + this.anyTypePropNullable = anyTypePropNullable; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus", "objectWithNoDeclaredProps", "objectWithNoDeclaredPropsNullable", "anyTypeProp", "anyTypePropNullable")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Value.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Value.java new file mode 100644 index 000000000000..8166990305ae --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Value.java @@ -0,0 +1,246 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; +import org.openapitools.client.model.Scalar; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.fasterxml.jackson.databind.JavaType; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Value.ValueDeserializer.class) +@JsonSerialize(using = Value.ValueSerializer.class) +public class Value extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Value.class.getName()); + + + public static class ValueSerializer extends StdSerializer { + public ValueSerializer(Class t) { + super(t); + } + + public ValueSerializer() { + this(null); + } + + @Override + public void serialize(Value value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ValueDeserializer extends StdDeserializer { + public ValueDeserializer() { + this(Value.class); + } + + public ValueDeserializer(Class vc) { + super(vc); + } + + @Override + public Value deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize List + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (List.class.equals(Integer.class) || List.class.equals(Long.class) || List.class.equals(Float.class) || List.class.equals(Double.class) || List.class.equals(Boolean.class) || List.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((List.class.equals(Integer.class) || List.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((List.class.equals(Float.class) || List.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (List.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (List.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(List.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'List'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + // deserialize Scalar + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Scalar.class.equals(Integer.class) || Scalar.class.equals(Long.class) || Scalar.class.equals(Float.class) || Scalar.class.equals(Double.class) || Scalar.class.equals(Boolean.class) || Scalar.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Scalar.class.equals(Integer.class) || Scalar.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Scalar.class.equals(Float.class) || Scalar.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Scalar.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Scalar.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Scalar.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Scalar'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Scalar'", e); + } + + if (match == 1) { + Value ret = new Value(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for Value: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Value getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "Value cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Value() { + super("oneOf", Boolean.FALSE); + } + + public Value(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Value(Scalar o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List", List.class); + schemas.put("Scalar", Scalar.class); + JSON.registerDescendants(Value.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return Value.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * List, Scalar + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Scalar.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List, Scalar"); + } + + /** + * Get the actual instance, which can be the following: + * List, Scalar + * + * @return The actual instance (List, Scalar) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Get the actual instance of `Scalar`. If the actual instance is not `Scalar`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Scalar` + * @throws ClassCastException if the instance is not `Scalar` + */ + public Scalar getScalar() throws ClassCastException { + return (Scalar)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Variable.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Variable.java new file mode 100644 index 000000000000..00124759755f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Variable.java @@ -0,0 +1,201 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Value; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Value object + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Variable.JSON_PROPERTY_NAME, + Variable.JSON_PROPERTY_VALUE +}) +@JsonTypeName("Variable") +public class Variable { + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_VALUE = "value"; + @JsonProperty(JSON_PROPERTY_VALUE) + @javax.annotation.Nonnull + private Value value; + + public Variable() { + } + + public Variable name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Variable value(@javax.annotation.Nonnull Value value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Value getValue() { + return value; + } + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@javax.annotation.Nonnull Value value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Variable instance itself + */ + public Variable putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Variable {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "value")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Whale.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Whale.java new file mode 100644 index 000000000000..66a49c369e21 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Whale.java @@ -0,0 +1,231 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Whale + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Whale.JSON_PROPERTY_HAS_BALEEN, + Whale.JSON_PROPERTY_HAS_TEETH, + Whale.JSON_PROPERTY_CLASS_NAME +}) +@JsonTypeName("whale") +public class Whale { + public static final String JSON_PROPERTY_HAS_BALEEN = "hasBaleen"; + @JsonProperty(JSON_PROPERTY_HAS_BALEEN) + @javax.annotation.Nullable + private Boolean hasBaleen; + + public static final String JSON_PROPERTY_HAS_TEETH = "hasTeeth"; + @JsonProperty(JSON_PROPERTY_HAS_TEETH) + @javax.annotation.Nullable + private Boolean hasTeeth; + + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @javax.annotation.Nonnull + private String className; + + public Whale() { + } + + public Whale hasBaleen(@javax.annotation.Nullable Boolean hasBaleen) { + this.hasBaleen = hasBaleen; + return this; + } + + /** + * Get hasBaleen + * @return hasBaleen + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_HAS_BALEEN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHasBaleen() { + return hasBaleen; + } + + @JsonProperty(value = JSON_PROPERTY_HAS_BALEEN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHasBaleen(@javax.annotation.Nullable Boolean hasBaleen) { + this.hasBaleen = hasBaleen; + } + + + public Whale hasTeeth(@javax.annotation.Nullable Boolean hasTeeth) { + this.hasTeeth = hasTeeth; + return this; + } + + /** + * Get hasTeeth + * @return hasTeeth + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_HAS_TEETH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHasTeeth() { + return hasTeeth; + } + + @JsonProperty(value = JSON_PROPERTY_HAS_TEETH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHasTeeth(@javax.annotation.Nullable Boolean hasTeeth) { + this.hasTeeth = hasTeeth; + } + + + public Whale className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Whale instance itself + */ + public Whale putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("hasBaleen", "hasTeeth", "className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Zebra.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Zebra.java new file mode 100644 index 000000000000..46426bb614cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Zebra.java @@ -0,0 +1,238 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Zebra + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Zebra.JSON_PROPERTY_TYPE, + Zebra.JSON_PROPERTY_CLASS_NAME +}) +@JsonTypeName("zebra") +public class Zebra { + /** + * 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"; + @JsonProperty(JSON_PROPERTY_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @javax.annotation.Nonnull + private String className; + + public Zebra() { + } + + public Zebra type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public Zebra className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Zebra instance itself + */ + public Zebra putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Zebra {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("type", "className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java new file mode 100644 index 000000000000..face3d9b785e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -0,0 +1,73 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AnotherFakeApi + */ +@Disabled +public class AnotherFakeApiTest { + + private final AnotherFakeApi api = new AnotherFakeApi(); + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + * + * @throws ApiException if the Api call fails + */ + @Test + public void call123testSpecialTagsTest() throws ApiException { + Client client = null; + Client response = api.call123testSpecialTags(client); + // TODO: test validations + } + + /** + * parameter array number default value + * + * @throws ApiException if the Api call fails + */ + @Test + public void getParameterArrayNumberTest() throws ApiException { + List array = null; + api.getParameterArrayNumber(array); + // TODO: test validations + } + + /** + * parameter string number + * + * @throws ApiException if the Api call fails + */ + @Test + public void getParameterStringNumberTest() throws ApiException { + BigDecimal stringNumber = null; + api.getParameterStringNumber(stringNumber); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/DefaultApiTest.java new file mode 100644 index 000000000000..9dbc195b0857 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -0,0 +1,78 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.FakeAnyOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FakeOneOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FooGetDefaultResponse; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for DefaultApi + */ +@Disabled +public class DefaultApiTest { + + private final DefaultApi api = new DefaultApi(); + + /** + * Test route, this shouldn't cause a compiler error + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeAnyOfWIthSameErasureGetTest() throws ApiException { + FakeAnyOfWIthSameErasureGet200Response response = api.fakeAnyOfWIthSameErasureGet(); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fakeFreeFormQueryParametersGetTest() throws ApiException { + String fixed = null; + Object freeForm = null; + api.fakeFreeFormQueryParametersGet(fixed, freeForm); + // TODO: test validations + } + + /** + * Test route, this shouldn't cause a compiler error + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOneOfWIthSameErasureGetTest() throws ApiException { + FakeOneOfWIthSameErasureGet200Response response = api.fakeOneOfWIthSameErasureGet(); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fooGetTest() throws ApiException { + FooGetDefaultResponse response = api.fooGet(); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 000000000000..095dfdcd2304 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,395 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import org.openapitools.client.model.FakeRefParameterPetIdParameter; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.FreeFormObjectTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.NullableFieldsMapResponse; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.RequiredNullableBody; +import org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +@Disabled +public class FakeApiTest { + + private final FakeApi api = new FakeApi(); + + /** + * Get a free form object or Json string + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeGetFreeFormObjectGetTest() throws ApiException { + FreeFormObjectTestClass response = api.fakeGetFreeFormObjectGet(); + // TODO: test validations + } + + /** + * Test serialization of outer boolean types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterBooleanSerializeTest() throws ApiException { + Boolean body = null; + Boolean response = api.fakeOuterBooleanSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of object with outer number type + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterCompositeSerializeTest() throws ApiException { + OuterComposite outerComposite = null; + OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite); + // TODO: test validations + } + + /** + * Test serialization of outer number types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterNumberSerializeTest() throws ApiException { + BigDecimal body = null; + BigDecimal response = api.fakeOuterNumberSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of outer string types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterStringSerializeTest() throws ApiException { + String body = null; + String response = api.fakeOuterStringSerialize(body); + // TODO: test validations + } + + /** + * fake reference parameter + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeRefParameterTest() throws ApiException { + FakeRefParameterPetIdParameter petId = null; + api.fakeRefParameter(petId); + // TODO: test validations + } + + /** + * fields in the response body, required and nullable are both true + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeRequiredNullableBodyGetTest() throws ApiException { + RequiredNullableBody response = api.fakeRequiredNullableBodyGet(); + // TODO: test validations + } + + /** + * fake reference parameter + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeUploadRefRequestBodiesTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.fakeUploadRefRequestBodies(petId, additionalMetadata, _file); + // TODO: test validations + } + + /** + * Array of Enums + * + * @throws ApiException if the Api call fails + */ + @Test + public void getFakeArrayofenumsTest() throws ApiException { + List response = api.getFakeArrayofenums(); + // TODO: test validations + } + + /** + * Health check endpoint + * + * @throws ApiException if the Api call fails + */ + @Test + public void getFakeHealthTest() throws ApiException { + HealthCheckResult response = api.getFakeHealth(); + // TODO: test validations + } + + /** + * parameter name mapping test + * + * @throws ApiException if the Api call fails + */ + @Test + public void getParameterNameMappingTest() throws ApiException { + Long underscoreType = null; + String type = null; + String typeWithUnderscore = null; + api.getParameterNameMapping(underscoreType, type, typeWithUnderscore); + // TODO: test validations + } + + /** + * test referenced additionalProperties + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testAdditionalPropertiesReferenceTest() throws ApiException { + Map requestBody = null; + api.testAdditionalPropertiesReference(requestBody); + // TODO: test validations + } + + /** + * For this test, the body for this request much reference a schema named `File`. + * + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithFileSchemaTest() throws ApiException { + FileSchemaTestClass fileSchemaTestClass = null; + api.testBodyWithFileSchema(fileSchemaTestClass); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithQueryParamsTest() throws ApiException { + String query = null; + User user = null; + api.testBodyWithQueryParams(query, user); + // TODO: test validations + } + + /** + * To test \"client\" model + * + * To test \"client\" model + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClientModelTest() throws ApiException { + Client client = null; + Client response = api.testClientModel(client); + // TODO: test validations + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEndpointParametersTest() throws ApiException { + BigDecimal number = null; + Double _double = null; + String patternWithoutDelimiter = null; + byte[] _byte = null; + Integer integer = null; + Integer int32 = null; + Long int64 = null; + Float _float = null; + String string = null; + File binary = null; + LocalDate date = null; + OffsetDateTime dateTime = null; + String password = null; + String paramCallback = null; + api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + // TODO: test validations + } + + /** + * To test enum parameters + * + * To test enum parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEnumParametersTest() throws ApiException { + List enumHeaderStringArray = null; + String enumHeaderString = null; + List enumQueryStringArray = null; + String enumQueryString = null; + Integer enumQueryInteger = null; + Double enumQueryDouble = null; + List enumFormStringArray = null; + String enumFormString = null; + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + // TODO: test validations + } + + /** + * Fake endpoint to test group parameters (optional) + * + * Fake endpoint to test group parameters (optional) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testGroupParametersTest() throws ApiException { + Integer requiredStringGroup = null; + Boolean requiredBooleanGroup = null; + Long requiredInt64Group = null; + Integer stringGroup = null; + Boolean booleanGroup = null; + Long int64Group = null; + api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + // TODO: test validations + } + + /** + * test inline additionalProperties + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testInlineAdditionalPropertiesTest() throws ApiException { + Map requestBody = null; + api.testInlineAdditionalProperties(requestBody); + // TODO: test validations + } + + /** + * test inline free-form additionalProperties + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testInlineFreeformAdditionalPropertiesTest() throws ApiException { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = null; + api.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + // TODO: test validations + } + + /** + * test json serialization of form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testJsonFormDataTest() throws ApiException { + String param = null; + String param2 = null; + api.testJsonFormData(param, param2); + // TODO: test validations + } + + /** + * test anyOf with map of objects containing nullable required fields + * + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testNullableRequiredFieldsAnyOfTest() throws ApiException { + NullableFieldsMapResponse response = api.testNullableRequiredFieldsAnyOf(); + // TODO: test validations + } + + /** + * To test the collection format in query parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryParameterCollectionFormatTest() throws ApiException { + List pipe = null; + List ioutil = null; + List http = null; + List url = null; + List context = null; + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + // TODO: test validations + } + + /** + * test referenced string map + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testStringMapReferenceTest() throws ApiException { + Map requestBody = null; + api.testStringMapReference(requestBody); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 000000000000..aa1b824dd5a2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Client; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Disabled +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + /** + * To test class name in snake case + * + * To test class name in snake case + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + Client client = null; + Client response = api.testClassname(client); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..a1d3d6377d68 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,170 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + api.addPet(pet); + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + api.updatePet(pet); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String contentType = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.uploadFile(petId, contentType, additionalMetadata, _file); + // TODO: test validations + } + + /** + * uploads an image (required) + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileWithRequiredFileTest() throws ApiException { + Long petId = null; + File requiredFile = null; + String additionalMetadata = null; + ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..98354ba10c08 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,89 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = api.getOrderById(orderId); + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order order = null; + Order response = api.placeOrder(order); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..aa9aff49b4df --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,148 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User user = null; + api.createUser(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List user = null; + api.createUsersWithArrayInput(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List user = null; + api.createUsersWithListInput(user); + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + api.deleteUser(username); + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + api.logoutUser(); + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User user = null; + api.updateUser(username, user); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/ValuesApiTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/ValuesApiTest.java new file mode 100644 index 000000000000..89a1ad0febc4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/api/ValuesApiTest.java @@ -0,0 +1,47 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Variable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for ValuesApi + */ +@Disabled +public class ValuesApiTest { + + private final ValuesApi api = new ValuesApi(); + + /** + * Get some primitive variable values + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getSomeValuesTest() throws ApiException { + Variable response = api.getSomeValues(); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..6b124da1d415 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java @@ -0,0 +1,108 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesClass + */ +public class AdditionalPropertiesClassTest { + private final AdditionalPropertiesClass model = new AdditionalPropertiesClass(); + + /** + * Model tests for AdditionalPropertiesClass + */ + @Test + public void testAdditionalPropertiesClass() { + // TODO: test AdditionalPropertiesClass + } + + /** + * Test the property 'mapProperty' + */ + @Test + public void mapPropertyTest() { + // TODO: test mapProperty + } + + /** + * Test the property 'mapOfMapProperty' + */ + @Test + public void mapOfMapPropertyTest() { + // TODO: test mapOfMapProperty + } + + /** + * Test the property 'anytype1' + */ + @Test + public void anytype1Test() { + // TODO: test anytype1 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype1' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype1Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype1 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype2' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype2Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype2 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype3' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype3Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype3 + } + + /** + * Test the property 'emptyMap' + */ + @Test + public void emptyMapTest() { + // TODO: test emptyMap + } + + /** + * Test the property 'mapWithUndeclaredPropertiesString' + */ + @Test + public void mapWithUndeclaredPropertiesStringTest() { + // TODO: test mapWithUndeclaredPropertiesString + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java new file mode 100644 index 000000000000..364f9ff176f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java @@ -0,0 +1,126 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Order; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfAttributesC + */ +public class AllOfModelArrayAnyOfAllOfAttributesCTest { + private final AllOfModelArrayAnyOfAllOfAttributesC model = new AllOfModelArrayAnyOfAllOfAttributesC(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfAttributesC + */ + @Test + public void testAllOfModelArrayAnyOfAllOfAttributesC() { + // TODO: test AllOfModelArrayAnyOfAllOfAttributesC + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java new file mode 100644 index 000000000000..62ee3dde5bec --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributesC; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfAttributes + */ +public class AllOfModelArrayAnyOfAllOfAttributesTest { + private final AllOfModelArrayAnyOfAllOfAttributes model = new AllOfModelArrayAnyOfAllOfAttributes(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfAttributes + */ + @Test + public void testAllOfModelArrayAnyOfAllOfAttributes() { + // TODO: test AllOfModelArrayAnyOfAllOfAttributes + } + + /** + * Test the property 'C' + */ + @Test + public void CTest() { + // TODO: test C + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java new file mode 100644 index 000000000000..6fda96074757 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1Value; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ +public class AllOfModelArrayAnyOfAllOfLinkListColumn1Test { + private final AllOfModelArrayAnyOfAllOfLinkListColumn1 model = new AllOfModelArrayAnyOfAllOfLinkListColumn1(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ + @Test + public void testAllOfModelArrayAnyOfAllOfLinkListColumn1() { + // TODO: test AllOfModelArrayAnyOfAllOfLinkListColumn1 + } + + /** + * Test the property 'value' + */ + @Test + public void valueTest() { + // TODO: test value + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java new file mode 100644 index 000000000000..66d947344c39 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java @@ -0,0 +1,148 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Tag; +import org.openapitools.client.model.User; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1Value + */ +public class AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest { + private final AllOfModelArrayAnyOfAllOfLinkListColumn1Value model = new AllOfModelArrayAnyOfAllOfLinkListColumn1Value(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1Value + */ + @Test + public void testAllOfModelArrayAnyOfAllOfLinkListColumn1Value() { + // TODO: test AllOfModelArrayAnyOfAllOfLinkListColumn1Value + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + + /** + * Test the property 'objectWithNoDeclaredProps' + */ + @Test + public void objectWithNoDeclaredPropsTest() { + // TODO: test objectWithNoDeclaredProps + } + + /** + * Test the property 'objectWithNoDeclaredPropsNullable' + */ + @Test + public void objectWithNoDeclaredPropsNullableTest() { + // TODO: test objectWithNoDeclaredPropsNullable + } + + /** + * Test the property 'anyTypeProp' + */ + @Test + public void anyTypePropTest() { + // TODO: test anyTypeProp + } + + /** + * Test the property 'anyTypePropNullable' + */ + @Test + public void anyTypePropNullableTest() { + // TODO: test anyTypePropNullable + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java new file mode 100644 index 000000000000..4046f22608b8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributes; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOf + */ +public class AllOfModelArrayAnyOfTest { + private final AllOfModelArrayAnyOf model = new AllOfModelArrayAnyOf(); + + /** + * Model tests for AllOfModelArrayAnyOf + */ + @Test + public void testAllOfModelArrayAnyOf() { + // TODO: test AllOfModelArrayAnyOf + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'linkListColumn1' + */ + @Test + public void linkListColumn1Test() { + // TODO: test linkListColumn1 + } + + /** + * Test the property 'attributes' + */ + @Test + public void attributesTest() { + // TODO: test attributes + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java new file mode 100644 index 000000000000..018e656e16ab --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToDouble + */ +public class AllOfRefToDoubleTest { + private final AllOfRefToDouble model = new AllOfRefToDouble(); + + /** + * Model tests for AllOfRefToDouble + */ + @Test + public void testAllOfRefToDouble() { + // TODO: test AllOfRefToDouble + } + + /** + * Test the property 'height' + */ + @Test + public void heightTest() { + // TODO: test height + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java new file mode 100644 index 000000000000..efda922f130a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToFloat + */ +public class AllOfRefToFloatTest { + private final AllOfRefToFloat model = new AllOfRefToFloat(); + + /** + * Model tests for AllOfRefToFloat + */ + @Test + public void testAllOfRefToFloat() { + // TODO: test AllOfRefToFloat + } + + /** + * Test the property 'weight' + */ + @Test + public void weightTest() { + // TODO: test weight + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java new file mode 100644 index 000000000000..be51215e9ce6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToLong + */ +public class AllOfRefToLongTest { + private final AllOfRefToLong model = new AllOfRefToLong(); + + /** + * Model tests for AllOfRefToLong + */ + @Test + public void testAllOfRefToLong() { + // TODO: test AllOfRefToLong + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AnimalTest.java new file mode 100644 index 000000000000..daae39c62bac --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Animal + */ +public class AnimalTest { + private final Animal model = new Animal(); + + /** + * Model tests for Animal + */ + @Test + public void testAnimal() { + // TODO: test Animal + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AppleReqTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AppleReqTest.java new file mode 100644 index 000000000000..2d66eff8eb3e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AppleReqTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AppleReq + */ +public class AppleReqTest { + private final AppleReq model = new AppleReq(); + + /** + * Model tests for AppleReq + */ + @Test + public void testAppleReq() { + // TODO: test AppleReq + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'mealy' + */ + @Test + public void mealyTest() { + // TODO: test mealy + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AppleTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AppleTest.java new file mode 100644 index 000000000000..4f918d2be1da --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/AppleTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Apple + */ +public class AppleTest { + private final Apple model = new Apple(); + + /** + * Model tests for Apple + */ + @Test + public void testApple() { + // TODO: test Apple + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java new file mode 100644 index 000000000000..ab635fd6b72f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java @@ -0,0 +1,34 @@ +/* + * 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.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayAnyOf + */ +public class ArrayAnyOfTest { + private final ArrayAnyOf model = new ArrayAnyOf(); + + /** + * Model tests for ArrayAnyOf + */ + @Test + public void testArrayAnyOf() { + // TODO: test ArrayAnyOf + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java new file mode 100644 index 000000000000..9fd94484aa64 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayDefault + */ +public class ArrayDefaultTest { + private final ArrayDefault model = new ArrayDefault(); + + /** + * Model tests for ArrayDefault + */ + @Test + public void testArrayDefault() { + // TODO: test ArrayDefault + } + + /** + * Test the property 'withDefaultEmptyBracket' + */ + @Test + public void withDefaultEmptyBracketTest() { + // TODO: test withDefaultEmptyBracket + } + + /** + * Test the property 'withoutDefault' + */ + @Test + public void withoutDefaultTest() { + // TODO: test withoutDefault + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..df6a785bd880 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfArrayOfNumberOnly + */ +public class ArrayOfArrayOfNumberOnlyTest { + private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfArrayOfNumberOnly + */ + @Test + public void testArrayOfArrayOfNumberOnly() { + // TODO: test ArrayOfArrayOfNumberOnly + } + + /** + * Test the property 'arrayArrayNumber' + */ + @Test + public void arrayArrayNumberTest() { + // TODO: test arrayArrayNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java new file mode 100644 index 000000000000..e07beacf51b4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ +public class ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest { + private final ArrayOfInlineAllOfArrayAllofDogPropertyInner model = new ArrayOfInlineAllOfArrayAllofDogPropertyInner(); + + /** + * Model tests for ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ + @Test + public void testArrayOfInlineAllOfArrayAllofDogPropertyInner() { + // TODO: test ArrayOfInlineAllOfArrayAllofDogPropertyInner + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java new file mode 100644 index 000000000000..768041ce78a9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ArrayOfInlineAllOfArrayAllofDogPropertyInner; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfInlineAllOf + */ +public class ArrayOfInlineAllOfTest { + private final ArrayOfInlineAllOf model = new ArrayOfInlineAllOf(); + + /** + * Model tests for ArrayOfInlineAllOf + */ + @Test + public void testArrayOfInlineAllOf() { + // TODO: test ArrayOfInlineAllOf + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'arrayAllofDogProperty' + */ + @Test + public void arrayAllofDogPropertyTest() { + // TODO: test arrayAllofDogProperty + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..b29f5d974057 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfNumberOnly + */ +public class ArrayOfNumberOnlyTest { + private final ArrayOfNumberOnly model = new ArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfNumberOnly + */ + @Test + public void testArrayOfNumberOnly() { + // TODO: test ArrayOfNumberOnly + } + + /** + * Test the property 'arrayNumber' + */ + @Test + public void arrayNumberTest() { + // TODO: test arrayNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java new file mode 100644 index 000000000000..7f9af8d893c0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java @@ -0,0 +1,34 @@ +/* + * 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.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOneOf + */ +public class ArrayOneOfTest { + private final ArrayOneOf model = new ArrayOneOf(); + + /** + * Model tests for ArrayOneOf + */ + @Test + public void testArrayOneOf() { + // TODO: test ArrayOneOf + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayTestTest.java new file mode 100644 index 000000000000..58cc51d25618 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ArrayTestTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayTest + */ +public class ArrayTestTest { + private final ArrayTest model = new ArrayTest(); + + /** + * Model tests for ArrayTest + */ + @Test + public void testArrayTest() { + // TODO: test ArrayTest + } + + /** + * Test the property 'arrayOfString' + */ + @Test + public void arrayOfStringTest() { + // TODO: test arrayOfString + } + + /** + * Test the property 'arrayArrayOfInteger' + */ + @Test + public void arrayArrayOfIntegerTest() { + // TODO: test arrayArrayOfInteger + } + + /** + * Test the property 'arrayArrayOfModel' + */ + @Test + public void arrayArrayOfModelTest() { + // TODO: test arrayArrayOfModel + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/BananaReqTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/BananaReqTest.java new file mode 100644 index 000000000000..47f5aa1af7a0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/BananaReqTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BananaReq + */ +public class BananaReqTest { + private final BananaReq model = new BananaReq(); + + /** + * Model tests for BananaReq + */ + @Test + public void testBananaReq() { + // TODO: test BananaReq + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + + /** + * Test the property 'sweet' + */ + @Test + public void sweetTest() { + // TODO: test sweet + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/BananaTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/BananaTest.java new file mode 100644 index 000000000000..b5159749b97e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/BananaTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Banana + */ +public class BananaTest { + private final Banana model = new Banana(); + + /** + * Model tests for Banana + */ + @Test + public void testBanana() { + // TODO: test Banana + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/BasquePigTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/BasquePigTest.java new file mode 100644 index 000000000000..3234980f3183 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/BasquePigTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BasquePig + */ +public class BasquePigTest { + private final BasquePig model = new BasquePig(); + + /** + * Model tests for BasquePig + */ + @Test + public void testBasquePig() { + // TODO: test BasquePig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/CapitalizationTest.java new file mode 100644 index 000000000000..91604cef7694 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/CapitalizationTest.java @@ -0,0 +1,86 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Capitalization + */ +public class CapitalizationTest { + private final Capitalization model = new Capitalization(); + + /** + * Model tests for Capitalization + */ + @Test + public void testCapitalization() { + // TODO: test Capitalization + } + + /** + * Test the property 'smallCamel' + */ + @Test + public void smallCamelTest() { + // TODO: test smallCamel + } + + /** + * Test the property 'capitalCamel' + */ + @Test + public void capitalCamelTest() { + // TODO: test capitalCamel + } + + /** + * Test the property 'smallSnake' + */ + @Test + public void smallSnakeTest() { + // TODO: test smallSnake + } + + /** + * Test the property 'capitalSnake' + */ + @Test + public void capitalSnakeTest() { + // TODO: test capitalSnake + } + + /** + * Test the property 'scAETHFlowPoints' + */ + @Test + public void scAETHFlowPointsTest() { + // TODO: test scAETHFlowPoints + } + + /** + * Test the property 'ATT_NAME' + */ + @Test + public void ATT_NAMETest() { + // TODO: test ATT_NAME + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/CatTest.java new file mode 100644 index 000000000000..d606c9cba4e3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/CatTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Map; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Cat + */ +public class CatTest { + private final Cat model = new Cat(); + + /** + * Model tests for Cat + */ + @Test + public void testCat() { + // TODO: test Cat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..f19c4e969e86 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ClassModelTest.java new file mode 100644 index 000000000000..7423221f9aae --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ClassModelTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ClassModel + */ +public class ClassModelTest { + private final ClassModel model = new ClassModel(); + + /** + * Model tests for ClassModel + */ + @Test + public void testClassModel() { + // TODO: test ClassModel + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ClientTest.java new file mode 100644 index 000000000000..f918526e8b58 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ClientTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Client + */ +public class ClientTest { + private final Client model = new Client(); + + /** + * Model tests for Client + */ + @Test + public void testClient() { + // TODO: test Client + } + + /** + * Test the property 'client' + */ + @Test + public void clientTest() { + // TODO: test client + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java new file mode 100644 index 000000000000..9ef9daa47fc4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ComplexQuadrilateral + */ +public class ComplexQuadrilateralTest { + private final ComplexQuadrilateral model = new ComplexQuadrilateral(); + + /** + * Model tests for ComplexQuadrilateral + */ + @Test + public void testComplexQuadrilateral() { + // TODO: test ComplexQuadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DanishPigTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DanishPigTest.java new file mode 100644 index 000000000000..7bce23c1db5a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DanishPigTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DanishPig + */ +public class DanishPigTest { + private final DanishPig model = new DanishPig(); + + /** + * Model tests for DanishPig + */ + @Test + public void testDanishPig() { + // TODO: test DanishPig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java new file mode 100644 index 000000000000..dbc1ec7c69ed --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DeprecatedObject + */ +public class DeprecatedObjectTest { + private final DeprecatedObject model = new DeprecatedObject(); + + /** + * Model tests for DeprecatedObject + */ + @Test + public void testDeprecatedObject() { + // TODO: test DeprecatedObject + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DogTest.java new file mode 100644 index 000000000000..30f26b674018 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DogTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Dog + */ +public class DogTest { + private final Dog model = new Dog(); + + /** + * Model tests for Dog + */ + @Test + public void testDog() { + // TODO: test Dog + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DrawingTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DrawingTest.java new file mode 100644 index 000000000000..f150a69643bb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/DrawingTest.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 com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Fruit; +import org.openapitools.client.model.NullableShape; +import org.openapitools.client.model.Shape; +import org.openapitools.client.model.ShapeOrNull; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Drawing + */ +public class DrawingTest { + private final Drawing model = new Drawing(); + + /** + * Model tests for Drawing + */ + @Test + public void testDrawing() { + // TODO: test Drawing + } + + /** + * Test the property 'mainShape' + */ + @Test + public void mainShapeTest() { + // TODO: test mainShape + } + + /** + * Test the property 'shapeOrNull' + */ + @Test + public void shapeOrNullTest() { + // TODO: test shapeOrNull + } + + /** + * Test the property 'nullableShape' + */ + @Test + public void nullableShapeTest() { + // TODO: test nullableShape + } + + /** + * Test the property 'shapes' + */ + @Test + public void shapesTest() { + // TODO: test shapes + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumArraysTest.java new file mode 100644 index 000000000000..2dd56fe0192f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumArraysTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumArrays + */ +public class EnumArraysTest { + private final EnumArrays model = new EnumArrays(); + + /** + * Model tests for EnumArrays + */ + @Test + public void testEnumArrays() { + // TODO: test EnumArrays + } + + /** + * Test the property 'justSymbol' + */ + @Test + public void justSymbolTest() { + // TODO: test justSymbol + } + + /** + * Test the property 'arrayEnum' + */ + @Test + public void arrayEnumTest() { + // TODO: test arrayEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumClassTest.java new file mode 100644 index 000000000000..6896bb0a4e90 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumClassTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumClass + */ +public class EnumClassTest { + /** + * Model tests for EnumClass + */ + @Test + public void testEnumClass() { + // TODO: test EnumClass + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java new file mode 100644 index 000000000000..21a18efd2b38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumStringDiscriminator + */ +public class EnumStringDiscriminatorTest { + private final EnumStringDiscriminator model = new EnumStringDiscriminator(); + + /** + * Model tests for EnumStringDiscriminator + */ + @Test + public void testEnumStringDiscriminator() { + // TODO: test EnumStringDiscriminator + } + + /** + * Test the property 'enumStrType' + */ + @Test + public void enumStrTypeTest() { + // TODO: test enumStrType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumTestTest.java new file mode 100644 index 000000000000..16798e61ba6d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EnumTestTest.java @@ -0,0 +1,118 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.OuterEnumDefaultValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.openapitools.client.model.OuterEnumIntegerDefaultValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumTest + */ +public class EnumTestTest { + private final EnumTest model = new EnumTest(); + + /** + * Model tests for EnumTest + */ + @Test + public void testEnumTest() { + // TODO: test EnumTest + } + + /** + * Test the property 'enumString' + */ + @Test + public void enumStringTest() { + // TODO: test enumString + } + + /** + * Test the property 'enumStringRequired' + */ + @Test + public void enumStringRequiredTest() { + // TODO: test enumStringRequired + } + + /** + * Test the property 'enumInteger' + */ + @Test + public void enumIntegerTest() { + // TODO: test enumInteger + } + + /** + * Test the property 'enumIntegerOnly' + */ + @Test + public void enumIntegerOnlyTest() { + // TODO: test enumIntegerOnly + } + + /** + * Test the property 'enumNumber' + */ + @Test + public void enumNumberTest() { + // TODO: test enumNumber + } + + /** + * Test the property 'outerEnum' + */ + @Test + public void outerEnumTest() { + // TODO: test outerEnum + } + + /** + * Test the property 'outerEnumInteger' + */ + @Test + public void outerEnumIntegerTest() { + // TODO: test outerEnumInteger + } + + /** + * Test the property 'outerEnumDefaultValue' + */ + @Test + public void outerEnumDefaultValueTest() { + // TODO: test outerEnumDefaultValue + } + + /** + * Test the property 'outerEnumIntegerDefaultValue' + */ + @Test + public void outerEnumIntegerDefaultValueTest() { + // TODO: test outerEnumIntegerDefaultValue + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java new file mode 100644 index 000000000000..5537cc246686 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EquilateralTriangle + */ +public class EquilateralTriangleTest { + private final EquilateralTriangle model = new EquilateralTriangle(); + + /** + * Model tests for EquilateralTriangle + */ + @Test + public void testEquilateralTriangle() { + // TODO: test EquilateralTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java new file mode 100644 index 000000000000..182663803649 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java @@ -0,0 +1,35 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeAnyOfWIthSameErasureGet200Response + */ +public class FakeAnyOfWIthSameErasureGet200ResponseTest { + private final FakeAnyOfWIthSameErasureGet200Response model = new FakeAnyOfWIthSameErasureGet200Response(); + + /** + * Model tests for FakeAnyOfWIthSameErasureGet200Response + */ + @Test + public void testFakeAnyOfWIthSameErasureGet200Response() { + // TODO: test FakeAnyOfWIthSameErasureGet200Response + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java new file mode 100644 index 000000000000..9e2b356e1c48 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java @@ -0,0 +1,35 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeOneOfWIthSameErasureGet200Response + */ +public class FakeOneOfWIthSameErasureGet200ResponseTest { + private final FakeOneOfWIthSameErasureGet200Response model = new FakeOneOfWIthSameErasureGet200Response(); + + /** + * Model tests for FakeOneOfWIthSameErasureGet200Response + */ + @Test + public void testFakeOneOfWIthSameErasureGet200Response() { + // TODO: test FakeOneOfWIthSameErasureGet200Response + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java new file mode 100644 index 000000000000..26e884015e01 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java @@ -0,0 +1,34 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeRefParameterPetIdParameter + */ +public class FakeRefParameterPetIdParameterTest { + private final FakeRefParameterPetIdParameter model = new FakeRefParameterPetIdParameter(); + + /** + * Model tests for FakeRefParameterPetIdParameter + */ + @Test + public void testFakeRefParameterPetIdParameter() { + // TODO: test FakeRefParameterPetIdParameter + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java new file mode 100644 index 000000000000..e4944d1ef535 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FileSchemaTestClass + */ +public class FileSchemaTestClassTest { + private final FileSchemaTestClass model = new FileSchemaTestClass(); + + /** + * Model tests for FileSchemaTestClass + */ + @Test + public void testFileSchemaTestClass() { + // TODO: test FileSchemaTestClass + } + + /** + * Test the property '_file' + */ + @Test + public void _fileTest() { + // TODO: test _file + } + + /** + * Test the property 'files' + */ + @Test + public void filesTest() { + // TODO: test files + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java new file mode 100644 index 000000000000..fb1a8a54a199 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Foo; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FooGetDefaultResponse + */ +public class FooGetDefaultResponseTest { + private final FooGetDefaultResponse model = new FooGetDefaultResponse(); + + /** + * Model tests for FooGetDefaultResponse + */ + @Test + public void testFooGetDefaultResponse() { + // TODO: test FooGetDefaultResponse + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FooTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FooTest.java new file mode 100644 index 000000000000..55c7ce67fd3c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FooTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Foo + */ +public class FooTest { + private final Foo model = new Foo(); + + /** + * Model tests for Foo + */ + @Test + public void testFoo() { + // TODO: test Foo + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FormatTestTest.java new file mode 100644 index 000000000000..3d296b5869f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -0,0 +1,179 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FormatTest + */ +public class FormatTestTest { + private final FormatTest model = new FormatTest(); + + /** + * Model tests for FormatTest + */ + @Test + public void testFormatTest() { + // TODO: test FormatTest + } + + /** + * Test the property 'integer' + */ + @Test + public void integerTest() { + // TODO: test integer + } + + /** + * Test the property 'int32' + */ + @Test + public void int32Test() { + // TODO: test int32 + } + + /** + * Test the property 'int64' + */ + @Test + public void int64Test() { + // TODO: test int64 + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property '_float' + */ + @Test + public void _floatTest() { + // TODO: test _float + } + + /** + * Test the property '_double' + */ + @Test + public void _doubleTest() { + // TODO: test _double + } + + /** + * Test the property 'decimal' + */ + @Test + public void decimalTest() { + // TODO: test decimal + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + + /** + * Test the property '_byte' + */ + @Test + public void _byteTest() { + // TODO: test _byte + } + + /** + * Test the property 'binary' + */ + @Test + public void binaryTest() { + // TODO: test binary + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'uuidWithDefault' + */ + @Test + public void uuidWithDefaultTest() { + // TODO: test uuidWithDefault + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'patternWithDigits' + */ + @Test + public void patternWithDigitsTest() { + // TODO: test patternWithDigits + } + + /** + * Test the property 'patternWithDigitsAndDelimiter' + */ + @Test + public void patternWithDigitsAndDelimiterTest() { + // TODO: test patternWithDigitsAndDelimiter + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java new file mode 100644 index 000000000000..c41fd53da980 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java @@ -0,0 +1,35 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FreeFormObjectTestClassProperties + */ +public class FreeFormObjectTestClassPropertiesTest { + private final FreeFormObjectTestClassProperties model = new FreeFormObjectTestClassProperties(); + + /** + * Model tests for FreeFormObjectTestClassProperties + */ + @Test + public void testFreeFormObjectTestClassProperties() { + // TODO: test FreeFormObjectTestClassProperties + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java new file mode 100644 index 000000000000..971c5c7f6d4a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.FreeFormObjectTestClassProperties; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FreeFormObjectTestClass + */ +public class FreeFormObjectTestClassTest { + private final FreeFormObjectTestClass model = new FreeFormObjectTestClass(); + + /** + * Model tests for FreeFormObjectTestClass + */ + @Test + public void testFreeFormObjectTestClass() { + // TODO: test FreeFormObjectTestClass + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'properties' + */ + @Test + public void propertiesTest() { + // TODO: test properties + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FruitReqTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FruitReqTest.java new file mode 100644 index 000000000000..820564e0dbd9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FruitReqTest.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FruitReq + */ +public class FruitReqTest { + private final FruitReq model = new FruitReq(); + + /** + * Model tests for FruitReq + */ + @Test + public void testFruitReq() { + // TODO: test FruitReq + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'mealy' + */ + @Test + public void mealyTest() { + // TODO: test mealy + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + + /** + * Test the property 'sweet' + */ + @Test + public void sweetTest() { + // TODO: test sweet + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FruitTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FruitTest.java new file mode 100644 index 000000000000..c693140d0b0f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/FruitTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Fruit + */ +public class FruitTest { + private final Fruit model = new Fruit(); + + /** + * Model tests for Fruit + */ + @Test + public void testFruit() { + // TODO: test Fruit + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/GmFruitTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/GmFruitTest.java new file mode 100644 index 000000000000..68613aca12af --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/GmFruitTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for GmFruit + */ +public class GmFruitTest { + private final GmFruit model = new GmFruit(); + + /** + * Model tests for GmFruit + */ + @Test + public void testGmFruit() { + // TODO: test GmFruit + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java new file mode 100644 index 000000000000..a230a9ca2555 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for GrandparentAnimal + */ +public class GrandparentAnimalTest { + private final GrandparentAnimal model = new GrandparentAnimal(); + + /** + * Model tests for GrandparentAnimal + */ + @Test + public void testGrandparentAnimal() { + // TODO: test GrandparentAnimal + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java new file mode 100644 index 000000000000..45a4e19730f4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HasOnlyReadOnly + */ +public class HasOnlyReadOnlyTest { + private final HasOnlyReadOnly model = new HasOnlyReadOnly(); + + /** + * Model tests for HasOnlyReadOnly + */ + @Test + public void testHasOnlyReadOnly() { + // TODO: test HasOnlyReadOnly + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'foo' + */ + @Test + public void fooTest() { + // TODO: test foo + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java new file mode 100644 index 000000000000..0bbf3bcfe0cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HealthCheckResult + */ +public class HealthCheckResultTest { + private final HealthCheckResult model = new HealthCheckResult(); + + /** + * Model tests for HealthCheckResult + */ + @Test + public void testHealthCheckResult() { + // TODO: test HealthCheckResult + } + + /** + * Test the property 'nullableMessage' + */ + @Test + public void nullableMessageTest() { + // TODO: test nullableMessage + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java new file mode 100644 index 000000000000..4a3a5b5c1bf8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for IsoscelesTriangle + */ +public class IsoscelesTriangleTest { + private final IsoscelesTriangle model = new IsoscelesTriangle(); + + /** + * Model tests for IsoscelesTriangle + */ + @Test + public void testIsoscelesTriangle() { + // TODO: test IsoscelesTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MammalAnyofTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MammalAnyofTest.java new file mode 100644 index 000000000000..5ab2eb90bbd1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MammalAnyofTest.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MammalAnyof + */ +public class MammalAnyofTest { + private final MammalAnyof model = new MammalAnyof(); + + /** + * Model tests for MammalAnyof + */ + @Test + public void testMammalAnyof() { + // TODO: test MammalAnyof + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MammalTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MammalTest.java new file mode 100644 index 000000000000..1cb4d066f7f6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MammalTest.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Mammal + */ +public class MammalTest { + private final Mammal model = new Mammal(); + + /** + * Model tests for Mammal + */ + @Test + public void testMammal() { + // TODO: test Mammal + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MapTestTest.java new file mode 100644 index 000000000000..05143360a96c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MapTestTest.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MapTest + */ +public class MapTestTest { + private final MapTest model = new MapTest(); + + /** + * Model tests for MapTest + */ + @Test + public void testMapTest() { + // TODO: test MapTest + } + + /** + * Test the property 'mapMapOfString' + */ + @Test + public void mapMapOfStringTest() { + // TODO: test mapMapOfString + } + + /** + * Test the property 'mapOfEnumString' + */ + @Test + public void mapOfEnumStringTest() { + // TODO: test mapOfEnumString + } + + /** + * Test the property 'directMap' + */ + @Test + public void directMapTest() { + // TODO: test directMap + } + + /** + * Test the property 'indirectMap' + */ + @Test + public void indirectMapTest() { + // TODO: test indirectMap + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..9bf60578ad2f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ +public class MixedPropertiesAndAdditionalPropertiesClassTest { + private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass(); + + /** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ + @Test + public void testMixedPropertiesAndAdditionalPropertiesClass() { + // TODO: test MixedPropertiesAndAdditionalPropertiesClass + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'map' + */ + @Test + public void mapTest() { + // TODO: test map + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/Model200ResponseTest.java new file mode 100644 index 000000000000..00ba2d5752d6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/Model200ResponseTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Model200Response + */ +public class Model200ResponseTest { + private final Model200Response model = new Model200Response(); + + /** + * Model tests for Model200Response + */ + @Test + public void testModel200Response() { + // TODO: test Model200Response + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..229bfff03a75 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelApiResponseTest.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.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelFileTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelFileTest.java new file mode 100644 index 000000000000..cd302c0d9bd3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelFileTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelFile + */ +public class ModelFileTest { + private final ModelFile model = new ModelFile(); + + /** + * Model tests for ModelFile + */ + @Test + public void testModelFile() { + // TODO: test ModelFile + } + + /** + * Test the property 'sourceURI' + */ + @Test + public void sourceURITest() { + // TODO: test sourceURI + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelListTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelListTest.java new file mode 100644 index 000000000000..4f57b59fb5e4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelListTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelList + */ +public class ModelListTest { + private final ModelList model = new ModelList(); + + /** + * Model tests for ModelList + */ + @Test + public void testModelList() { + // TODO: test ModelList + } + + /** + * Test the property '_123list' + */ + @Test + public void _123listTest() { + // TODO: test _123list + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelReturnTest.java new file mode 100644 index 000000000000..db85d17e73f8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelReturnTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelReturn + */ +public class ModelReturnTest { + private final ModelReturn model = new ModelReturn(); + + /** + * Model tests for ModelReturn + */ + @Test + public void testModelReturn() { + // TODO: test ModelReturn + } + + /** + * Test the property '_return' + */ + @Test + public void _returnTest() { + // TODO: test _return + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java new file mode 100644 index 000000000000..0fa67bef754e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.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.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.ArrayAnyOf; +import org.openapitools.client.model.ArrayOneOf; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelWithOneOfAnyOfProperties + */ +public class ModelWithOneOfAnyOfPropertiesTest { + private final ModelWithOneOfAnyOfProperties model = new ModelWithOneOfAnyOfProperties(); + + /** + * Model tests for ModelWithOneOfAnyOfProperties + */ + @Test + public void testModelWithOneOfAnyOfProperties() { + // TODO: test ModelWithOneOfAnyOfProperties + } + + /** + * Test the property 'oneofProp' + */ + @Test + public void oneofPropTest() { + // TODO: test oneofProp + } + + /** + * Test the property 'anyofProp' + */ + @Test + public void anyofPropTest() { + // TODO: test anyofProp + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NameTest.java new file mode 100644 index 000000000000..81b29f94c4a7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NameTest.java @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Name + */ +public class NameTest { + private final Name model = new Name(); + + /** + * Model tests for Name + */ + @Test + public void testName() { + // TODO: test Name + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'snakeCase' + */ + @Test + public void snakeCaseTest() { + // TODO: test snakeCase + } + + /** + * Test the property 'property' + */ + @Test + public void propertyTest() { + // TODO: test property + } + + /** + * Test the property '_123number' + */ + @Test + public void _123numberTest() { + // TODO: test _123number + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java new file mode 100644 index 000000000000..5682fa7d687e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NestedArrayWithDefaultValues + */ +public class NestedArrayWithDefaultValuesTest { + private final NestedArrayWithDefaultValues model = new NestedArrayWithDefaultValues(); + + /** + * Model tests for NestedArrayWithDefaultValues + */ + @Test + public void testNestedArrayWithDefaultValues() { + // TODO: test NestedArrayWithDefaultValues + } + + /** + * Test the property 'nestedArray' + */ + @Test + public void nestedArrayTest() { + // TODO: test nestedArray + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java new file mode 100644 index 000000000000..cf2c4be62b66 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NewPetCategoryInlineAllofAllOfCategoryTag + */ +public class NewPetCategoryInlineAllofAllOfCategoryTagTest { + private final NewPetCategoryInlineAllofAllOfCategoryTag model = new NewPetCategoryInlineAllofAllOfCategoryTag(); + + /** + * Model tests for NewPetCategoryInlineAllofAllOfCategoryTag + */ + @Test + public void testNewPetCategoryInlineAllofAllOfCategoryTag() { + // TODO: test NewPetCategoryInlineAllofAllOfCategoryTag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java new file mode 100644 index 000000000000..a396cfad5a0d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.NewPetCategoryInlineAllofAllOfCategoryTag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NewPetCategoryInlineAllof + */ +public class NewPetCategoryInlineAllofTest { + private final NewPetCategoryInlineAllof model = new NewPetCategoryInlineAllof(); + + /** + * Model tests for NewPetCategoryInlineAllof + */ + @Test + public void testNewPetCategoryInlineAllof() { + // TODO: test NewPetCategoryInlineAllof + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'categoryTag' + */ + @Test + public void categoryTagTest() { + // TODO: test categoryTag + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NewPetTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NewPetTest.java new file mode 100644 index 000000000000..672bce0572b5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NewPetTest.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 com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.NewPetCategoryInlineAllof; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NewPet + */ +public class NewPetTest { + private final NewPet model = new NewPet(); + + /** + * Model tests for NewPet + */ + @Test + public void testNewPet() { + // TODO: test NewPet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'categoryInlineAllof' + */ + @Test + public void categoryInlineAllofTest() { + // TODO: test categoryInlineAllof + } + + /** + * Test the property 'categoryAllOfRef' + */ + @Test + public void categoryAllOfRefTest() { + // TODO: test categoryAllOfRef + } + + /** + * Test the property 'categoryAllOfRefDescription' + */ + @Test + public void categoryAllOfRefDescriptionTest() { + // TODO: test categoryAllOfRefDescription + } + + /** + * Test the property 'categoryAllOfRefDescriptionReadonly' + */ + @Test + public void categoryAllOfRefDescriptionReadonlyTest() { + // TODO: test categoryAllOfRefDescriptionReadonly + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableClassTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableClassTest.java new file mode 100644 index 000000000000..75372d525224 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableClassTest.java @@ -0,0 +1,146 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableClass + */ +public class NullableClassTest { + private final NullableClass model = new NullableClass(); + + /** + * Model tests for NullableClass + */ + @Test + public void testNullableClass() { + // TODO: test NullableClass + } + + /** + * Test the property 'integerProp' + */ + @Test + public void integerPropTest() { + // TODO: test integerProp + } + + /** + * Test the property 'numberProp' + */ + @Test + public void numberPropTest() { + // TODO: test numberProp + } + + /** + * Test the property 'booleanProp' + */ + @Test + public void booleanPropTest() { + // TODO: test booleanProp + } + + /** + * Test the property 'stringProp' + */ + @Test + public void stringPropTest() { + // TODO: test stringProp + } + + /** + * Test the property 'dateProp' + */ + @Test + public void datePropTest() { + // TODO: test dateProp + } + + /** + * Test the property 'datetimeProp' + */ + @Test + public void datetimePropTest() { + // TODO: test datetimeProp + } + + /** + * Test the property 'arrayNullableProp' + */ + @Test + public void arrayNullablePropTest() { + // TODO: test arrayNullableProp + } + + /** + * Test the property 'arrayAndItemsNullableProp' + */ + @Test + public void arrayAndItemsNullablePropTest() { + // TODO: test arrayAndItemsNullableProp + } + + /** + * Test the property 'arrayItemsNullable' + */ + @Test + public void arrayItemsNullableTest() { + // TODO: test arrayItemsNullable + } + + /** + * Test the property 'objectNullableProp' + */ + @Test + public void objectNullablePropTest() { + // TODO: test objectNullableProp + } + + /** + * Test the property 'objectAndItemsNullableProp' + */ + @Test + public void objectAndItemsNullablePropTest() { + // TODO: test objectAndItemsNullableProp + } + + /** + * Test the property 'objectItemsNullable' + */ + @Test + public void objectItemsNullableTest() { + // TODO: test objectItemsNullable + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableEnumTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableEnumTest.java new file mode 100644 index 000000000000..13f44d4a4e2c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableEnumTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableEnum + */ +public class NullableEnumTest { + /** + * Model tests for NullableEnum + */ + @Test + public void testNullableEnum() { + // TODO: test NullableEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java new file mode 100644 index 000000000000..a3df04bf4ad6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsMapError + */ +public class NullableFieldsMapErrorTest { + private final NullableFieldsMapError model = new NullableFieldsMapError(); + + /** + * Model tests for NullableFieldsMapError + */ + @Test + public void testNullableFieldsMapError() { + // TODO: test NullableFieldsMapError + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'reason' + */ + @Test + public void reasonTest() { + // TODO: test reason + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java new file mode 100644 index 000000000000..d2bb63afec94 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsMapError; +import org.openapitools.client.model.NullableFieldsMapSuccess; +import org.openapitools.client.model.NullableFieldsValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsMapResponse + */ +public class NullableFieldsMapResponseTest { + private final NullableFieldsMapResponse model = new NullableFieldsMapResponse(); + + /** + * Model tests for NullableFieldsMapResponse + */ + @Test + public void testNullableFieldsMapResponse() { + // TODO: test NullableFieldsMapResponse + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'positions' + */ + @Test + public void positionsTest() { + // TODO: test positions + } + + /** + * Test the property 'reason' + */ + @Test + public void reasonTest() { + // TODO: test reason + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java new file mode 100644 index 000000000000..8e89de63321d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsMapSuccess + */ +public class NullableFieldsMapSuccessTest { + private final NullableFieldsMapSuccess model = new NullableFieldsMapSuccess(); + + /** + * Model tests for NullableFieldsMapSuccess + */ + @Test + public void testNullableFieldsMapSuccess() { + // TODO: test NullableFieldsMapSuccess + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'positions' + */ + @Test + public void positionsTest() { + // TODO: test positions + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java new file mode 100644 index 000000000000..ae5e0ac5fa30 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsValue + */ +public class NullableFieldsValueTest { + private final NullableFieldsValue model = new NullableFieldsValue(); + + /** + * Model tests for NullableFieldsValue + */ + @Test + public void testNullableFieldsValue() { + // TODO: test NullableFieldsValue + } + + /** + * Test the property 'before' + */ + @Test + public void beforeTest() { + // TODO: test before + } + + /** + * Test the property 'after' + */ + @Test + public void afterTest() { + // TODO: test after + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableShapeTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableShapeTest.java new file mode 100644 index 000000000000..50962a18dfee --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NullableShapeTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableShape + */ +public class NullableShapeTest { + private final NullableShape model = new NullableShape(); + + /** + * Model tests for NullableShape + */ + @Test + public void testNullableShape() { + // TODO: test NullableShape + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NumberOnlyTest.java new file mode 100644 index 000000000000..e616f1e4898c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/NumberOnlyTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NumberOnly + */ +public class NumberOnlyTest { + private final NumberOnly model = new NumberOnly(); + + /** + * Model tests for NumberOnly + */ + @Test + public void testNumberOnly() { + // TODO: test NumberOnly + } + + /** + * Test the property 'justNumber' + */ + @Test + public void justNumberTest() { + // TODO: test justNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java new file mode 100644 index 000000000000..cc497bd9c3fd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java @@ -0,0 +1,75 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.DeprecatedObject; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ObjectWithDeprecatedFields + */ +public class ObjectWithDeprecatedFieldsTest { + private final ObjectWithDeprecatedFields model = new ObjectWithDeprecatedFields(); + + /** + * Model tests for ObjectWithDeprecatedFields + */ + @Test + public void testObjectWithDeprecatedFields() { + // TODO: test ObjectWithDeprecatedFields + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'deprecatedRef' + */ + @Test + public void deprecatedRefTest() { + // TODO: test deprecatedRef + } + + /** + * Test the property 'bars' + */ + @Test + public void barsTest() { + // TODO: test bars + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..367938072253 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,87 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterCompositeTest.java new file mode 100644 index 000000000000..9e1ce520cb4a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterCompositeTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterComposite + */ +public class OuterCompositeTest { + private final OuterComposite model = new OuterComposite(); + + /** + * Model tests for OuterComposite + */ + @Test + public void testOuterComposite() { + // TODO: test OuterComposite + } + + /** + * Test the property 'myNumber' + */ + @Test + public void myNumberTest() { + // TODO: test myNumber + } + + /** + * Test the property 'myString' + */ + @Test + public void myStringTest() { + // TODO: test myString + } + + /** + * Test the property 'myBoolean' + */ + @Test + public void myBooleanTest() { + // TODO: test myBoolean + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java new file mode 100644 index 000000000000..26eb0d06704e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumDefaultValue + */ +public class OuterEnumDefaultValueTest { + /** + * Model tests for OuterEnumDefaultValue + */ + @Test + public void testOuterEnumDefaultValue() { + // TODO: test OuterEnumDefaultValue + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java new file mode 100644 index 000000000000..27eb226577fa --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumIntegerDefaultValue + */ +public class OuterEnumIntegerDefaultValueTest { + /** + * Model tests for OuterEnumIntegerDefaultValue + */ + @Test + public void testOuterEnumIntegerDefaultValue() { + // TODO: test OuterEnumIntegerDefaultValue + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java new file mode 100644 index 000000000000..fe8515c7b371 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumInteger + */ +public class OuterEnumIntegerTest { + /** + * Model tests for OuterEnumInteger + */ + @Test + public void testOuterEnumInteger() { + // TODO: test OuterEnumInteger + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumTest.java new file mode 100644 index 000000000000..3c94c00a1137 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/OuterEnumTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnum + */ +public class OuterEnumTest { + /** + * Model tests for OuterEnum + */ + @Test + public void testOuterEnum() { + // TODO: test OuterEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ParentPetTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ParentPetTest.java new file mode 100644 index 000000000000..f8ab9744ed6d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ParentPetTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.GrandparentAnimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ParentPet + */ +public class ParentPetTest { + private final ParentPet model = new ParentPet(); + + /** + * Model tests for ParentPet + */ + @Test + public void testParentPet() { + // TODO: test ParentPet + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetCompositionTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetCompositionTest.java new file mode 100644 index 000000000000..856d90843d63 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetCompositionTest.java @@ -0,0 +1,91 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetComposition + */ +public class PetCompositionTest { + private final PetComposition model = new PetComposition(); + + /** + * Model tests for PetComposition + */ + @Test + public void testPetComposition() { + // TODO: test PetComposition + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetRefTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetRefTest.java new file mode 100644 index 000000000000..c6ad2cbd5196 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetRefTest.java @@ -0,0 +1,91 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetRef + */ +public class PetRefTest { + private final PetRef model = new PetRef(); + + /** + * Model tests for PetRef + */ + @Test + public void testPetRef() { + // TODO: test PetRef + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..dd841651d622 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,91 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java new file mode 100644 index 000000000000..d3c0694045ec --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java @@ -0,0 +1,91 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetUsingAllOf + */ +public class PetUsingAllOfTest { + private final PetUsingAllOf model = new PetUsingAllOf(); + + /** + * Model tests for PetUsingAllOf + */ + @Test + public void testPetUsingAllOf() { + // TODO: test PetUsingAllOf + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java new file mode 100644 index 000000000000..0572fef439b9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java @@ -0,0 +1,91 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetWithRequiredTags + */ +public class PetWithRequiredTagsTest { + private final PetWithRequiredTags model = new PetWithRequiredTags(); + + /** + * Model tests for PetWithRequiredTags + */ + @Test + public void testPetWithRequiredTags() { + // TODO: test PetWithRequiredTags + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PigTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PigTest.java new file mode 100644 index 000000000000..0cd6769e11a2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PigTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.DanishPig; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pig + */ +public class PigTest { + private final Pig model = new Pig(); + + /** + * Model tests for Pig + */ + @Test + public void testPig() { + // TODO: test Pig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java new file mode 100644 index 000000000000..a8d58ea43300 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.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.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PropertyNameCollision + */ +public class PropertyNameCollisionTest { + private final PropertyNameCollision model = new PropertyNameCollision(); + + /** + * Model tests for PropertyNameCollision + */ + @Test + public void testPropertyNameCollision() { + // TODO: test PropertyNameCollision + } + + /** + * Test the property 'underscoreType' + */ + @Test + public void underscoreTypeTest() { + // TODO: test underscoreType + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'typeWithUnderscore' + */ + @Test + public void typeWithUnderscoreTest() { + // TODO: test typeWithUnderscore + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java new file mode 100644 index 000000000000..e3c382e27d0f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for QuadrilateralInterface + */ +public class QuadrilateralInterfaceTest { + private final QuadrilateralInterface model = new QuadrilateralInterface(); + + /** + * Model tests for QuadrilateralInterface + */ + @Test + public void testQuadrilateralInterface() { + // TODO: test QuadrilateralInterface + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/QuadrilateralTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/QuadrilateralTest.java new file mode 100644 index 000000000000..bcadeb378d32 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/QuadrilateralTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Quadrilateral + */ +public class QuadrilateralTest { + private final Quadrilateral model = new Quadrilateral(); + + /** + * Model tests for Quadrilateral + */ + @Test + public void testQuadrilateral() { + // TODO: test Quadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java new file mode 100644 index 000000000000..843878651161 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadOnlyFirst + */ +public class ReadOnlyFirstTest { + private final ReadOnlyFirst model = new ReadOnlyFirst(); + + /** + * Model tests for ReadOnlyFirst + */ + @Test + public void testReadOnlyFirst() { + // TODO: test ReadOnlyFirst + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'baz' + */ + @Test + public void bazTest() { + // TODO: test baz + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java new file mode 100644 index 000000000000..021af02510d3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java @@ -0,0 +1,159 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.client.model.NullableEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for RequiredNullableBody + */ +public class RequiredNullableBodyTest { + private final RequiredNullableBody model = new RequiredNullableBody(); + + /** + * Model tests for RequiredNullableBody + */ + @Test + public void testRequiredNullableBody() { + // TODO: test RequiredNullableBody + } + + /** + * Test the property 'integerProp' + */ + @Test + public void integerPropTest() { + // TODO: test integerProp + } + + /** + * Test the property 'numberProp' + */ + @Test + public void numberPropTest() { + // TODO: test numberProp + } + + /** + * Test the property 'booleanProp' + */ + @Test + public void booleanPropTest() { + // TODO: test booleanProp + } + + /** + * Test the property 'stringProp' + */ + @Test + public void stringPropTest() { + // TODO: test stringProp + } + + /** + * Test the property 'dateProp' + */ + @Test + public void datePropTest() { + // TODO: test dateProp + } + + /** + * Test the property 'datetimeProp' + */ + @Test + public void datetimePropTest() { + // TODO: test datetimeProp + } + + /** + * Test the property 'arrayNullableProp' + */ + @Test + public void arrayNullablePropTest() { + // TODO: test arrayNullableProp + } + + /** + * Test the property 'arrayAndItemsNullableProp' + */ + @Test + public void arrayAndItemsNullablePropTest() { + // TODO: test arrayAndItemsNullableProp + } + + /** + * Test the property 'arrayItemsNullable' + */ + @Test + public void arrayItemsNullableTest() { + // TODO: test arrayItemsNullable + } + + /** + * Test the property 'objectNullableProp' + */ + @Test + public void objectNullablePropTest() { + // TODO: test objectNullableProp + } + + /** + * Test the property 'objectAndItemsNullableProp' + */ + @Test + public void objectAndItemsNullablePropTest() { + // TODO: test objectAndItemsNullableProp + } + + /** + * Test the property 'objectItemsNullable' + */ + @Test + public void objectItemsNullableTest() { + // TODO: test objectItemsNullable + } + + /** + * Test the property 'customRefEnum' + */ + @Test + public void customRefEnumTest() { + // TODO: test customRefEnum + } + + /** + * Test the property 'customEnum' + */ + @Test + public void customEnumTest() { + // TODO: test customEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java new file mode 100644 index 000000000000..bf1d99112e63 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java @@ -0,0 +1,35 @@ +/* + * 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.math.BigDecimal; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ScalarAnyOf + */ +public class ScalarAnyOfTest { + private final ScalarAnyOf model = new ScalarAnyOf(); + + /** + * Model tests for ScalarAnyOf + */ + @Test + public void testScalarAnyOf() { + // TODO: test ScalarAnyOf + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ScalarTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ScalarTest.java new file mode 100644 index 000000000000..e0c971eac8dc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ScalarTest.java @@ -0,0 +1,35 @@ +/* + * 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.math.BigDecimal; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Scalar + */ +public class ScalarTest { + private final Scalar model = new Scalar(); + + /** + * Model tests for Scalar + */ + @Test + public void testScalar() { + // TODO: test Scalar + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java new file mode 100644 index 000000000000..f70715855fbd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ScaleneTriangle + */ +public class ScaleneTriangleTest { + private final ScaleneTriangle model = new ScaleneTriangle(); + + /** + * Model tests for ScaleneTriangle + */ + @Test + public void testScaleneTriangle() { + // TODO: test ScaleneTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java new file mode 100644 index 000000000000..8e918bdcc233 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ShapeInterface + */ +public class ShapeInterfaceTest { + private final ShapeInterface model = new ShapeInterface(); + + /** + * Model tests for ShapeInterface + */ + @Test + public void testShapeInterface() { + // TODO: test ShapeInterface + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java new file mode 100644 index 000000000000..fad3d0e2cb88 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ShapeOrNull + */ +public class ShapeOrNullTest { + private final ShapeOrNull model = new ShapeOrNull(); + + /** + * Model tests for ShapeOrNull + */ + @Test + public void testShapeOrNull() { + // TODO: test ShapeOrNull + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ShapeTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ShapeTest.java new file mode 100644 index 000000000000..292adb8abb53 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ShapeTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Shape + */ +public class ShapeTest { + private final Shape model = new Shape(); + + /** + * Model tests for Shape + */ + @Test + public void testShape() { + // TODO: test Shape + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java new file mode 100644 index 000000000000..0ed42fdd0203 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SimpleQuadrilateral + */ +public class SimpleQuadrilateralTest { + private final SimpleQuadrilateral model = new SimpleQuadrilateral(); + + /** + * Model tests for SimpleQuadrilateral + */ + @Test + public void testSimpleQuadrilateral() { + // TODO: test SimpleQuadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java new file mode 100644 index 000000000000..15c800ecea0e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SpecialModelName + */ +public class SpecialModelNameTest { + private final SpecialModelName model = new SpecialModelName(); + + /** + * Model tests for SpecialModelName + */ + @Test + public void testSpecialModelName() { + // TODO: test SpecialModelName + } + + /** + * Test the property '$specialPropertyName' + */ + @Test + public void $specialPropertyNameTest() { + // TODO: test $specialPropertyName + } + + /** + * Test the property 'specialModelName' + */ + @Test + public void specialModelNameTest() { + // TODO: test specialModelName + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..3fed76c7e00d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java new file mode 100644 index 000000000000..f4a448494316 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TestInlineFreeformAdditionalPropertiesRequest + */ +public class TestInlineFreeformAdditionalPropertiesRequestTest { + private final TestInlineFreeformAdditionalPropertiesRequest model = new TestInlineFreeformAdditionalPropertiesRequest(); + + /** + * Model tests for TestInlineFreeformAdditionalPropertiesRequest + */ + @Test + public void testTestInlineFreeformAdditionalPropertiesRequest() { + // TODO: test TestInlineFreeformAdditionalPropertiesRequest + } + + /** + * Test the property 'someProperty' + */ + @Test + public void somePropertyTest() { + // TODO: test someProperty + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java new file mode 100644 index 000000000000..fe4834453ad3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TriangleInterface + */ +public class TriangleInterfaceTest { + private final TriangleInterface model = new TriangleInterface(); + + /** + * Model tests for TriangleInterface + */ + @Test + public void testTriangleInterface() { + // TODO: test TriangleInterface + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TriangleTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TriangleTest.java new file mode 100644 index 000000000000..50ac64a04198 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/TriangleTest.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 com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.EquilateralTriangle; +import org.openapitools.client.model.IsoscelesTriangle; +import org.openapitools.client.model.ScaleneTriangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Triangle + */ +public class TriangleTest { + private final Triangle model = new Triangle(); + + /** + * Model tests for Triangle + */ + @Test + public void testTriangle() { + // TODO: test Triangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..16725ae54464 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,138 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + + /** + * Test the property 'objectWithNoDeclaredProps' + */ + @Test + public void objectWithNoDeclaredPropsTest() { + // TODO: test objectWithNoDeclaredProps + } + + /** + * Test the property 'objectWithNoDeclaredPropsNullable' + */ + @Test + public void objectWithNoDeclaredPropsNullableTest() { + // TODO: test objectWithNoDeclaredPropsNullable + } + + /** + * Test the property 'anyTypeProp' + */ + @Test + public void anyTypePropTest() { + // TODO: test anyTypeProp + } + + /** + * Test the property 'anyTypePropNullable' + */ + @Test + public void anyTypePropNullableTest() { + // TODO: test anyTypePropNullable + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ValueTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ValueTest.java new file mode 100644 index 000000000000..69a85d2116cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ValueTest.java @@ -0,0 +1,35 @@ +/* + * 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.List; +import org.openapitools.client.model.Scalar; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Value + */ +public class ValueTest { + private final Value model = new Value(); + + /** + * Model tests for Value + */ + @Test + public void testValue() { + // TODO: test Value + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/VariableTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/VariableTest.java new file mode 100644 index 000000000000..f1c9f1532402 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/VariableTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Value; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Variable + */ +public class VariableTest { + private final Variable model = new Variable(); + + /** + * Model tests for Variable + */ + @Test + public void testVariable() { + // TODO: test Variable + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'value' + */ + @Test + public void valueTest() { + // TODO: test value + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/WhaleTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/WhaleTest.java new file mode 100644 index 000000000000..52cd0d63bb72 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/WhaleTest.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.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Whale + */ +public class WhaleTest { + private final Whale model = new Whale(); + + /** + * Model tests for Whale + */ + @Test + public void testWhale() { + // TODO: test Whale + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ZebraTest.java b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ZebraTest.java new file mode 100644 index 000000000000..4af2598a2f78 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson/src/test/java/org/openapitools/client/model/ZebraTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Zebra + */ +public class ZebraTest { + private final Zebra model = new Zebra(); + + /** + * Model tests for Zebra + */ + @Test + public void testZebra() { + // TODO: test Zebra + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp-jackson3/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp-jackson3/.gitignore b/samples/client/petstore/java/okhttp-jackson3/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/.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/client/petstore/java/okhttp-jackson3/.openapi-generator-ignore b/samples/client/petstore/java/okhttp-jackson3/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/.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/client/petstore/java/okhttp-jackson3/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-jackson3/.openapi-generator/FILES new file mode 100644 index 000000000000..fecfdd629754 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/.openapi-generator/FILES @@ -0,0 +1,404 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/AdditionalPropertiesClass.md +docs/AllOfModelArrayAnyOf.md +docs/AllOfModelArrayAnyOfAllOfAttributes.md +docs/AllOfModelArrayAnyOfAllOfAttributesC.md +docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md +docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md +docs/AllOfRefToDouble.md +docs/AllOfRefToFloat.md +docs/AllOfRefToLong.md +docs/Animal.md +docs/AnotherFakeApi.md +docs/Apple.md +docs/AppleReq.md +docs/ArrayAnyOf.md +docs/ArrayDefault.md +docs/ArrayOfArrayOfNumberOnly.md +docs/ArrayOfInlineAllOf.md +docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md +docs/ArrayOfNumberOnly.md +docs/ArrayOneOf.md +docs/ArrayTest.md +docs/Banana.md +docs/BananaReq.md +docs/BasquePig.md +docs/Capitalization.md +docs/Cat.md +docs/Category.md +docs/ClassModel.md +docs/Client.md +docs/ComplexQuadrilateral.md +docs/DanishPig.md +docs/DefaultApi.md +docs/DeprecatedObject.md +docs/Dog.md +docs/Drawing.md +docs/EnumArrays.md +docs/EnumClass.md +docs/EnumStringDiscriminator.md +docs/EnumTest.md +docs/EquilateralTriangle.md +docs/FakeAnyOfWIthSameErasureGet200Response.md +docs/FakeApi.md +docs/FakeClassnameTags123Api.md +docs/FakeOneOfWIthSameErasureGet200Response.md +docs/FakeRefParameterPetIdParameter.md +docs/FileSchemaTestClass.md +docs/Foo.md +docs/FooGetDefaultResponse.md +docs/FormatTest.md +docs/FreeFormObjectTestClass.md +docs/FreeFormObjectTestClassProperties.md +docs/Fruit.md +docs/FruitReq.md +docs/GmFruit.md +docs/GrandparentAnimal.md +docs/HasOnlyReadOnly.md +docs/HealthCheckResult.md +docs/IsoscelesTriangle.md +docs/Mammal.md +docs/MammalAnyof.md +docs/MapTest.md +docs/MixedPropertiesAndAdditionalPropertiesClass.md +docs/Model200Response.md +docs/ModelApiResponse.md +docs/ModelFile.md +docs/ModelList.md +docs/ModelReturn.md +docs/ModelWithOneOfAnyOfProperties.md +docs/Name.md +docs/NestedArrayWithDefaultValues.md +docs/NewPet.md +docs/NewPetCategoryInlineAllof.md +docs/NewPetCategoryInlineAllofAllOfCategoryTag.md +docs/NullableClass.md +docs/NullableEnum.md +docs/NullableFieldsMapError.md +docs/NullableFieldsMapResponse.md +docs/NullableFieldsMapSuccess.md +docs/NullableFieldsValue.md +docs/NullableShape.md +docs/NumberOnly.md +docs/ObjectWithDeprecatedFields.md +docs/Order.md +docs/OuterComposite.md +docs/OuterEnum.md +docs/OuterEnumDefaultValue.md +docs/OuterEnumInteger.md +docs/OuterEnumIntegerDefaultValue.md +docs/ParentPet.md +docs/Pet.md +docs/PetApi.md +docs/PetComposition.md +docs/PetRef.md +docs/PetUsingAllOf.md +docs/PetWithRequiredTags.md +docs/Pig.md +docs/PropertyNameCollision.md +docs/Quadrilateral.md +docs/QuadrilateralInterface.md +docs/ReadOnlyFirst.md +docs/RequiredNullableBody.md +docs/Scalar.md +docs/ScalarAnyOf.md +docs/ScaleneTriangle.md +docs/Shape.md +docs/ShapeInterface.md +docs/ShapeOrNull.md +docs/SimpleQuadrilateral.md +docs/SpecialModelName.md +docs/StoreApi.md +docs/Tag.md +docs/TestInlineFreeformAdditionalPropertiesRequest.md +docs/Triangle.md +docs/TriangleInterface.md +docs/User.md +docs/UserApi.md +docs/Value.md +docs/ValuesApi.md +docs/Variable.md +docs/Whale.md +docs/Zebra.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/RFC3339DateFormat.java +src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java +src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/AnotherFakeApi.java +src/main/java/org/openapitools/client/api/DefaultApi.java +src/main/java/org/openapitools/client/api/FakeApi.java +src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/api/ValuesApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java +src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +src/main/java/org/openapitools/client/model/AllOfRefToLong.java +src/main/java/org/openapitools/client/model/Animal.java +src/main/java/org/openapitools/client/model/Apple.java +src/main/java/org/openapitools/client/model/AppleReq.java +src/main/java/org/openapitools/client/model/ArrayAnyOf.java +src/main/java/org/openapitools/client/model/ArrayDefault.java +src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java +src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java +src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayOneOf.java +src/main/java/org/openapitools/client/model/ArrayTest.java +src/main/java/org/openapitools/client/model/Banana.java +src/main/java/org/openapitools/client/model/BananaReq.java +src/main/java/org/openapitools/client/model/BasquePig.java +src/main/java/org/openapitools/client/model/Capitalization.java +src/main/java/org/openapitools/client/model/Cat.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ClassModel.java +src/main/java/org/openapitools/client/model/Client.java +src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +src/main/java/org/openapitools/client/model/DanishPig.java +src/main/java/org/openapitools/client/model/DeprecatedObject.java +src/main/java/org/openapitools/client/model/Dog.java +src/main/java/org/openapitools/client/model/Drawing.java +src/main/java/org/openapitools/client/model/EnumArrays.java +src/main/java/org/openapitools/client/model/EnumClass.java +src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java +src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/EquilateralTriangle.java +src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java +src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java +src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java +src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +src/main/java/org/openapitools/client/model/FormatTest.java +src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java +src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java +src/main/java/org/openapitools/client/model/Fruit.java +src/main/java/org/openapitools/client/model/FruitReq.java +src/main/java/org/openapitools/client/model/GmFruit.java +src/main/java/org/openapitools/client/model/GrandparentAnimal.java +src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +src/main/java/org/openapitools/client/model/HealthCheckResult.java +src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +src/main/java/org/openapitools/client/model/Mammal.java +src/main/java/org/openapitools/client/model/MammalAnyof.java +src/main/java/org/openapitools/client/model/MapTest.java +src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/Model200Response.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/ModelFile.java +src/main/java/org/openapitools/client/model/ModelList.java +src/main/java/org/openapitools/client/model/ModelReturn.java +src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java +src/main/java/org/openapitools/client/model/Name.java +src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java +src/main/java/org/openapitools/client/model/NewPet.java +src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java +src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java +src/main/java/org/openapitools/client/model/NullableClass.java +src/main/java/org/openapitools/client/model/NullableEnum.java +src/main/java/org/openapitools/client/model/NullableFieldsMapError.java +src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java +src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java +src/main/java/org/openapitools/client/model/NullableFieldsValue.java +src/main/java/org/openapitools/client/model/NullableShape.java +src/main/java/org/openapitools/client/model/NumberOnly.java +src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/OuterComposite.java +src/main/java/org/openapitools/client/model/OuterEnum.java +src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java +src/main/java/org/openapitools/client/model/OuterEnumInteger.java +src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java +src/main/java/org/openapitools/client/model/ParentPet.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/PetComposition.java +src/main/java/org/openapitools/client/model/PetRef.java +src/main/java/org/openapitools/client/model/PetUsingAllOf.java +src/main/java/org/openapitools/client/model/PetWithRequiredTags.java +src/main/java/org/openapitools/client/model/Pig.java +src/main/java/org/openapitools/client/model/PropertyNameCollision.java +src/main/java/org/openapitools/client/model/Quadrilateral.java +src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +src/main/java/org/openapitools/client/model/RequiredNullableBody.java +src/main/java/org/openapitools/client/model/Scalar.java +src/main/java/org/openapitools/client/model/ScalarAnyOf.java +src/main/java/org/openapitools/client/model/ScaleneTriangle.java +src/main/java/org/openapitools/client/model/Shape.java +src/main/java/org/openapitools/client/model/ShapeInterface.java +src/main/java/org/openapitools/client/model/ShapeOrNull.java +src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +src/main/java/org/openapitools/client/model/SpecialModelName.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +src/main/java/org/openapitools/client/model/Triangle.java +src/main/java/org/openapitools/client/model/TriangleInterface.java +src/main/java/org/openapitools/client/model/User.java +src/main/java/org/openapitools/client/model/Value.java +src/main/java/org/openapitools/client/model/Variable.java +src/main/java/org/openapitools/client/model/Whale.java +src/main/java/org/openapitools/client/model/Zebra.java +src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java +src/test/java/org/openapitools/client/api/DefaultApiTest.java +src/test/java/org/openapitools/client/api/FakeApiTest.java +src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/api/ValuesApiTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java +src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java +src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java +src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java +src/test/java/org/openapitools/client/model/AnimalTest.java +src/test/java/org/openapitools/client/model/AppleReqTest.java +src/test/java/org/openapitools/client/model/AppleTest.java +src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java +src/test/java/org/openapitools/client/model/ArrayDefaultTest.java +src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java +src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java +src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayOneOfTest.java +src/test/java/org/openapitools/client/model/ArrayTestTest.java +src/test/java/org/openapitools/client/model/BananaReqTest.java +src/test/java/org/openapitools/client/model/BananaTest.java +src/test/java/org/openapitools/client/model/BasquePigTest.java +src/test/java/org/openapitools/client/model/CapitalizationTest.java +src/test/java/org/openapitools/client/model/CatTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ClassModelTest.java +src/test/java/org/openapitools/client/model/ClientTest.java +src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java +src/test/java/org/openapitools/client/model/DanishPigTest.java +src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java +src/test/java/org/openapitools/client/model/DogTest.java +src/test/java/org/openapitools/client/model/DrawingTest.java +src/test/java/org/openapitools/client/model/EnumArraysTest.java +src/test/java/org/openapitools/client/model/EnumClassTest.java +src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java +src/test/java/org/openapitools/client/model/EnumTestTest.java +src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java +src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java +src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java +src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java +src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java +src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java +src/test/java/org/openapitools/client/model/FooTest.java +src/test/java/org/openapitools/client/model/FormatTestTest.java +src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java +src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java +src/test/java/org/openapitools/client/model/FruitReqTest.java +src/test/java/org/openapitools/client/model/FruitTest.java +src/test/java/org/openapitools/client/model/GmFruitTest.java +src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java +src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java +src/test/java/org/openapitools/client/model/HealthCheckResultTest.java +src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java +src/test/java/org/openapitools/client/model/MammalAnyofTest.java +src/test/java/org/openapitools/client/model/MammalTest.java +src/test/java/org/openapitools/client/model/MapTestTest.java +src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java +src/test/java/org/openapitools/client/model/Model200ResponseTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/ModelFileTest.java +src/test/java/org/openapitools/client/model/ModelListTest.java +src/test/java/org/openapitools/client/model/ModelReturnTest.java +src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java +src/test/java/org/openapitools/client/model/NameTest.java +src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java +src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java +src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java +src/test/java/org/openapitools/client/model/NewPetTest.java +src/test/java/org/openapitools/client/model/NullableClassTest.java +src/test/java/org/openapitools/client/model/NullableEnumTest.java +src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java +src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java +src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java +src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java +src/test/java/org/openapitools/client/model/NullableShapeTest.java +src/test/java/org/openapitools/client/model/NumberOnlyTest.java +src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/OuterCompositeTest.java +src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java +src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java +src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java +src/test/java/org/openapitools/client/model/OuterEnumTest.java +src/test/java/org/openapitools/client/model/ParentPetTest.java +src/test/java/org/openapitools/client/model/PetCompositionTest.java +src/test/java/org/openapitools/client/model/PetRefTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java +src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java +src/test/java/org/openapitools/client/model/PigTest.java +src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java +src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java +src/test/java/org/openapitools/client/model/QuadrilateralTest.java +src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java +src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java +src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java +src/test/java/org/openapitools/client/model/ScalarTest.java +src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java +src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java +src/test/java/org/openapitools/client/model/ShapeOrNullTest.java +src/test/java/org/openapitools/client/model/ShapeTest.java +src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java +src/test/java/org/openapitools/client/model/SpecialModelNameTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java +src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java +src/test/java/org/openapitools/client/model/TriangleTest.java +src/test/java/org/openapitools/client/model/UserTest.java +src/test/java/org/openapitools/client/model/ValueTest.java +src/test/java/org/openapitools/client/model/VariableTest.java +src/test/java/org/openapitools/client/model/WhaleTest.java +src/test/java/org/openapitools/client/model/ZebraTest.java diff --git a/samples/client/petstore/java/okhttp-jackson3/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-jackson3/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-jackson3/.travis.yml b/samples/client/petstore/java/okhttp-jackson3/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/.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/client/petstore/java/okhttp-jackson3/README.md b/samples/client/petstore/java/okhttp-jackson3/README.md new file mode 100644 index 000000000000..8ddb00a689e3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/README.md @@ -0,0 +1,337 @@ +# petstore-okhttp-jackson3 + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-okhttp-jackson3 + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-okhttp-jackson3' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp-jackson3' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp-jackson3:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/petstore-okhttp-jackson3-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**getParameterArrayNumber**](docs/AnotherFakeApi.md#getParameterArrayNumber) | **GET** /fake/parameter-array-number | parameter array number default value +*AnotherFakeApi* | [**getParameterStringNumber**](docs/AnotherFakeApi.md#getParameterStringNumber) | **GET** /fake/parameter-string-number | parameter string number +*DefaultApi* | [**fakeAnyOfWIthSameErasureGet**](docs/DefaultApi.md#fakeAnyOfWIthSameErasureGet) | **GET** /fake/anyOfWIthSameErasure | +*DefaultApi* | [**fakeFreeFormQueryParametersGet**](docs/DefaultApi.md#fakeFreeFormQueryParametersGet) | **GET** /fake/free-form-query-parameters | +*DefaultApi* | [**fakeOneOfWIthSameErasureGet**](docs/DefaultApi.md#fakeOneOfWIthSameErasureGet) | **GET** /fake/oneOfWIthSameErasure | +*DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo | +*FakeApi* | [**fakeGetFreeFormObjectGet**](docs/FakeApi.md#fakeGetFreeFormObjectGet) | **GET** /fake/get-free-form-object | +*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +*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* | [**fakeRefParameter**](docs/FakeApi.md#fakeRefParameter) | **POST** /fake/pet/{petId}/reference/parameter | fake reference parameter +*FakeApi* | [**fakeRequiredNullableBodyGet**](docs/FakeApi.md#fakeRequiredNullableBodyGet) | **GET** /fake/required-nullable-body | fields in the response body, required and nullable are both true +*FakeApi* | [**fakeUploadRefRequestBodies**](docs/FakeApi.md#fakeUploadRefRequestBodies) | **POST** /fake/pet/{petId}/uploadImage | fake reference parameter +*FakeApi* | [**getFakeArrayofenums**](docs/FakeApi.md#getFakeArrayofenums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**getFakeHealth**](docs/FakeApi.md#getFakeHealth) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**getParameterNameMapping**](docs/FakeApi.md#getParameterNameMapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test +*FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +*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 +*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testInlineFreeformAdditionalProperties**](docs/FakeApi.md#testInlineFreeformAdditionalProperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testNullableRequiredFieldsAnyOf**](docs/FakeApi.md#testNullableRequiredFieldsAnyOf) | **GET** /fake/nullable-required-fields-anyof | test anyOf with map of objects containing nullable required fields +*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | +*FakeApi* | [**testStringMapReference**](docs/FakeApi.md#testStringMapReference) | **POST** /fake/stringMap-reference | test referenced string map +*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user +*ValuesApi* | [**getSomeValues**](docs/ValuesApi.md#getSomeValues) | **GET** /values | Get some primitive variable values + + +## Documentation for Models + + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AllOfModelArrayAnyOf](docs/AllOfModelArrayAnyOf.md) + - [AllOfModelArrayAnyOfAllOfAttributes](docs/AllOfModelArrayAnyOfAllOfAttributes.md) + - [AllOfModelArrayAnyOfAllOfAttributesC](docs/AllOfModelArrayAnyOfAllOfAttributesC.md) + - [AllOfModelArrayAnyOfAllOfLinkListColumn1](docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md) + - [AllOfModelArrayAnyOfAllOfLinkListColumn1Value](docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md) + - [AllOfRefToDouble](docs/AllOfRefToDouble.md) + - [AllOfRefToFloat](docs/AllOfRefToFloat.md) + - [AllOfRefToLong](docs/AllOfRefToLong.md) + - [Animal](docs/Animal.md) + - [Apple](docs/Apple.md) + - [AppleReq](docs/AppleReq.md) + - [ArrayAnyOf](docs/ArrayAnyOf.md) + - [ArrayDefault](docs/ArrayDefault.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfInlineAllOf](docs/ArrayOfInlineAllOf.md) + - [ArrayOfInlineAllOfArrayAllofDogPropertyInner](docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayOneOf](docs/ArrayOneOf.md) + - [ArrayTest](docs/ArrayTest.md) + - [Banana](docs/Banana.md) + - [BananaReq](docs/BananaReq.md) + - [BasquePig](docs/BasquePig.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [Category](docs/Category.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [ComplexQuadrilateral](docs/ComplexQuadrilateral.md) + - [DanishPig](docs/DanishPig.md) + - [DeprecatedObject](docs/DeprecatedObject.md) + - [Dog](docs/Dog.md) + - [Drawing](docs/Drawing.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumStringDiscriminator](docs/EnumStringDiscriminator.md) + - [EnumTest](docs/EnumTest.md) + - [EquilateralTriangle](docs/EquilateralTriangle.md) + - [FakeAnyOfWIthSameErasureGet200Response](docs/FakeAnyOfWIthSameErasureGet200Response.md) + - [FakeOneOfWIthSameErasureGet200Response](docs/FakeOneOfWIthSameErasureGet200Response.md) + - [FakeRefParameterPetIdParameter](docs/FakeRefParameterPetIdParameter.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) + - [FormatTest](docs/FormatTest.md) + - [FreeFormObjectTestClass](docs/FreeFormObjectTestClass.md) + - [FreeFormObjectTestClassProperties](docs/FreeFormObjectTestClassProperties.md) + - [Fruit](docs/Fruit.md) + - [FruitReq](docs/FruitReq.md) + - [GmFruit](docs/GmFruit.md) + - [GrandparentAnimal](docs/GrandparentAnimal.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [HealthCheckResult](docs/HealthCheckResult.md) + - [IsoscelesTriangle](docs/IsoscelesTriangle.md) + - [Mammal](docs/Mammal.md) + - [MammalAnyof](docs/MammalAnyof.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [ModelFile](docs/ModelFile.md) + - [ModelList](docs/ModelList.md) + - [ModelReturn](docs/ModelReturn.md) + - [ModelWithOneOfAnyOfProperties](docs/ModelWithOneOfAnyOfProperties.md) + - [Name](docs/Name.md) + - [NestedArrayWithDefaultValues](docs/NestedArrayWithDefaultValues.md) + - [NewPet](docs/NewPet.md) + - [NewPetCategoryInlineAllof](docs/NewPetCategoryInlineAllof.md) + - [NewPetCategoryInlineAllofAllOfCategoryTag](docs/NewPetCategoryInlineAllofAllOfCategoryTag.md) + - [NullableClass](docs/NullableClass.md) + - [NullableEnum](docs/NullableEnum.md) + - [NullableFieldsMapError](docs/NullableFieldsMapError.md) + - [NullableFieldsMapResponse](docs/NullableFieldsMapResponse.md) + - [NullableFieldsMapSuccess](docs/NullableFieldsMapSuccess.md) + - [NullableFieldsValue](docs/NullableFieldsValue.md) + - [NullableShape](docs/NullableShape.md) + - [NumberOnly](docs/NumberOnly.md) + - [ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md) + - [OuterEnumInteger](docs/OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) + - [ParentPet](docs/ParentPet.md) + - [Pet](docs/Pet.md) + - [PetComposition](docs/PetComposition.md) + - [PetRef](docs/PetRef.md) + - [PetUsingAllOf](docs/PetUsingAllOf.md) + - [PetWithRequiredTags](docs/PetWithRequiredTags.md) + - [Pig](docs/Pig.md) + - [PropertyNameCollision](docs/PropertyNameCollision.md) + - [Quadrilateral](docs/Quadrilateral.md) + - [QuadrilateralInterface](docs/QuadrilateralInterface.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [RequiredNullableBody](docs/RequiredNullableBody.md) + - [Scalar](docs/Scalar.md) + - [ScalarAnyOf](docs/ScalarAnyOf.md) + - [ScaleneTriangle](docs/ScaleneTriangle.md) + - [Shape](docs/Shape.md) + - [ShapeInterface](docs/ShapeInterface.md) + - [ShapeOrNull](docs/ShapeOrNull.md) + - [SimpleQuadrilateral](docs/SimpleQuadrilateral.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) + - [Triangle](docs/Triangle.md) + - [TriangleInterface](docs/TriangleInterface.md) + - [User](docs/User.md) + - [Value](docs/Value.md) + - [Variable](docs/Variable.md) + - [Whale](docs/Whale.md) + - [Zebra](docs/Zebra.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +### bearer_test + +- **Type**: HTTP Bearer Token authentication (JWT) + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/api/openapi.yaml b/samples/client/petstore/java/okhttp-jackson3/api/openapi.yaml new file mode 100644 index 000000000000..ec6b0d631c06 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/api/openapi.yaml @@ -0,0 +1,3332 @@ +openapi: 3.0.0 +info: + description: "This spec is mainly for testing Petstore server and contains fake\ + \ endpoints, models. Please do not use this for any other purpose. Special characters:\ + \ \" \\" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- description: petstore server + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: "https://localhost:8080/{version}" + variables: + version: + default: v2 + enum: + - v1 + - v2 +- description: The local server without variables + url: https://127.0.0.1/no_variable +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/_foo_get_default_response" + description: response + x-accepts: + - application/json + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + put: + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + servers: + - url: http://petstore.swagger.io/v2 + - url: http://path-server-test.petstore.local/v2 + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + default: [] + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + default: [] + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + - description: Content type header parameter + explode: false + in: header + name: Content-Type + required: false + schema: + type: string + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + default: [] + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-content-type: application/json + x-accepts: + - application/json + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + explode: true + in: query + name: required_string_group + required: true + schema: + type: integer + style: form + - description: Required Boolean in group parameters + explode: false + in: header + name: required_boolean_group + required: true + schema: + type: boolean + style: simple + - description: Required Integer in group parameters + explode: true + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + style: form + - description: String in group parameters + explode: true + in: query + name: string_group + required: false + schema: + type: integer + style: form + - description: Boolean in group parameters + explode: false + in: header + name: boolean_group + required: false + schema: + type: boolean + style: simple + - description: Integer in group parameters + explode: true + in: query + name: int64_group + required: false + schema: + format: int64 + type: integer + style: form + responses: + "400": + description: Something wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + x-accepts: + - application/json + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + required: false + schema: + default: [] + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + default: [] + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_integer + required: false + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_double + required: false + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + style: form + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEnumParameters_request" + responses: + "400": + description: Invalid request + "404": + description: Not found + summary: To test enum parameters + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test "client" model + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEndpointParameters_request" + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterNumber" + description: Input number as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterNumber" + description: Output number + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterString" + description: Input string as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterString" + description: Output string + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Input boolean as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Output boolean + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterComposite" + description: Input composite as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterComposite" + description: Output composite + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/jsonFormData: + get: + description: "" + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testJsonFormData_request" + responses: + "200": + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/additionalProperties-reference: + post: + description: "" + operationId: testAdditionalPropertiesReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FreeFormObject" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/oneOfWIthSameErasure: + get: + description: "Test route, this shouldn't cause a compiler error" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/_fake_oneOfWIthSameErasure_get_200_response" + description: successful response + x-accepts: + - application/json + /fake/nullable-required-fields-anyof: + get: + description: "Tests that anyOf deserialization works when object values contain\ + \ required fields that are nullable (e.g. Record)" + operationId: testNullableRequiredFieldsAnyOf + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/NullableFieldsMapResponse" + description: successful operation + summary: test anyOf with map of objects containing nullable required fields + tags: + - fake + x-accepts: + - application/json + /fake/anyOfWIthSameErasure: + get: + description: "Test route, this shouldn't cause a compiler error" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/_fake_anyOfWIthSameErasure_get_200_response" + description: successful response + x-accepts: + - application/json + /fake/stringMap-reference: + post: + description: "" + operationId: testStringMapReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/MapOfString" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced string map + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/inline-additionalProperties: + post: + description: "" + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + default: [] + type: object + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/inline-freeform-additionalProperties: + post: + description: "" + operationId: testInlineFreeformAdditionalProperties + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/testInlineFreeformAdditionalProperties_request" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline free-form additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - explode: true + in: query + name: query + required: true + schema: + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-file-schema: + put: + description: "For this test, the body for this request much reference a schema\ + \ named `File`." + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FileSchemaTestClass" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/get-free-form-object: + get: + description: Get a free form object or Json string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FreeFormObjectTestClass" + description: Success + tags: + - fake + x-accepts: + - application/json + /fake/free-form-query-parameters: + get: + parameters: + - explode: true + in: query + name: fixed + required: false + schema: + type: string + style: form + - explode: true + in: query + name: free-form + required: false + schema: + type: object + style: form + responses: + "200": + description: OK + x-accepts: + - application/json + /fake/test-query-parameters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: true + in: query + name: pipe + required: true + schema: + default: [] + items: + type: string + type: array + style: form + - explode: false + in: query + name: ioutil + required: true + schema: + default: [] + items: + type: string + type: array + style: form + - explode: false + in: query + name: http + required: true + schema: + default: [] + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + default: [] + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + default: [] + items: + type: string + type: array + style: form + responses: + "200": + description: Success + tags: + - fake + x-accepts: + - application/json + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: "" + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFileWithRequiredFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/HealthCheckResult" + description: The instance started successfully + summary: Health check endpoint + 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 + /fake/parameter-name-mapping: + get: + operationId: getParameterNameMapping + parameters: + - description: _type + explode: false + in: header + name: _type + required: true + schema: + format: int64 + type: integer + style: simple + - description: type + explode: true + in: query + name: type + required: true + schema: + type: string + style: form + - description: type_ + explode: false + in: header + name: type_ + required: true + schema: + type: string + style: simple + responses: + "200": + description: OK + summary: parameter name mapping test + tags: + - fake + x-accepts: + - application/json + /fake/parameter-string-number: + get: + operationId: getParameterStringNumber + parameters: + - description: string number + explode: false + in: header + name: string_number + required: true + schema: + format: number + type: string + style: simple + responses: + "200": + description: OK + summary: parameter string number + tags: + - another_fake + x-accepts: + - application/json + /fake/parameter-array-number: + get: + operationId: getParameterArrayNumber + parameters: + - description: array integer + explode: false + in: header + name: array + required: true + schema: + default: + - 1 + items: + type: integer + type: array + style: simple + responses: + "200": + description: OK + summary: parameter array number default value + tags: + - another_fake + x-accepts: + - application/json + /fake/pet/{petId}/uploadImage: + post: + description: "" + operationId: fake-upload-ref-request-bodies + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: "#/components/requestBodies/upload_body" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: fake reference parameter + tags: + - fake + x-content-type: multipart/form-data + x-accepts: + - application/json + /fake/pet/{petId}/reference/parameter: + post: + description: "" + operationId: fake-ref-parameter + parameters: + - description: to test oneOf in parameter $ref + explode: false + in: path + name: petId + required: true + schema: + $ref: "#/components/schemas/fake_ref_parameter_petId_parameter" + style: simple + responses: + "200": + description: successful operation + summary: fake reference parameter + tags: + - fake + x-accepts: + - application/json + /values: + get: + description: "" + operationId: getSomeValues + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Variable" + description: successful operation + "400": + description: Invalid Value + summary: Get some primitive variable values + tags: + - values + x-accepts: + - application/json + /internal/only: + get: + description: "" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Variable" + description: successful operation + "400": + description: Invalid Value + summary: internal only + tags: + - values + x-internal: true + x-accepts: + - application/json + /fake/required-nullable-body: + get: + description: "" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredNullableBody" + description: success + summary: "fields in the response body, required and nullable are both true" + tags: + - fake + x-accepts: + - application/json +components: + parameters: + pet_id: + description: to test oneOf in parameter $ref + explode: false + in: path + name: petId + required: true + schema: + $ref: "#/components/schemas/fake_ref_parameter_petId_parameter" + style: simple + requestBodies: + upload_body: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + UserArray: + content: + application/json: + examples: + simple-list: + description: Should not get into code examples + summary: Simple list example + value: + - username: foo + - username: bar + schema: + default: [] + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + Pet: + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string + Order: + example: + id: 0 + petId: 6 + quantity: 1 + shipDate: 2020-02-02T20:20:20.000222Z + status: placed + complete: false + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + example: 2020-02-02T20:20:20.000222Z + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + id: 6 + name: default-name + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + id: 0 + username: username + firstName: firstName + lastName: lastName + email: email + password: password + phone: phone + userStatus: 6 + objectWithNoDeclaredProps: "{}" + objectWithNoDeclaredPropsNullable: "{}" + anyTypeProp: "" + anyTypePropNullable: "" + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + objectWithNoDeclaredProps: + description: test code generation for objects Value must be a map of strings + to values. It cannot be the 'null' value. + type: object + objectWithNoDeclaredPropsNullable: + description: test code generation for nullable objects. Value must be a + map of strings to values or the 'null' value. + nullable: true + type: object + anyTypeProp: + description: "test code generation for any type Here the 'type' attribute\ + \ is not specified, which means the value can be anything, including the\ + \ null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389" + anyTypePropNullable: + description: "test code generation for any type Here the 'type' attribute\ + \ is not specified, which means the value can be anything, including the\ + \ null value, string, number, boolean, array or object. The 'nullable'\ + \ attribute does not change the allowed values." + nullable: true + type: object + xml: + name: User + Tag: + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + id: 0 + category: + id: 6 + name: default-name + name: doggie + photoUrls: + - photoUrls + - photoUrls + tags: + - id: 1 + name: name + - id: 1 + name: name + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + "123Number": + readOnly: true + type: integer + required: + - name + xml: + name: Name + "200_response": + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: "#/components/schemas/Animal" + - $ref: "#/components/schemas/Address" + - properties: + declawed: + type: boolean + type: object + Address: + additionalProperties: + type: integer + default: [] + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: "#/components/schemas/Animal" + type: array + format_test: + properties: + integer: + maximum: 100 + minimum: 10 + multipleOf: 2 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + multipleOf: 32.5 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + decimal: + format: number + type: string + string: + pattern: "/[a-z]/i" + type: string + byte: + format: byte + type: string + binary: + 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: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + uuid_with_default: + default: 11111111-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: "^\\d{10}$" + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. + pattern: "/^image_\\d{1,3}$/i" + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_integer_only: + enum: + - 2 + - -2 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: "#/components/schemas/OuterEnum" + outerEnumInteger: + $ref: "#/components/schemas/OuterEnumInteger" + outerEnumDefaultValue: + $ref: "#/components/schemas/OuterEnumDefaultValue" + outerEnumIntegerDefaultValue: + $ref: "#/components/schemas/OuterEnumIntegerDefaultValue" + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + default: [] + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + default: [] + type: object + default: [] + type: object + anytype_1: {} + map_with_undeclared_properties_anytype_1: + type: object + map_with_undeclared_properties_anytype_2: + properties: {} + type: object + map_with_undeclared_properties_anytype_3: + additionalProperties: true + default: [] + type: object + empty_map: + additionalProperties: false + description: "an object with no declared properties and no undeclared properties,\ + \ hence it's an empty map." + type: object + map_with_undeclared_properties_string: + additionalProperties: + type: string + default: [] + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: "#/components/schemas/Animal" + default: [] + type: object + type: object + List: + properties: + "123-list": + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + default: [] + type: object + default: [] + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + default: [] + type: object + direct_map: + additionalProperties: + type: boolean + default: [] + type: object + indirect_map: + additionalProperties: + type: boolean + default: [] + type: object + type: object + ArrayTest: + properties: + array_of_string: + default: [] + items: + type: string + type: array + array_array_of_integer: + default: [] + items: + default: [] + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + default: [] + items: + default: [] + items: + $ref: "#/components/schemas/ReadOnlyFirst" + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + default: [] + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + default: [] + items: + default: [] + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + default: [] + items: + enum: + - fish + - crab + type: string + type: array + type: object + FreeFormObject: + additionalProperties: true + default: [] + description: A schema consisting only of additional properties + type: object + MapOfString: + additionalProperties: + type: string + default: [] + description: A schema consisting only of additional properties of type string + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + - s + - S + nullable: true + type: string + OuterEnumInteger: + deprecated: true + enum: + - 0 + - 1 + - 2 + type: integer + OuterEnumDefaultValue: + default: placed + enum: + - placed + - approved + - delivered + type: string + OuterEnumIntegerDefaultValue: + default: 0 + enum: + - 0 + - 1 + - 2 + type: integer + OuterComposite: + example: + my_number: 0.8008281904610115 + my_string: my_string + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + default: [] + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: "#/components/schemas/File" + files: + default: [] + items: + $ref: "#/components/schemas/File" + type: array + type: object + FreeFormObjectTestClass: + example: + name: name + properties: FreeFormObjectTestClass_properties + properties: + name: + type: string + properties: + $ref: "#/components/schemas/FreeFormObjectTestClass_properties" + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + _special_model.name_: + type: string + xml: + name: "$special[model.name]" + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable + in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage + properties: + NullableMessage: + nullable: true + type: string + type: object + NullableClass: + additionalProperties: + nullable: true + type: object + properties: + integer_prop: + nullable: true + type: integer + number_prop: + nullable: true + type: number + boolean_prop: + nullable: true + type: boolean + string_prop: + nullable: true + type: string + date_prop: + format: date + nullable: true + type: string + datetime_prop: + format: date-time + nullable: true + type: string + array_nullable_prop: + items: + type: object + nullable: true + type: array + array_and_items_nullable_prop: + items: + nullable: true + type: object + nullable: true + type: array + array_items_nullable: + default: [] + items: + nullable: true + type: object + type: array + object_nullable_prop: + additionalProperties: + type: object + nullable: true + type: object + object_and_items_nullable_prop: + additionalProperties: + nullable: true + type: object + nullable: true + type: object + object_items_nullable: + additionalProperties: + nullable: true + type: object + default: [] + type: object + type: object + fruit: + additionalProperties: false + oneOf: + - $ref: "#/components/schemas/apple" + - $ref: "#/components/schemas/banana" + properties: + color: + type: string + apple: + nullable: true + properties: + cultivar: + pattern: "^[a-zA-Z\\s]*$" + type: string + origin: + pattern: "/^[A-Z\\s]*$/i" + type: string + type: object + banana: + properties: + lengthCm: + type: number + type: object + mammal: + discriminator: + propertyName: className + oneOf: + - $ref: "#/components/schemas/whale" + - $ref: "#/components/schemas/zebra" + - $ref: "#/components/schemas/Pig" + mammal_anyof: + anyOf: + - $ref: "#/components/schemas/whale" + - $ref: "#/components/schemas/zebra" + - $ref: "#/components/schemas/Pig" + discriminator: + propertyName: className + whale: + properties: + hasBaleen: + type: boolean + hasTeeth: + type: boolean + className: + type: string + required: + - className + type: object + zebra: + additionalProperties: true + properties: + type: + enum: + - plains + - mountain + - grevys + type: string + className: + type: string + required: + - className + type: object + Pig: + discriminator: + propertyName: className + oneOf: + - $ref: "#/components/schemas/BasquePig" + - $ref: "#/components/schemas/DanishPig" + BasquePig: + properties: + className: + type: string + required: + - className + type: object + DanishPig: + properties: + className: + type: string + required: + - className + type: object + gmFruit: + additionalProperties: false + anyOf: + - $ref: "#/components/schemas/apple" + - $ref: "#/components/schemas/banana" + properties: + color: + type: string + fruitReq: + additionalProperties: false + nullable: true + oneOf: + - $ref: "#/components/schemas/appleReq" + - $ref: "#/components/schemas/bananaReq" + appleReq: + additionalProperties: false + properties: + cultivar: + type: string + mealy: + type: boolean + required: + - cultivar + type: object + bananaReq: + additionalProperties: false + properties: + lengthCm: + type: number + sweet: + type: boolean + required: + - lengthCm + type: object + Drawing: + additionalProperties: + $ref: "#/components/schemas/fruit" + properties: + mainShape: + $ref: "#/components/schemas/Shape" + shapeOrNull: + $ref: "#/components/schemas/ShapeOrNull" + nullableShape: + $ref: "#/components/schemas/NullableShape" + shapes: + default: [] + items: + $ref: "#/components/schemas/Shape" + type: array + type: object + Shape: + discriminator: + propertyName: shapeType + oneOf: + - $ref: "#/components/schemas/Triangle" + - $ref: "#/components/schemas/Quadrilateral" + ShapeOrNull: + description: The value may be a shape or the 'null' value. This is introduced + in OAS schema >= 3.1. + discriminator: + propertyName: shapeType + nullable: true + oneOf: + - $ref: "#/components/schemas/Triangle" + - $ref: "#/components/schemas/Quadrilateral" + NullableShape: + description: The value may be a shape or the 'null' value. The 'nullable' attribute + was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema + >= 3.1. + discriminator: + propertyName: shapeType + nullable: true + oneOf: + - $ref: "#/components/schemas/Triangle" + - $ref: "#/components/schemas/Quadrilateral" + ShapeInterface: + properties: + shapeType: + type: string + required: + - shapeType + TriangleInterface: + properties: + triangleType: + type: string + required: + - triangleType + Triangle: + discriminator: + propertyName: triangleType + oneOf: + - $ref: "#/components/schemas/EquilateralTriangle" + - $ref: "#/components/schemas/IsoscelesTriangle" + - $ref: "#/components/schemas/ScaleneTriangle" + EquilateralTriangle: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/TriangleInterface" + IsoscelesTriangle: + additionalProperties: false + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/TriangleInterface" + ScaleneTriangle: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/TriangleInterface" + QuadrilateralInterface: + properties: + quadrilateralType: + type: string + required: + - quadrilateralType + Quadrilateral: + discriminator: + propertyName: quadrilateralType + oneOf: + - $ref: "#/components/schemas/SimpleQuadrilateral" + - $ref: "#/components/schemas/ComplexQuadrilateral" + SimpleQuadrilateral: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/QuadrilateralInterface" + ComplexQuadrilateral: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/QuadrilateralInterface" + GrandparentAnimal: + discriminator: + propertyName: pet_type + properties: + pet_type: + type: string + required: + - pet_type + type: object + ParentPet: + allOf: + - $ref: "#/components/schemas/GrandparentAnimal" + type: object + ArrayOfEnums: + default: [] + items: + $ref: "#/components/schemas/OuterEnum" + type: array + DateTimeTest: + default: 2010-01-01T10:10:10.000111+01:00 + example: 2010-01-01T10:10:10.000111+01:00 + format: date-time + type: string + DeprecatedObject: + deprecated: true + properties: + name: + type: string + type: object + ObjectWithDeprecatedFields: + properties: + uuid: + type: string + id: + deprecated: true + type: number + deprecatedRef: + $ref: "#/components/schemas/DeprecatedObject" + bars: + default: [] + deprecated: true + items: + $ref: "#/components/schemas/Bar" + type: array + type: object + PetWithRequiredTags: + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + - tags + type: object + xml: + name: Pet + ArrayOfInlineAllOf: + properties: + id: + format: int64 + type: integer + name: + example: doggie + type: string + array_allof_dog_property: + default: [] + items: + $ref: "#/components/schemas/ArrayOfInlineAllOf_array_allof_dog_property_inner" + type: array + required: + - name + type: object + EnumStringDiscriminator: + description: An object to test discriminator of enum string + discriminator: + propertyName: enum_str_type + properties: + enum_str_type: + description: enum string type + enum: + - type_a + - type_b + type: string + required: + - enum_str_type + type: object + ArrayDefault: + properties: + WithDefaultEmptyBracket: + default: [] + items: + type: string + type: array + WithoutDefault: + default: [] + items: + type: string + type: array + Variable: + description: Value object + example: + name: variable_1 + value: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + properties: + name: + example: variable_1 + type: string + value: + $ref: "#/components/schemas/Value" + required: + - name + - value + Value: + oneOf: + - $ref: "#/components/schemas/Scalar" + - $ref: "#/components/schemas/Array" + Scalar: + description: Values of scalar type + oneOf: + - format: uuid + type: string + - maxLength: 1089 + type: string + - type: number + - type: boolean + ScalarAnyOf: + anyOf: + - format: uuid + type: string + - maxLength: 1089 + type: string + - type: number + - type: boolean + description: Values of scalar type using anyOf + Array: + default: [] + description: Values of array type + items: + $ref: "#/components/schemas/Scalar" + minItems: 1 + type: array + NewPet: + properties: + id: + format: int64 + type: integer + x-is-unique: true + category_inline_allof: + $ref: "#/components/schemas/NewPet_category_inline_allof" + category_allOf_ref: + allOf: + - $ref: "#/components/schemas/Category" + category_allOf_ref_description: + allOf: + - $ref: "#/components/schemas/Category" + description: | + Adding description to property using allOf + category_allOf_ref_description_readonly: + allOf: + - $ref: "#/components/schemas/Category" + description: | + Adding description to readonly property using allOf + readOnly: true + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + allOf: + - $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + PropertyNameCollision: + properties: + _type: + type: string + type: + type: string + type_: + type: string + type: object + x-internal: false + InteralOnly: + properties: + type: + type: string + type: object + x-internal: true + AllOfModelArrayAnyOf: + allOf: + - $ref: "#/components/schemas/Category" + - properties: + linkListColumn1: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_linkListColumn1" + attributes: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_attributes" + type: object + PetUsingAllOf: + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + allOf: + - $ref: "#/components/schemas/Category" + description: | + multi line description + 2nd line + last line + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + allOf: + - $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + PetComposition: + allOf: + - $ref: "#/components/schemas/Pet" + PetRef: + properties: + id: + $ref: "#/components/schemas/Pet/properties/id" + category: + $ref: "#/components/schemas/Pet/properties/category" + name: + $ref: "#/components/schemas/Pet/properties/name" + photoUrls: + $ref: "#/components/schemas/Pet/properties/photoUrls" + tags: + $ref: "#/components/schemas/Pet/properties/tags" + status: + $ref: "#/components/schemas/Pet/properties/status" + required: + - name + - photoUrls + type: object + xml: + name: Pet + ArrayOneOf: + oneOf: + - type: integer + - default: [] + items: + type: string + type: array + ArrayAnyOf: + anyOf: + - type: integer + - default: [] + items: + type: string + type: array + ModelWithOneOfAnyOfProperties: + properties: + oneof_prop: + $ref: "#/components/schemas/ArrayOneOf" + anyof_prop: + $ref: "#/components/schemas/ArrayAnyOf" + type: object + NullableEnum: + enum: + - custom + nullable: true + type: string + RequiredNullableBody: + allOf: + - $ref: "#/components/schemas/NullableClass" + - properties: + custom_ref_enum: + $ref: "#/components/schemas/NullableEnum" + custom_enum: + enum: + - custom + nullable: true + type: string + required: + - array_and_items_nullable_prop + - array_items_nullable + - array_nullable_prop + - boolean_prop + - custom_enum + - custom_ref_enum + - date_prop + - datetime_prop + - integer_prop + - number_prop + - object_and_items_nullable_prop + - object_items_nullable + - object_nullable_prop + - string_prop + type: object + example: + integer_prop: 0 + number_prop: 6.027456183070403 + boolean_prop: true + string_prop: string_prop + date_prop: 2000-01-23 + datetime_prop: 2000-01-23T04:56:07.000+00:00 + array_nullable_prop: + - "{}" + - "{}" + array_and_items_nullable_prop: + - "{}" + - "{}" + array_items_nullable: + - "{}" + - "{}" + object_nullable_prop: + key: "{}" + object_and_items_nullable_prop: + key: "{}" + object_items_nullable: + key: "{}" + custom_ref_enum: custom + custom_enum: custom + NestedArrayWithDefaultValues: + properties: + nestedArray: + default: + - - h1 + - Header 1 + - - h2 + - Header 2 + - - h3 + - Header 3 + - - h4 + - Header 4 + items: + default: + - value1 + - value2 + items: + type: string + type: array + type: array + type: object + LongId: + description: Id as long + format: int64 + type: integer + Weight: + description: Weight as float + format: float + type: number + Height: + description: Height as double + format: double + type: number + AllOfRefToLong: + description: Object with allOf ref to long + properties: + id: + allOf: + - $ref: "#/components/schemas/LongId" + default: 10 + type: object + AllOfRefToFloat: + description: Object with allOf ref to float + properties: + weight: + allOf: + - $ref: "#/components/schemas/Weight" + default: 7.89 + type: object + AllOfRefToDouble: + description: Object with allOf ref to double + properties: + height: + allOf: + - $ref: "#/components/schemas/Height" + default: 32.1 + type: object + NullableFieldsValue: + description: Object with required but nullable string fields + example: + before: before + after: after + properties: + before: + nullable: true + type: string + after: + nullable: true + type: string + required: + - after + - before + type: object + NullableFieldsMapSuccess: + additionalProperties: false + description: Success response containing a map of objects with nullable fields + example: + status: status + positions: + key: + before: before + after: after + properties: + status: + type: string + positions: + additionalProperties: + $ref: "#/components/schemas/NullableFieldsValue" + type: object + required: + - positions + - status + type: object + NullableFieldsMapError: + additionalProperties: false + description: Error response + properties: + status: + type: string + reason: + type: string + required: + - reason + - status + type: object + NullableFieldsMapResponse: + anyOf: + - $ref: "#/components/schemas/NullableFieldsMapSuccess" + - $ref: "#/components/schemas/NullableFieldsMapError" + _foo_get_default_response: + example: + string: + bar: bar + properties: + string: + $ref: "#/components/schemas/Foo" + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request: + properties: + enum_form_string_array: + default: [] + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + testEndpointParameters_request: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: "/[a-z]/i" + type: string + pattern_without_delimiter: + description: None + pattern: "^[A-Z].*" + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + 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: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + _fake_oneOfWIthSameErasure_get_200_response: + oneOf: + - default: [] + items: + type: string + type: array + - default: [] + items: + type: integer + type: array + _fake_anyOfWIthSameErasure_get_200_response: + anyOf: + - default: [] + items: + type: string + type: array + - default: [] + items: + type: integer + type: array + testInlineFreeformAdditionalProperties_request: + additionalProperties: true + properties: + someProperty: + type: string + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + fake_ref_parameter_petId_parameter: + oneOf: + - type: string + - type: integer + FreeFormObjectTestClass_properties: + oneOf: + - type: string + - additionalProperties: true + default: [] + type: object + ArrayOfInlineAllOf_array_allof_dog_property_inner: + allOf: + - properties: + breed: + type: string + type: object + - properties: + color: + type: string + type: object + NewPet_category_inline_allof_allOf_category_tag: + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + NewPet_category_inline_allof: + allOf: + - properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + category_tag: + $ref: "#/components/schemas/NewPet_category_inline_allof_allOf_category_tag" + required: + - name + type: object + AllOfModelArrayAnyOf_allOf_linkListColumn1_value: + anyOf: + - $ref: "#/components/schemas/User" + - $ref: "#/components/schemas/Tag" + AllOfModelArrayAnyOf_allOf_linkListColumn1: + properties: + value: + default: [] + items: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_linkListColumn1_value" + type: array + required: + - value + type: object + AllOfModelArrayAnyOf_allOf_attributes_C: + oneOf: + - $ref: "#/components/schemas/Pet" + - $ref: "#/components/schemas/Order" + AllOfModelArrayAnyOf_allOf_attributes: + properties: + C: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_attributes_C" + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http + diff --git a/samples/client/petstore/java/okhttp-jackson3/build.gradle b/samples/client/petstore/java/okhttp-jackson3/build.gradle new file mode 100644 index 000000000000..8c953dfa5177 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/build.gradle @@ -0,0 +1,69 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-okhttp-jackson3' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + jackson_version = "3.2.1" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + implementation 'org.openapitools:jackson-databind-nullable:0.2.10' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.18.0' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/build.sbt b/samples/client/petstore/java/okhttp-jackson3/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-jackson3/docs/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..83051d9be44b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/AdditionalPropertiesClass.md @@ -0,0 +1,20 @@ + + +# AdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapProperty** | **Map<String, String>** | | [optional] | +|**mapOfMapProperty** | **Map<String, Map<String, String>>** | | [optional] | +|**anytype1** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype3** | **Map<String, Object>** | | [optional] | +|**emptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] | +|**mapWithUndeclaredPropertiesString** | **Map<String, String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOf.md b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOf.md new file mode 100644 index 000000000000..96dc5a34d089 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOf.md @@ -0,0 +1,16 @@ + + +# AllOfModelArrayAnyOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | +|**linkListColumn1** | [**AllOfModelArrayAnyOfAllOfLinkListColumn1**](AllOfModelArrayAnyOfAllOfLinkListColumn1.md) | | [optional] | +|**attributes** | [**AllOfModelArrayAnyOfAllOfAttributes**](AllOfModelArrayAnyOfAllOfAttributes.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfAttributes.md b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfAttributes.md new file mode 100644 index 000000000000..c9096e515367 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfAttributes.md @@ -0,0 +1,13 @@ + + +# AllOfModelArrayAnyOfAllOfAttributes + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**C** | [**AllOfModelArrayAnyOfAllOfAttributesC**](AllOfModelArrayAnyOfAllOfAttributesC.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfAttributesC.md b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfAttributesC.md new file mode 100644 index 000000000000..5229de89b299 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfAttributesC.md @@ -0,0 +1,32 @@ + + +# AllOfModelArrayAnyOfAllOfAttributesC + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md new file mode 100644 index 000000000000..43fa9b696377 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md @@ -0,0 +1,13 @@ + + +# AllOfModelArrayAnyOfAllOfLinkListColumn1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**value** | [**List<AllOfModelArrayAnyOfAllOfLinkListColumn1Value>**](AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md) | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md new file mode 100644 index 000000000000..6379cac28b02 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md @@ -0,0 +1,25 @@ + + +# AllOfModelArrayAnyOfAllOfLinkListColumn1Value + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | +|**objectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] | +|**objectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] | +|**anyTypeProp** | **Object** | 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 | [optional] | +|**anyTypePropNullable** | **Object** | 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. | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/AllOfRefToDouble.md b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfRefToDouble.md new file mode 100644 index 000000000000..516584f74348 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfRefToDouble.md @@ -0,0 +1,14 @@ + + +# AllOfRefToDouble + +Object with allOf ref to double + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**height** | **Double** | Height as double | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/AllOfRefToFloat.md b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfRefToFloat.md new file mode 100644 index 000000000000..9a60af8a2ea4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfRefToFloat.md @@ -0,0 +1,14 @@ + + +# AllOfRefToFloat + +Object with allOf ref to float + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**weight** | **Float** | Weight as float | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/AllOfRefToLong.md b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfRefToLong.md new file mode 100644 index 000000000000..0f32d49b0857 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/AllOfRefToLong.md @@ -0,0 +1,14 @@ + + +# AllOfRefToLong + +Object with allOf ref to long + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | Id as long | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Animal.md b/samples/client/petstore/java/okhttp-jackson3/docs/Animal.md new file mode 100644 index 000000000000..d9b32f14c88a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Animal.md @@ -0,0 +1,14 @@ + + +# Animal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | +|**color** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/AnotherFakeApi.md b/samples/client/petstore/java/okhttp-jackson3/docs/AnotherFakeApi.md new file mode 100644 index 000000000000..6cca209c72b1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/AnotherFakeApi.md @@ -0,0 +1,191 @@ +# AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags | +| [**getParameterArrayNumber**](AnotherFakeApi.md#getParameterArrayNumber) | **GET** /fake/parameter-array-number | parameter array number default value | +| [**getParameterStringNumber**](AnotherFakeApi.md#getParameterStringNumber) | **GET** /fake/parameter-string-number | parameter string number | + + + +# **call123testSpecialTags** +> Client call123testSpecialTags(client) + +To test special tags + +To test special tags and operation ID starting with number + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getParameterArrayNumber** +> getParameterArrayNumber(array) + +parameter array number default value + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + List array = Arrays.asList(); // List | array integer + try { + apiInstance.getParameterArrayNumber(array); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#getParameterArrayNumber"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **array** | [**List<Integer>**](Integer.md)| array integer | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +# **getParameterStringNumber** +> getParameterStringNumber(stringNumber) + +parameter string number + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + BigDecimal stringNumber = new BigDecimal(78); // BigDecimal | string number + try { + apiInstance.getParameterStringNumber(stringNumber); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#getParameterStringNumber"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **stringNumber** | **BigDecimal**| string number | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Apple.md b/samples/client/petstore/java/okhttp-jackson3/docs/Apple.md new file mode 100644 index 000000000000..0ef7a92c74d6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Apple.md @@ -0,0 +1,14 @@ + + +# Apple + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | [optional] | +|**origin** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/AppleReq.md b/samples/client/petstore/java/okhttp-jackson3/docs/AppleReq.md new file mode 100644 index 000000000000..989e1cfedd1e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/AppleReq.md @@ -0,0 +1,14 @@ + + +# AppleReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | | +|**mealy** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ArrayAnyOf.md b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayAnyOf.md new file mode 100644 index 000000000000..86bb944833ac --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayAnyOf.md @@ -0,0 +1,12 @@ + + +# ArrayAnyOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ArrayDefault.md b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayDefault.md new file mode 100644 index 000000000000..b539cb294d74 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayDefault.md @@ -0,0 +1,14 @@ + + +# ArrayDefault + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**withDefaultEmptyBracket** | **List<String>** | | [optional] | +|**withoutDefault** | **List<String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..0188db3eb131 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayArrayNumber** | **List<List<BigDecimal>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfInlineAllOf.md b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfInlineAllOf.md new file mode 100644 index 000000000000..3efa4933a3b9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfInlineAllOf.md @@ -0,0 +1,15 @@ + + +# ArrayOfInlineAllOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | +|**arrayAllofDogProperty** | [**List<ArrayOfInlineAllOfArrayAllofDogPropertyInner>**](ArrayOfInlineAllOfArrayAllofDogPropertyInner.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md new file mode 100644 index 000000000000..35f349597734 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md @@ -0,0 +1,14 @@ + + +# ArrayOfInlineAllOfArrayAllofDogPropertyInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | +|**color** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..a5753530aada --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayNumber** | **List<BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOneOf.md b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOneOf.md new file mode 100644 index 000000000000..34727d5f7301 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayOneOf.md @@ -0,0 +1,12 @@ + + +# ArrayOneOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ArrayTest.md b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayTest.md new file mode 100644 index 000000000000..36077c9df300 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ArrayTest.md @@ -0,0 +1,15 @@ + + +# ArrayTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayOfString** | **List<String>** | | [optional] | +|**arrayArrayOfInteger** | **List<List<Long>>** | | [optional] | +|**arrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Banana.md b/samples/client/petstore/java/okhttp-jackson3/docs/Banana.md new file mode 100644 index 000000000000..5356d17ee700 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Banana.md @@ -0,0 +1,13 @@ + + +# Banana + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**lengthCm** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/BananaReq.md b/samples/client/petstore/java/okhttp-jackson3/docs/BananaReq.md new file mode 100644 index 000000000000..22ebe1a7105f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/BananaReq.md @@ -0,0 +1,14 @@ + + +# BananaReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**lengthCm** | **BigDecimal** | | | +|**sweet** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/BasquePig.md b/samples/client/petstore/java/okhttp-jackson3/docs/BasquePig.md new file mode 100644 index 000000000000..160cb71c321f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/BasquePig.md @@ -0,0 +1,13 @@ + + +# BasquePig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Capitalization.md b/samples/client/petstore/java/okhttp-jackson3/docs/Capitalization.md new file mode 100644 index 000000000000..82a812711de2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Capitalization.md @@ -0,0 +1,18 @@ + + +# Capitalization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**smallCamel** | **String** | | [optional] | +|**capitalCamel** | **String** | | [optional] | +|**smallSnake** | **String** | | [optional] | +|**capitalSnake** | **String** | | [optional] | +|**scAETHFlowPoints** | **String** | | [optional] | +|**ATT_NAME** | **String** | Name of the pet | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Cat.md b/samples/client/petstore/java/okhttp-jackson3/docs/Cat.md new file mode 100644 index 000000000000..390dd519c8ce --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Cat.md @@ -0,0 +1,13 @@ + + +# Cat + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**declawed** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Category.md b/samples/client/petstore/java/okhttp-jackson3/docs/Category.md new file mode 100644 index 000000000000..ab6d1ec334dc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Category.md @@ -0,0 +1,14 @@ + + +# Category + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ClassModel.md b/samples/client/petstore/java/okhttp-jackson3/docs/ClassModel.md new file mode 100644 index 000000000000..af46dea1f6c8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ClassModel.md @@ -0,0 +1,14 @@ + + +# ClassModel + +Model for testing model with \"_class\" property + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Client.md b/samples/client/petstore/java/okhttp-jackson3/docs/Client.md new file mode 100644 index 000000000000..ef07b4ab8b9d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Client.md @@ -0,0 +1,13 @@ + + +# Client + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**client** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ComplexQuadrilateral.md b/samples/client/petstore/java/okhttp-jackson3/docs/ComplexQuadrilateral.md new file mode 100644 index 000000000000..d0a4b1a0a758 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ComplexQuadrilateral.md @@ -0,0 +1,14 @@ + + +# ComplexQuadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/DanishPig.md b/samples/client/petstore/java/okhttp-jackson3/docs/DanishPig.md new file mode 100644 index 000000000000..0b366d3cf2ff --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/DanishPig.md @@ -0,0 +1,13 @@ + + +# DanishPig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/DefaultApi.md b/samples/client/petstore/java/okhttp-jackson3/docs/DefaultApi.md new file mode 100644 index 000000000000..b0835fc23cf1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/DefaultApi.md @@ -0,0 +1,245 @@ +# DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fakeAnyOfWIthSameErasureGet**](DefaultApi.md#fakeAnyOfWIthSameErasureGet) | **GET** /fake/anyOfWIthSameErasure | | +| [**fakeFreeFormQueryParametersGet**](DefaultApi.md#fakeFreeFormQueryParametersGet) | **GET** /fake/free-form-query-parameters | | +| [**fakeOneOfWIthSameErasureGet**](DefaultApi.md#fakeOneOfWIthSameErasureGet) | **GET** /fake/oneOfWIthSameErasure | | +| [**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | | + + + +# **fakeAnyOfWIthSameErasureGet** +> FakeAnyOfWIthSameErasureGet200Response fakeAnyOfWIthSameErasureGet() + + + +Test route, this shouldn't cause a compiler error + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + FakeAnyOfWIthSameErasureGet200Response result = apiInstance.fakeAnyOfWIthSameErasureGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fakeAnyOfWIthSameErasureGet"); + 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 + +[**FakeAnyOfWIthSameErasureGet200Response**](FakeAnyOfWIthSameErasureGet200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful response | - | + + +# **fakeFreeFormQueryParametersGet** +> fakeFreeFormQueryParametersGet(fixed, freeForm) + + + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + String fixed = "fixed_example"; // String | + Object freeForm = null; // Object | + try { + apiInstance.fakeFreeFormQueryParametersGet(fixed, freeForm); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fakeFreeFormQueryParametersGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **fixed** | **String**| | [optional] | +| **freeForm** | [**Object**](.md)| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +# **fakeOneOfWIthSameErasureGet** +> FakeOneOfWIthSameErasureGet200Response fakeOneOfWIthSameErasureGet() + + + +Test route, this shouldn't cause a compiler error + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + FakeOneOfWIthSameErasureGet200Response result = apiInstance.fakeOneOfWIthSameErasureGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fakeOneOfWIthSameErasureGet"); + 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 + +[**FakeOneOfWIthSameErasureGet200Response**](FakeOneOfWIthSameErasureGet200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful response | - | + + +# **fooGet** +> FooGetDefaultResponse fooGet() + + + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + FooGetDefaultResponse result = apiInstance.fooGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fooGet"); + 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 + +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/DeprecatedObject.md b/samples/client/petstore/java/okhttp-jackson3/docs/DeprecatedObject.md new file mode 100644 index 000000000000..48de1d624425 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/DeprecatedObject.md @@ -0,0 +1,13 @@ + + +# DeprecatedObject + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Dog.md b/samples/client/petstore/java/okhttp-jackson3/docs/Dog.md new file mode 100644 index 000000000000..972c981c0d05 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Dog.md @@ -0,0 +1,13 @@ + + +# Dog + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Drawing.md b/samples/client/petstore/java/okhttp-jackson3/docs/Drawing.md new file mode 100644 index 000000000000..6b815fc4131b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Drawing.md @@ -0,0 +1,16 @@ + + +# Drawing + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mainShape** | [**Shape**](Shape.md) | | [optional] | +|**shapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] | +|**nullableShape** | [**NullableShape**](NullableShape.md) | | [optional] | +|**shapes** | [**List<Shape>**](Shape.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/EnumArrays.md b/samples/client/petstore/java/okhttp-jackson3/docs/EnumArrays.md new file mode 100644 index 000000000000..b2222d5beb25 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/EnumArrays.md @@ -0,0 +1,32 @@ + + +# EnumArrays + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] | +|**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] | + + + +## Enum: JustSymbolEnum + +| Name | Value | +|---- | -----| +| GREATER_THAN_OR_EQUAL_TO | ">=" | +| DOLLAR | "$" | + + + +## Enum: List<ArrayEnumEnum> + +| Name | Value | +|---- | -----| +| FISH | "fish" | +| CRAB | "crab" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/EnumClass.md b/samples/client/petstore/java/okhttp-jackson3/docs/EnumClass.md new file mode 100644 index 000000000000..b314590a7591 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/EnumClass.md @@ -0,0 +1,15 @@ + + +# EnumClass + +## Enum + + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/EnumStringDiscriminator.md b/samples/client/petstore/java/okhttp-jackson3/docs/EnumStringDiscriminator.md new file mode 100644 index 000000000000..83aebcdb4226 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/EnumStringDiscriminator.md @@ -0,0 +1,23 @@ + + +# EnumStringDiscriminator + +An object to test discriminator of enum string + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**enumStrType** | [**EnumStrTypeEnum**](#EnumStrTypeEnum) | enum string type | | + + + +## Enum: EnumStrTypeEnum + +| Name | Value | +|---- | -----| +| A | "type_a" | +| B | "type_b" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/EnumTest.md b/samples/client/petstore/java/okhttp-jackson3/docs/EnumTest.md new file mode 100644 index 000000000000..3e226e18b50b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/EnumTest.md @@ -0,0 +1,68 @@ + + +# EnumTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] | +|**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | | +|**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] | +|**enumIntegerOnly** | [**EnumIntegerOnlyEnum**](#EnumIntegerOnlyEnum) | | [optional] | +|**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] | +|**outerEnum** | **OuterEnum** | | [optional] | +|**outerEnumInteger** | **OuterEnumInteger** | | [optional] | +|**outerEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] | +|**outerEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] | + + + +## Enum: EnumStringEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumStringRequiredEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumIntegerEnum + +| Name | Value | +|---- | -----| +| NUMBER_1 | 1 | +| NUMBER_MINUS_1 | -1 | + + + +## Enum: EnumIntegerOnlyEnum + +| Name | Value | +|---- | -----| +| NUMBER_2 | 2 | +| NUMBER_MINUS_2 | -2 | + + + +## Enum: EnumNumberEnum + +| Name | Value | +|---- | -----| +| NUMBER_1_DOT_1 | 1.1 | +| NUMBER_MINUS_1_DOT_2 | -1.2 | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/EquilateralTriangle.md b/samples/client/petstore/java/okhttp-jackson3/docs/EquilateralTriangle.md new file mode 100644 index 000000000000..eade817feb3e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/EquilateralTriangle.md @@ -0,0 +1,14 @@ + + +# EquilateralTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/FakeAnyOfWIthSameErasureGet200Response.md b/samples/client/petstore/java/okhttp-jackson3/docs/FakeAnyOfWIthSameErasureGet200Response.md new file mode 100644 index 000000000000..c224eb3d572f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/FakeAnyOfWIthSameErasureGet200Response.md @@ -0,0 +1,12 @@ + + +# FakeAnyOfWIthSameErasureGet200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/FakeApi.md b/samples/client/petstore/java/okhttp-jackson3/docs/FakeApi.md new file mode 100644 index 000000000000..00d888ebe6e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/FakeApi.md @@ -0,0 +1,1571 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fakeGetFreeFormObjectGet**](FakeApi.md#fakeGetFreeFormObjectGet) | **GET** /fake/get-free-form-object | | +| [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | +| [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | | +| [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | | +| [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | | +| [**fakeRefParameter**](FakeApi.md#fakeRefParameter) | **POST** /fake/pet/{petId}/reference/parameter | fake reference parameter | +| [**fakeRequiredNullableBodyGet**](FakeApi.md#fakeRequiredNullableBodyGet) | **GET** /fake/required-nullable-body | fields in the response body, required and nullable are both true | +| [**fakeUploadRefRequestBodies**](FakeApi.md#fakeUploadRefRequestBodies) | **POST** /fake/pet/{petId}/uploadImage | fake reference parameter | +| [**getFakeArrayofenums**](FakeApi.md#getFakeArrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**getFakeHealth**](FakeApi.md#getFakeHealth) | **GET** /fake/health | Health check endpoint | +| [**getParameterNameMapping**](FakeApi.md#getParameterNameMapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test | +| [**testAdditionalPropertiesReference**](FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | +| [**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 | +| [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 | +| [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters | +| [**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) | +| [**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties | +| [**testInlineFreeformAdditionalProperties**](FakeApi.md#testInlineFreeformAdditionalProperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties | +| [**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data | +| [**testNullableRequiredFieldsAnyOf**](FakeApi.md#testNullableRequiredFieldsAnyOf) | **GET** /fake/nullable-required-fields-anyof | test anyOf with map of objects containing nullable required fields | +| [**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | | +| [**testStringMapReference**](FakeApi.md#testStringMapReference) | **POST** /fake/stringMap-reference | test referenced string map | + + + +# **fakeGetFreeFormObjectGet** +> FreeFormObjectTestClass fakeGetFreeFormObjectGet() + + + +Get a free form object or Json string + +### 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 { + FreeFormObjectTestClass result = apiInstance.fakeGetFreeFormObjectGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeGetFreeFormObjectGet"); + 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 + +[**FreeFormObjectTestClass**](FreeFormObjectTestClass.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### 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); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **Boolean**| Input boolean as post body | [optional] | + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(outerComposite) + + + +Test serialization of object with outer number type + +### 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); + OuterComposite outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(outerComposite); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] | + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### 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); + BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **BigDecimal**| Input number as post body | [optional] | + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### 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); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **String**| Input string as post body | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + + +# **fakeRefParameter** +> fakeRefParameter(petId) + +fake reference parameter + + + +### 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); + FakeRefParameterPetIdParameter petId = new FakeRefParameterPetIdParameter(); // FakeRefParameterPetIdParameter | to test oneOf in parameter $ref + try { + apiInstance.fakeRefParameter(petId); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeRefParameter"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | [**FakeRefParameterPetIdParameter**](.md)| to test oneOf in parameter $ref | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **fakeRequiredNullableBodyGet** +> RequiredNullableBody fakeRequiredNullableBodyGet() + +fields in the response body, required and nullable are both true + + + +### 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 { + RequiredNullableBody result = apiInstance.fakeRequiredNullableBodyGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeRequiredNullableBodyGet"); + 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 + +[**RequiredNullableBody**](RequiredNullableBody.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | success | - | + + +# **fakeUploadRefRequestBodies** +> ModelApiResponse fakeUploadRefRequestBodies(petId, additionalMetadata, _file) + +fake reference parameter + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.fakeUploadRefRequestBodies(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeUploadRefRequestBodies"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getFakeArrayofenums** +> List<OuterEnum> getFakeArrayofenums() + +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.getFakeArrayofenums(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getFakeArrayofenums"); + 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 | - | + + +# **getFakeHealth** +> HealthCheckResult getFakeHealth() + +Health check endpoint + +### 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 { + HealthCheckResult result = apiInstance.getFakeHealth(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getFakeHealth"); + 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 + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | The instance started successfully | - | + + +# **getParameterNameMapping** +> getParameterNameMapping(underscoreType, type, typeWithUnderscore) + +parameter name mapping test + +### 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); + Long underscoreType = 56L; // Long | _type + String type = "type_example"; // String | type + String typeWithUnderscore = "typeWithUnderscore_example"; // String | type_ + try { + apiInstance.getParameterNameMapping(underscoreType, type, typeWithUnderscore); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getParameterNameMapping"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **underscoreType** | **Long**| _type | | +| **type** | **String**| type | | +| **typeWithUnderscore** | **String**| type_ | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +# **testAdditionalPropertiesReference** +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### 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); + Map requestBody = null; // Map | request body + try { + apiInstance.testAdditionalPropertiesReference(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testAdditionalPropertiesReference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, Object>**](Object.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +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); + FileSchemaTestClass fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(fileSchemaTestClass); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(query, user) + + + +### 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); + String query = "query_example"; // String | + User user = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, user); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **query** | **String**| | | +| **user** | [**User**](User.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testClientModel** +> Client testClientModel(client) + +To test \"client\" model + +To test \"client\" model + +### 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); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testEndpointParameters** +> testEndpointParameters(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 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(78); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = LocalDate.now(); // LocalDate | None + OffsetDateTime dateTime = OffsetDateTime.parse("2010-02-01T10:20:10.111110+01:00"); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **number** | **BigDecimal**| None | | +| **_double** | **Double**| None | | +| **patternWithoutDelimiter** | **String**| None | | +| **_byte** | **byte[]**| None | | +| **integer** | **Integer**| None | [optional] | +| **int32** | **Integer**| None | [optional] | +| **int64** | **Long**| None | [optional] | +| **_float** | **Float**| None | [optional] | +| **string** | **String**| None | [optional] | +| **binary** | **File**| None | [optional] | +| **date** | **LocalDate**| None | [optional] | +| **dateTime** | **OffsetDateTime**| None | [optional] [default to 2010-02-01T10:20:10.111110+01:00] | +| **password** | **String**| None | [optional] | +| **paramCallback** | **String**| None | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **testEnumParameters** +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### 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); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "_abc"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "_abc"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 1; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 1.1D; // Double | Query parameter enum test (double) + List enumFormStringArray = Arrays.asList("$"); // List | Form parameter enum test (string array) + String enumFormString = "_abc"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] | +| **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] | +| **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] | +| **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] | +| **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] | +| **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + + +# **testGroupParameters** +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group).stringGroup(stringGroup).booleanGroup(booleanGroup).int64Group(int64Group).execute(); + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP bearer authorization: bearer_test + HttpBearerAuth bearer_test = (HttpBearerAuth) defaultClient.getAuthentication("bearer_test"); + bearer_test.setBearerToken("BEARER TOKEN"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requiredStringGroup** | **Integer**| Required String in group parameters | | +| **requiredBooleanGroup** | **Boolean**| Required Boolean in group parameters | | +| **requiredInt64Group** | **Long**| Required Integer in group parameters | | +| **stringGroup** | **Integer**| String in group parameters | [optional] | +| **booleanGroup** | **Boolean**| Boolean in group parameters | [optional] | +| **int64Group** | **Long**| Integer in group parameters | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Something wrong | - | + + +# **testInlineAdditionalProperties** +> testInlineAdditionalProperties(requestBody) + +test inline additionalProperties + + + +### 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); + Map requestBody = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, String>**](String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testInlineFreeformAdditionalProperties** +> testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + + + +### 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); + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = new TestInlineFreeformAdditionalPropertiesRequest(); // TestInlineFreeformAdditionalPropertiesRequest | request body + try { + apiInstance.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineFreeformAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + + + +### 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); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **param** | **String**| field1 | | +| **param2** | **String**| field2 | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testNullableRequiredFieldsAnyOf** +> NullableFieldsMapResponse testNullableRequiredFieldsAnyOf() + +test anyOf with map of objects containing nullable required fields + +Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + +### 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 { + NullableFieldsMapResponse result = apiInstance.testNullableRequiredFieldsAnyOf(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testNullableRequiredFieldsAnyOf"); + 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 + +[**NullableFieldsMapResponse**](NullableFieldsMapResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + + +To test the collection format in query parameters + +### 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); + List pipe = Arrays.asList(); // List | + List ioutil = Arrays.asList(); // List | + List http = Arrays.asList(); // List | + List url = Arrays.asList(); // List | + List context = Arrays.asList(); // List | + try { + apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pipe** | [**List<String>**](String.md)| | | +| **ioutil** | [**List<String>**](String.md)| | | +| **http** | [**List<String>**](String.md)| | | +| **url** | [**List<String>**](String.md)| | | +| **context** | [**List<String>**](String.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testStringMapReference** +> testStringMapReference(requestBody) + +test referenced string map + + + +### 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); + Map requestBody = new HashMap(); // Map | request body + try { + apiInstance.testStringMapReference(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testStringMapReference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, String>**](String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/okhttp-jackson3/docs/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..95a8c171fc34 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/FakeClassnameTags123Api.md @@ -0,0 +1,78 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case | + + + +# **testClassname** +> Client testClassname(client) + +To test class name in snake case + +To test class name in snake case + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); + + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/FakeOneOfWIthSameErasureGet200Response.md b/samples/client/petstore/java/okhttp-jackson3/docs/FakeOneOfWIthSameErasureGet200Response.md new file mode 100644 index 000000000000..0a3fbf6f8fca --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/FakeOneOfWIthSameErasureGet200Response.md @@ -0,0 +1,12 @@ + + +# FakeOneOfWIthSameErasureGet200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/FakeRefParameterPetIdParameter.md b/samples/client/petstore/java/okhttp-jackson3/docs/FakeRefParameterPetIdParameter.md new file mode 100644 index 000000000000..1328d3c125c4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/FakeRefParameterPetIdParameter.md @@ -0,0 +1,12 @@ + + +# FakeRefParameterPetIdParameter + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/FileSchemaTestClass.md b/samples/client/petstore/java/okhttp-jackson3/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..85d1a0636694 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/FileSchemaTestClass.md @@ -0,0 +1,14 @@ + + +# FileSchemaTestClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_file** | [**ModelFile**](ModelFile.md) | | [optional] | +|**files** | [**List<ModelFile>**](ModelFile.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Foo.md b/samples/client/petstore/java/okhttp-jackson3/docs/Foo.md new file mode 100644 index 000000000000..6b3f0556528a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Foo.md @@ -0,0 +1,13 @@ + + +# Foo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/FooGetDefaultResponse.md b/samples/client/petstore/java/okhttp-jackson3/docs/FooGetDefaultResponse.md new file mode 100644 index 000000000000..ff3d7a3a56c3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/FooGetDefaultResponse.md @@ -0,0 +1,13 @@ + + +# FooGetDefaultResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**string** | [**Foo**](Foo.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/FormatTest.md b/samples/client/petstore/java/okhttp-jackson3/docs/FormatTest.md new file mode 100644 index 000000000000..71790022c16d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/FormatTest.md @@ -0,0 +1,29 @@ + + +# FormatTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integer** | **Integer** | | [optional] | +|**int32** | **Integer** | | [optional] | +|**int64** | **Long** | | [optional] | +|**number** | **BigDecimal** | | | +|**_float** | **Float** | | [optional] | +|**_double** | **Double** | | [optional] | +|**decimal** | **BigDecimal** | | [optional] | +|**string** | **String** | | [optional] | +|**_byte** | **byte[]** | | | +|**binary** | **File** | | [optional] | +|**date** | **LocalDate** | | | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**uuid** | **UUID** | | [optional] | +|**uuidWithDefault** | **UUID** | | [optional] | +|**password** | **String** | | | +|**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] | +|**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/FreeFormObjectTestClass.md b/samples/client/petstore/java/okhttp-jackson3/docs/FreeFormObjectTestClass.md new file mode 100644 index 000000000000..3bb6144bc90b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/FreeFormObjectTestClass.md @@ -0,0 +1,14 @@ + + +# FreeFormObjectTestClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**properties** | [**FreeFormObjectTestClassProperties**](FreeFormObjectTestClassProperties.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/FreeFormObjectTestClassProperties.md b/samples/client/petstore/java/okhttp-jackson3/docs/FreeFormObjectTestClassProperties.md new file mode 100644 index 000000000000..8a7c9d2838a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/FreeFormObjectTestClassProperties.md @@ -0,0 +1,12 @@ + + +# FreeFormObjectTestClassProperties + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Fruit.md b/samples/client/petstore/java/okhttp-jackson3/docs/Fruit.md new file mode 100644 index 000000000000..f1915ef9b5b6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Fruit.md @@ -0,0 +1,16 @@ + + +# Fruit + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**color** | **String** | | [optional] | +|**cultivar** | **String** | | [optional] | +|**origin** | **String** | | [optional] | +|**lengthCm** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/FruitReq.md b/samples/client/petstore/java/okhttp-jackson3/docs/FruitReq.md new file mode 100644 index 000000000000..859a881b53ec --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/FruitReq.md @@ -0,0 +1,16 @@ + + +# FruitReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | | +|**mealy** | **Boolean** | | [optional] | +|**lengthCm** | **BigDecimal** | | | +|**sweet** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/GmFruit.md b/samples/client/petstore/java/okhttp-jackson3/docs/GmFruit.md new file mode 100644 index 000000000000..1a301bf9600a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/GmFruit.md @@ -0,0 +1,16 @@ + + +# GmFruit + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**color** | **String** | | [optional] | +|**cultivar** | **String** | | [optional] | +|**origin** | **String** | | [optional] | +|**lengthCm** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/GrandparentAnimal.md b/samples/client/petstore/java/okhttp-jackson3/docs/GrandparentAnimal.md new file mode 100644 index 000000000000..9737408f2724 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/GrandparentAnimal.md @@ -0,0 +1,13 @@ + + +# GrandparentAnimal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**petType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/okhttp-jackson3/docs/HasOnlyReadOnly.md new file mode 100644 index 000000000000..29da5205dbba --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/HasOnlyReadOnly.md @@ -0,0 +1,14 @@ + + +# HasOnlyReadOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**foo** | **String** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/HealthCheckResult.md b/samples/client/petstore/java/okhttp-jackson3/docs/HealthCheckResult.md new file mode 100644 index 000000000000..4885e6f1cada --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/HealthCheckResult.md @@ -0,0 +1,14 @@ + + +# HealthCheckResult + +Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**nullableMessage** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/IsoscelesTriangle.md b/samples/client/petstore/java/okhttp-jackson3/docs/IsoscelesTriangle.md new file mode 100644 index 000000000000..0bd5045bc68f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/IsoscelesTriangle.md @@ -0,0 +1,14 @@ + + +# IsoscelesTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Mammal.md b/samples/client/petstore/java/okhttp-jackson3/docs/Mammal.md new file mode 100644 index 000000000000..71f0fce48839 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Mammal.md @@ -0,0 +1,26 @@ + + +# Mammal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasBaleen** | **Boolean** | | [optional] | +|**hasTeeth** | **Boolean** | | [optional] | +|**className** | **String** | | | +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| PLAINS | "plains" | +| MOUNTAIN | "mountain" | +| GREVYS | "grevys" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/MammalAnyof.md b/samples/client/petstore/java/okhttp-jackson3/docs/MammalAnyof.md new file mode 100644 index 000000000000..7a366e10da49 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/MammalAnyof.md @@ -0,0 +1,26 @@ + + +# MammalAnyof + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasBaleen** | **Boolean** | | [optional] | +|**hasTeeth** | **Boolean** | | [optional] | +|**className** | **String** | | | +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| PLAINS | "plains" | +| MOUNTAIN | "mountain" | +| GREVYS | "grevys" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/MapTest.md b/samples/client/petstore/java/okhttp-jackson3/docs/MapTest.md new file mode 100644 index 000000000000..54380188e1d6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/MapTest.md @@ -0,0 +1,25 @@ + + +# MapTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapMapOfString** | **Map<String, Map<String, String>>** | | [optional] | +|**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] | +|**directMap** | **Map<String, Boolean>** | | [optional] | +|**indirectMap** | **Map<String, Boolean>** | | [optional] | + + + +## Enum: Map<String, InnerEnum> + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-jackson3/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..a5ddf0faa6a9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,15 @@ + + +# MixedPropertiesAndAdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **UUID** | | [optional] | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**map** | [**Map<String, Animal>**](Animal.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Model200Response.md b/samples/client/petstore/java/okhttp-jackson3/docs/Model200Response.md new file mode 100644 index 000000000000..109411580c62 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Model200Response.md @@ -0,0 +1,15 @@ + + +# Model200Response + +Model for testing model name starting with number + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | [optional] | +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-jackson3/docs/ModelApiResponse.md new file mode 100644 index 000000000000..e374c2dd2dec --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ModelApiResponse.md @@ -0,0 +1,15 @@ + + +# ModelApiResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ModelFile.md b/samples/client/petstore/java/okhttp-jackson3/docs/ModelFile.md new file mode 100644 index 000000000000..adcde984f527 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ModelFile.md @@ -0,0 +1,14 @@ + + +# ModelFile + +Must be named `File` for test. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**sourceURI** | **String** | Test capitalization | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ModelList.md b/samples/client/petstore/java/okhttp-jackson3/docs/ModelList.md new file mode 100644 index 000000000000..f93ab7dde8d4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ModelList.md @@ -0,0 +1,13 @@ + + +# ModelList + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_123list** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ModelReturn.md b/samples/client/petstore/java/okhttp-jackson3/docs/ModelReturn.md new file mode 100644 index 000000000000..0bd356861eb7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ModelReturn.md @@ -0,0 +1,14 @@ + + +# ModelReturn + +Model for testing reserved words + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_return** | **Integer** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ModelWithOneOfAnyOfProperties.md b/samples/client/petstore/java/okhttp-jackson3/docs/ModelWithOneOfAnyOfProperties.md new file mode 100644 index 000000000000..64c1206365fd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ModelWithOneOfAnyOfProperties.md @@ -0,0 +1,14 @@ + + +# ModelWithOneOfAnyOfProperties + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**oneofProp** | [**ArrayOneOf**](ArrayOneOf.md) | | [optional] | +|**anyofProp** | [**ArrayAnyOf**](ArrayAnyOf.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Name.md b/samples/client/petstore/java/okhttp-jackson3/docs/Name.md new file mode 100644 index 000000000000..c901d9435309 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Name.md @@ -0,0 +1,17 @@ + + +# Name + +Model for testing model name same as property name + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | | +|**snakeCase** | **Integer** | | [optional] [readonly] | +|**property** | **String** | | [optional] | +|**_123number** | **Integer** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/NestedArrayWithDefaultValues.md b/samples/client/petstore/java/okhttp-jackson3/docs/NestedArrayWithDefaultValues.md new file mode 100644 index 000000000000..c5f272f1cb30 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/NestedArrayWithDefaultValues.md @@ -0,0 +1,13 @@ + + +# NestedArrayWithDefaultValues + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**nestedArray** | **List<List<String>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/NewPet.md b/samples/client/petstore/java/okhttp-jackson3/docs/NewPet.md new file mode 100644 index 000000000000..3cfa8c0076fe --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/NewPet.md @@ -0,0 +1,31 @@ + + +# NewPet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**categoryInlineAllof** | [**NewPetCategoryInlineAllof**](NewPetCategoryInlineAllof.md) | | [optional] | +|**categoryAllOfRef** | [**Category**](Category.md) | | [optional] | +|**categoryAllOfRefDescription** | [**Category**](Category.md) | Adding description to property using allOf | [optional] | +|**categoryAllOfRefDescriptionReadonly** | [**Category**](Category.md) | Adding description to readonly property using allOf | [optional] [readonly] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/NewPetCategoryInlineAllof.md b/samples/client/petstore/java/okhttp-jackson3/docs/NewPetCategoryInlineAllof.md new file mode 100644 index 000000000000..7e8872f8132d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/NewPetCategoryInlineAllof.md @@ -0,0 +1,15 @@ + + +# NewPetCategoryInlineAllof + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | +|**categoryTag** | [**NewPetCategoryInlineAllofAllOfCategoryTag**](NewPetCategoryInlineAllofAllOfCategoryTag.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md b/samples/client/petstore/java/okhttp-jackson3/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md new file mode 100644 index 000000000000..d685440279e9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md @@ -0,0 +1,14 @@ + + +# NewPetCategoryInlineAllofAllOfCategoryTag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/NullableClass.md b/samples/client/petstore/java/okhttp-jackson3/docs/NullableClass.md new file mode 100644 index 000000000000..fa98c5c6d984 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/NullableClass.md @@ -0,0 +1,24 @@ + + +# NullableClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integerProp** | **Integer** | | [optional] | +|**numberProp** | **BigDecimal** | | [optional] | +|**booleanProp** | **Boolean** | | [optional] | +|**stringProp** | **String** | | [optional] | +|**dateProp** | **LocalDate** | | [optional] | +|**datetimeProp** | **OffsetDateTime** | | [optional] | +|**arrayNullableProp** | **List<Object>** | | [optional] | +|**arrayAndItemsNullableProp** | **List<Object>** | | [optional] | +|**arrayItemsNullable** | **List<Object>** | | [optional] | +|**objectNullableProp** | **Map<String, Object>** | | [optional] | +|**objectAndItemsNullableProp** | **Map<String, Object>** | | [optional] | +|**objectItemsNullable** | **Map<String, Object>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/NullableEnum.md b/samples/client/petstore/java/okhttp-jackson3/docs/NullableEnum.md new file mode 100644 index 000000000000..774c8d6b1d70 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/NullableEnum.md @@ -0,0 +1,11 @@ + + +# NullableEnum + +## Enum + + +* `CUSTOM` (value: `"custom"`) + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsMapError.md b/samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsMapError.md new file mode 100644 index 000000000000..c129f355904a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsMapError.md @@ -0,0 +1,15 @@ + + +# NullableFieldsMapError + +Error response + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | | +|**reason** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsMapResponse.md b/samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsMapResponse.md new file mode 100644 index 000000000000..de7b03be5807 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsMapResponse.md @@ -0,0 +1,15 @@ + + +# NullableFieldsMapResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | | +|**positions** | [**Map<String, NullableFieldsValue>**](NullableFieldsValue.md) | | | +|**reason** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsMapSuccess.md b/samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsMapSuccess.md new file mode 100644 index 000000000000..0ce60cd148f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsMapSuccess.md @@ -0,0 +1,15 @@ + + +# NullableFieldsMapSuccess + +Success response containing a map of objects with nullable fields + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | | +|**positions** | [**Map<String, NullableFieldsValue>**](NullableFieldsValue.md) | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsValue.md b/samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsValue.md new file mode 100644 index 000000000000..397f73f74007 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/NullableFieldsValue.md @@ -0,0 +1,15 @@ + + +# NullableFieldsValue + +Object with required but nullable string fields + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**before** | **String** | | | +|**after** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/NullableShape.md b/samples/client/petstore/java/okhttp-jackson3/docs/NullableShape.md new file mode 100644 index 000000000000..9d40680fd2c2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/NullableShape.md @@ -0,0 +1,16 @@ + + +# NullableShape + +The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/NumberOnly.md b/samples/client/petstore/java/okhttp-jackson3/docs/NumberOnly.md new file mode 100644 index 000000000000..b8ed1a4cfae1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/NumberOnly.md @@ -0,0 +1,13 @@ + + +# NumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justNumber** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ObjectWithDeprecatedFields.md b/samples/client/petstore/java/okhttp-jackson3/docs/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..f1cf571f4c09 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ObjectWithDeprecatedFields.md @@ -0,0 +1,16 @@ + + +# ObjectWithDeprecatedFields + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **String** | | [optional] | +|**id** | **BigDecimal** | | [optional] | +|**deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] | +|**bars** | **List<String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Order.md b/samples/client/petstore/java/okhttp-jackson3/docs/Order.md new file mode 100644 index 000000000000..27af32855c5c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Order.md @@ -0,0 +1,28 @@ + + +# Order + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/OuterComposite.md b/samples/client/petstore/java/okhttp-jackson3/docs/OuterComposite.md new file mode 100644 index 000000000000..98b56e0763ff --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/OuterComposite.md @@ -0,0 +1,15 @@ + + +# OuterComposite + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**myNumber** | **BigDecimal** | | [optional] | +|**myString** | **String** | | [optional] | +|**myBoolean** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/OuterEnum.md b/samples/client/petstore/java/okhttp-jackson3/docs/OuterEnum.md new file mode 100644 index 000000000000..e9228f060d25 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/OuterEnum.md @@ -0,0 +1,19 @@ + + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + +* `LOWER_CASE_S` (value: `"s"`) + +* `UPPER_CASE_S` (value: `"S"`) + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/OuterEnumDefaultValue.md b/samples/client/petstore/java/okhttp-jackson3/docs/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..cbc7f4ba54d2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/OuterEnumDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumDefaultValue + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/OuterEnumInteger.md b/samples/client/petstore/java/okhttp-jackson3/docs/OuterEnumInteger.md new file mode 100644 index 000000000000..f71dea30ad00 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/OuterEnumInteger.md @@ -0,0 +1,15 @@ + + +# OuterEnumInteger + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/java/okhttp-jackson3/docs/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..99e6389f4278 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumIntegerDefaultValue + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ParentPet.md b/samples/client/petstore/java/okhttp-jackson3/docs/ParentPet.md new file mode 100644 index 000000000000..4992b88a6710 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ParentPet.md @@ -0,0 +1,12 @@ + + +# ParentPet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Pet.md b/samples/client/petstore/java/okhttp-jackson3/docs/Pet.md new file mode 100644 index 000000000000..08dfd8623602 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Pet.md @@ -0,0 +1,28 @@ + + +# Pet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/PetApi.md b/samples/client/petstore/java/okhttp-jackson3/docs/PetApi.md new file mode 100644 index 000000000000..c7fa83cbbb77 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/PetApi.md @@ -0,0 +1,640 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | +| [**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) | + + + +# **addPet** +> addPet(pet) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(pet); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +# **updatePet** +> updatePet(pet) + +Update an existing pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(pet); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, contentType, additionalMetadata, _file) + +uploads an image + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String contentType = "contentType_example"; // String | Content type header parameter + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, contentType, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **contentType** | **String**| Content type header parameter | [optional] | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **uploadFileWithRequiredFile** +> ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **requiredFile** | **File**| file to upload | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/PetComposition.md b/samples/client/petstore/java/okhttp-jackson3/docs/PetComposition.md new file mode 100644 index 000000000000..3f93a8972ddc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/PetComposition.md @@ -0,0 +1,28 @@ + + +# PetComposition + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/PetRef.md b/samples/client/petstore/java/okhttp-jackson3/docs/PetRef.md new file mode 100644 index 000000000000..256faf704c49 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/PetRef.md @@ -0,0 +1,28 @@ + + +# PetRef + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/PetUsingAllOf.md b/samples/client/petstore/java/okhttp-jackson3/docs/PetUsingAllOf.md new file mode 100644 index 000000000000..379da2dc359f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/PetUsingAllOf.md @@ -0,0 +1,28 @@ + + +# PetUsingAllOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | multi line description 2nd line last line | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/PetWithRequiredTags.md b/samples/client/petstore/java/okhttp-jackson3/docs/PetWithRequiredTags.md new file mode 100644 index 000000000000..2f528f536e99 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/PetWithRequiredTags.md @@ -0,0 +1,28 @@ + + +# PetWithRequiredTags + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Pig.md b/samples/client/petstore/java/okhttp-jackson3/docs/Pig.md new file mode 100644 index 000000000000..61079c61c498 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Pig.md @@ -0,0 +1,13 @@ + + +# Pig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/PropertyNameCollision.md b/samples/client/petstore/java/okhttp-jackson3/docs/PropertyNameCollision.md new file mode 100644 index 000000000000..28775f9b7481 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/PropertyNameCollision.md @@ -0,0 +1,15 @@ + + +# PropertyNameCollision + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**underscoreType** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**typeWithUnderscore** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Quadrilateral.md b/samples/client/petstore/java/okhttp-jackson3/docs/Quadrilateral.md new file mode 100644 index 000000000000..af9f89a6f710 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Quadrilateral.md @@ -0,0 +1,14 @@ + + +# Quadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/QuadrilateralInterface.md b/samples/client/petstore/java/okhttp-jackson3/docs/QuadrilateralInterface.md new file mode 100644 index 000000000000..99451f3bd020 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/QuadrilateralInterface.md @@ -0,0 +1,13 @@ + + +# QuadrilateralInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ReadOnlyFirst.md b/samples/client/petstore/java/okhttp-jackson3/docs/ReadOnlyFirst.md new file mode 100644 index 000000000000..ad6af7ee155f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ReadOnlyFirst.md @@ -0,0 +1,14 @@ + + +# ReadOnlyFirst + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**baz** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/RequiredNullableBody.md b/samples/client/petstore/java/okhttp-jackson3/docs/RequiredNullableBody.md new file mode 100644 index 000000000000..b732ff05be76 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/RequiredNullableBody.md @@ -0,0 +1,34 @@ + + +# RequiredNullableBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integerProp** | **Integer** | | | +|**numberProp** | **BigDecimal** | | | +|**booleanProp** | **Boolean** | | | +|**stringProp** | **String** | | | +|**dateProp** | **LocalDate** | | | +|**datetimeProp** | **OffsetDateTime** | | | +|**arrayNullableProp** | **List<Object>** | | | +|**arrayAndItemsNullableProp** | **List<Object>** | | | +|**arrayItemsNullable** | **List<Object>** | | | +|**objectNullableProp** | **Map<String, Object>** | | | +|**objectAndItemsNullableProp** | **Map<String, Object>** | | | +|**objectItemsNullable** | **Map<String, Object>** | | | +|**customRefEnum** | **NullableEnum** | | | +|**customEnum** | [**CustomEnumEnum**](#CustomEnumEnum) | | | + + + +## Enum: CustomEnumEnum + +| Name | Value | +|---- | -----| +| CUSTOM | "custom" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Scalar.md b/samples/client/petstore/java/okhttp-jackson3/docs/Scalar.md new file mode 100644 index 000000000000..45dbf799e91f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Scalar.md @@ -0,0 +1,13 @@ + + +# Scalar + +Values of scalar type + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ScalarAnyOf.md b/samples/client/petstore/java/okhttp-jackson3/docs/ScalarAnyOf.md new file mode 100644 index 000000000000..767e9196023d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ScalarAnyOf.md @@ -0,0 +1,13 @@ + + +# ScalarAnyOf + +Values of scalar type using anyOf + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ScaleneTriangle.md b/samples/client/petstore/java/okhttp-jackson3/docs/ScaleneTriangle.md new file mode 100644 index 000000000000..c578f6cbfaab --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ScaleneTriangle.md @@ -0,0 +1,14 @@ + + +# ScaleneTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Shape.md b/samples/client/petstore/java/okhttp-jackson3/docs/Shape.md new file mode 100644 index 000000000000..51549d7b67f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Shape.md @@ -0,0 +1,15 @@ + + +# Shape + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ShapeInterface.md b/samples/client/petstore/java/okhttp-jackson3/docs/ShapeInterface.md new file mode 100644 index 000000000000..b4f981e3b566 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ShapeInterface.md @@ -0,0 +1,13 @@ + + +# ShapeInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ShapeOrNull.md b/samples/client/petstore/java/okhttp-jackson3/docs/ShapeOrNull.md new file mode 100644 index 000000000000..c4ae8f1b6720 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ShapeOrNull.md @@ -0,0 +1,16 @@ + + +# ShapeOrNull + +The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/SimpleQuadrilateral.md b/samples/client/petstore/java/okhttp-jackson3/docs/SimpleQuadrilateral.md new file mode 100644 index 000000000000..52fb7d1a6a49 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/SimpleQuadrilateral.md @@ -0,0 +1,14 @@ + + +# SimpleQuadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/SpecialModelName.md b/samples/client/petstore/java/okhttp-jackson3/docs/SpecialModelName.md new file mode 100644 index 000000000000..e17d0d797b7f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/SpecialModelName.md @@ -0,0 +1,14 @@ + + +# SpecialModelName + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**$specialPropertyName** | **Long** | | [optional] | +|**specialModelName** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/StoreApi.md b/samples/client/petstore/java/okhttp-jackson3/docs/StoreApi.md new file mode 100644 index 000000000000..719f9df42478 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/StoreApi.md @@ -0,0 +1,266 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + 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 + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + + + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Tag.md b/samples/client/petstore/java/okhttp-jackson3/docs/Tag.md new file mode 100644 index 000000000000..5088b2dd1c31 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Tag.md @@ -0,0 +1,14 @@ + + +# Tag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/client/petstore/java/okhttp-jackson3/docs/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..dc066e6c7dac --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,13 @@ + + +# TestInlineFreeformAdditionalPropertiesRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someProperty** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Triangle.md b/samples/client/petstore/java/okhttp-jackson3/docs/Triangle.md new file mode 100644 index 000000000000..71de2174f744 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Triangle.md @@ -0,0 +1,14 @@ + + +# Triangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/TriangleInterface.md b/samples/client/petstore/java/okhttp-jackson3/docs/TriangleInterface.md new file mode 100644 index 000000000000..ef5fc7575f34 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/TriangleInterface.md @@ -0,0 +1,13 @@ + + +# TriangleInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/User.md b/samples/client/petstore/java/okhttp-jackson3/docs/User.md new file mode 100644 index 000000000000..9e97dc35485f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/User.md @@ -0,0 +1,24 @@ + + +# User + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | +|**objectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] | +|**objectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] | +|**anyTypeProp** | **Object** | 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 | [optional] | +|**anyTypePropNullable** | **Object** | 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. | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/UserApi.md b/samples/client/petstore/java/okhttp-jackson3/docs/UserApi.md new file mode 100644 index 000000000000..2c5974674074 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/UserApi.md @@ -0,0 +1,511 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | + + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### 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 | - | + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + 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 + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Value.md b/samples/client/petstore/java/okhttp-jackson3/docs/Value.md new file mode 100644 index 000000000000..54c8fc245e72 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Value.md @@ -0,0 +1,12 @@ + + +# Value + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/ValuesApi.md b/samples/client/petstore/java/okhttp-jackson3/docs/ValuesApi.md new file mode 100644 index 000000000000..4210bff03ec9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/ValuesApi.md @@ -0,0 +1,68 @@ +# ValuesApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getSomeValues**](ValuesApi.md#getSomeValues) | **GET** /values | Get some primitive variable values | + + + +# **getSomeValues** +> Variable getSomeValues() + +Get some primitive variable values + + + +### 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.ValuesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + ValuesApi apiInstance = new ValuesApi(defaultClient); + try { + Variable result = apiInstance.getSomeValues(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ValuesApi#getSomeValues"); + 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 + +[**Variable**](Variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Value | - | + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Variable.md b/samples/client/petstore/java/okhttp-jackson3/docs/Variable.md new file mode 100644 index 000000000000..d179fb1775cf --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Variable.md @@ -0,0 +1,15 @@ + + +# Variable + +Value object + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | | +|**value** | [**Value**](Value.md) | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Whale.md b/samples/client/petstore/java/okhttp-jackson3/docs/Whale.md new file mode 100644 index 000000000000..30ce4bb82151 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Whale.md @@ -0,0 +1,15 @@ + + +# Whale + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasBaleen** | **Boolean** | | [optional] | +|**hasTeeth** | **Boolean** | | [optional] | +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/docs/Zebra.md b/samples/client/petstore/java/okhttp-jackson3/docs/Zebra.md new file mode 100644 index 000000000000..f7c4389b6456 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/docs/Zebra.md @@ -0,0 +1,24 @@ + + +# Zebra + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | +|**className** | **String** | | | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| PLAINS | "plains" | +| MOUNTAIN | "mountain" | +| GREVYS | "grevys" | + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/git_push.sh b/samples/client/petstore/java/okhttp-jackson3/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp-jackson3/gradle.properties b/samples/client/petstore/java/okhttp-jackson3/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-jackson3/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-jackson3/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-jackson3/gradlew.bat b/samples/client/petstore/java/okhttp-jackson3/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp-jackson3/pom.xml b/samples/client/petstore/java/okhttp-jackson3/pom.xml new file mode 100644 index 000000000000..afb69871e4ea --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/pom.xml @@ -0,0 +1,302 @@ + + 4.0.0 + org.openapitools + petstore-okhttp-jackson3 + jar + petstore-okhttp-jackson3 + 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-compiler-plugin + 3.8.1 + + 17 + 17 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + tools.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-annotations-version} + + + tools.jackson.core + jackson-databind + ${jackson-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + org.apache.commons + commons-lang3 + ${commons-lang3-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 3.2.1 + 2.21 + 3.18.0 + 0.2.10 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp-jackson3/settings.gradle b/samples/client/petstore/java/okhttp-jackson3/settings.gradle new file mode 100644 index 000000000000..b10070c5dc7d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-okhttp-jackson3" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-jackson3/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..e9ab7a8d7a60 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiCallback.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; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..86f742d40253 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1801 @@ +/* + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://petstore.swagger.io:80/v2"; + 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" + ) + ) + )); + }} + ), + new ServerConfiguration( + "https://127.0.0.1/no_variable", + "The local server without variables", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = ""; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io:80/v2) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 access token for the first Bearer authentication. + * @param bearerToken Bearer token + */ + public void setBearerToken(String bearerToken) { + setBearerToken(() -> bearerToken); + } + + /** + * Helper method to set the supplier of access tokens for Bearer authentication. + * + * @param tokenSupplier The supplier of bearer tokens + */ + public void setBearerToken(Supplier tokenSupplier) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(tokenSupplier); + return; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..0c0f52846910 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..fb13945bd775 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..79955372fb33 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..4f90d6f971a5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,344 @@ +/* + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.JacksonException; +import com.fasterxml.jackson.annotation.*; +import tools.jackson.databind.*; +import tools.jackson.databind.json.JsonMapper; +import tools.jackson.databind.cfg.DateTimeFeature; +import tools.jackson.databind.cfg.EnumFeature; +import org.openapitools.jackson.nullable.JsonNullableJackson3Module; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static ObjectMapper mapper; + + public JSON() { + if (mapper == null) { + JsonMapper.Builder jsonMapperBuilder = JsonMapper.builder() + .changeDefaultPropertyInclusion(v -> v.withValueInclusion(JsonInclude.Include.NON_NULL)) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE) + .disable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(EnumFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(EnumFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()); + jsonMapperBuilder.addModule(new JsonNullableJackson3Module()); + mapper = jsonMapperBuilder.build(); + } + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + * @return the target model class. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asString(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + * @return the target model class. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + * @param visitedClasses The set of classes that have already been visited. + * @return true if inst is an instance of modelClass in the OpenAPI model hierarchy. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map> descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (Class childType : descendants.values()) { + if (isInstanceOf(childType, inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map>> modelDescendants = new HashMap<>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map> descendants) { + modelDescendants.put(modelClass, descendants); + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return mapper; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.mapper = (ObjectMapper) serializer; + } + + + public static ObjectMapper getMapper() { + return mapper; + } + + public static void setMapper(ObjectMapper mapper) { + JSON.mapper = mapper; + } + + public static void setDateFormat(DateFormat dateFormat) { + mapper = ((JsonMapper) mapper).rebuild().defaultDateFormat(dateFormat).build(); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + // TODO: implement for Jackson + } + + public static void setLenientOnJson(boolean lenientOnJson) { + // TODO: implement for Jackson + } + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + // TODO: implement for Jackson + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + // TODO: implement for Jackson + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + try { + return mapper.writeValueAsString(obj); + } catch (JacksonException e) { + throw new RuntimeException(e); + } + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + JavaType type = mapper.getTypeFactory().constructType(returnType); + return mapper.readValue(body, type); + } catch (JacksonException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw new RuntimeException(e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + JavaType type = mapper.getTypeFactory().constructType(returnType); + return mapper.readValue(inputStream, type); + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..505e6f786f4c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..924dd8668973 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..eee56669a4a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339DateFormat.java new file mode 100644 index 000000000000..5ca15b8b1b9c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.text.DecimalFormat; +import java.util.GregorianCalendar; +import java.util.TimeZone; +import tools.jackson.databind.util.StdDateFormat; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); + } + + @Override + public Date parse(String source) { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return super.clone(); + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java new file mode 100644 index 000000000000..65590aa32eda --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java @@ -0,0 +1,100 @@ +/* + * 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.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAccessor; +import java.util.function.BiFunction; +import java.util.function.Function; + +import tools.jackson.core.JacksonException; +import tools.jackson.core.JsonParser; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.cfg.DateTimeFeature; +import tools.jackson.databind.ext.javatime.deser.InstantDeserializer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class RFC3339InstantDeserializer extends InstantDeserializer { + private static final long serialVersionUID = 1L; + private final static boolean DEFAULT_NORMALIZE_ZONE_ID = DateTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); + private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + = DateTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault(); + + public static final RFC3339InstantDeserializer INSTANT = new RFC3339InstantDeserializer<>( + Instant.class, DateTimeFormatter.ISO_INSTANT, + Instant::from, + a -> Instant.ofEpochMilli( a.value ), + a -> Instant.ofEpochSecond( a.integer, a.fraction ), + null, + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer OFFSET_DATE_TIME = new RFC3339InstantDeserializer<>( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + OffsetDateTime::from, + a -> OffsetDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> OffsetDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + (d, z) -> ( d.isEqual( OffsetDateTime.MIN ) || d.isEqual( OffsetDateTime.MAX ) ? + d : + d.withOffsetSameInstant( z.getRules().getOffset( d.toLocalDateTime() ) ) ), + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer ZONED_DATE_TIME = new RFC3339InstantDeserializer<>( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + ZonedDateTime::from, + a -> ZonedDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> ZonedDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + ZonedDateTime::withZoneSameInstant, + false, // keep zero offset and Z separate since zones explicitly supported + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + protected RFC3339InstantDeserializer( + Class supportedType, + DateTimeFormatter formatter, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust, + boolean replaceZeroOffsetAsZ, + boolean normalizeZoneId, + boolean readNumericStringsAsTimestamp) { + super( + supportedType, + formatter, + parsedToValue, + fromMilliseconds, + fromNanoseconds, + adjust, + replaceZeroOffsetAsZ, + normalizeZoneId, + readNumericStringsAsTimestamp + ); + } + + @Override + protected T _fromString(JsonParser p, DeserializationContext ctxt, String string0) throws JacksonException { + return super._fromString(p, ctxt, string0.replace( ' ', 'T' )); + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java new file mode 100644 index 000000000000..13cf27ee8bc0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.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; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; + +import tools.jackson.databind.module.SimpleModule; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class RFC3339JavaTimeModule extends SimpleModule { + private static final long serialVersionUID = 1L; + + public RFC3339JavaTimeModule() { + super("RFC3339JavaTimeModule"); + addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT); + addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME); + addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME); + } + + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..1787a231e76b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..bc81f54d83a6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..6473166843d5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/AnotherFakeApi.java new file mode 100644 index 000000000000..9417b4a5a5b0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -0,0 +1,458 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import tools.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AnotherFakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AnotherFakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public AnotherFakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for call123testSpecialTags + * @param client client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = client; + + // create path and map variables + String localVarPath = "/another-fake/dummy"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call call123testSpecialTagsValidateBeforeCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException("Missing the required parameter 'client' when calling call123testSpecialTags(Async)"); + } + + return call123testSpecialTagsCall(client, _callback); + + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client call123testSpecialTags(@javax.annotation.Nonnull Client client) throws ApiException { + ApiResponse localVarResp = call123testSpecialTagsWithHttpInfo(client); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(client, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test special tags (asynchronously) + * To test special tags and operation ID starting with number + * @param client client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsAsync(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(client, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getParameterArrayNumber + * @param array array integer (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterArrayNumberCall(@javax.annotation.Nonnull List array, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/parameter-array-number"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (array != null) { + localVarHeaderParams.put("array", localVarApiClient.parameterToString(array)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getParameterArrayNumberValidateBeforeCall(@javax.annotation.Nonnull List array, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'array' is set + if (array == null) { + throw new ApiException("Missing the required parameter 'array' when calling getParameterArrayNumber(Async)"); + } + + return getParameterArrayNumberCall(array, _callback); + + } + + /** + * parameter array number default value + * + * @param array array integer (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getParameterArrayNumber(@javax.annotation.Nonnull List array) throws ApiException { + getParameterArrayNumberWithHttpInfo(array); + } + + /** + * parameter array number default value + * + * @param array array integer (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getParameterArrayNumberWithHttpInfo(@javax.annotation.Nonnull List array) throws ApiException { + okhttp3.Call localVarCall = getParameterArrayNumberValidateBeforeCall(array, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * parameter array number default value (asynchronously) + * + * @param array array integer (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterArrayNumberAsync(@javax.annotation.Nonnull List array, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getParameterArrayNumberValidateBeforeCall(array, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getParameterStringNumber + * @param stringNumber string number (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterStringNumberCall(@javax.annotation.Nonnull BigDecimal stringNumber, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/parameter-string-number"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (stringNumber != null) { + localVarHeaderParams.put("string_number", localVarApiClient.parameterToString(stringNumber)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getParameterStringNumberValidateBeforeCall(@javax.annotation.Nonnull BigDecimal stringNumber, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'stringNumber' is set + if (stringNumber == null) { + throw new ApiException("Missing the required parameter 'stringNumber' when calling getParameterStringNumber(Async)"); + } + + return getParameterStringNumberCall(stringNumber, _callback); + + } + + /** + * parameter string number + * + * @param stringNumber string number (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getParameterStringNumber(@javax.annotation.Nonnull BigDecimal stringNumber) throws ApiException { + getParameterStringNumberWithHttpInfo(stringNumber); + } + + /** + * parameter string number + * + * @param stringNumber string number (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getParameterStringNumberWithHttpInfo(@javax.annotation.Nonnull BigDecimal stringNumber) throws ApiException { + okhttp3.Call localVarCall = getParameterStringNumberValidateBeforeCall(stringNumber, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * parameter string number (asynchronously) + * + * @param stringNumber string number (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterStringNumberAsync(@javax.annotation.Nonnull BigDecimal stringNumber, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getParameterStringNumberValidateBeforeCall(stringNumber, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..2fff27db7e4c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,563 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import tools.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import org.openapitools.client.model.FakeAnyOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FakeOneOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FooGetDefaultResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DefaultApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for fakeAnyOfWIthSameErasureGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeAnyOfWIthSameErasureGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/anyOfWIthSameErasure"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeAnyOfWIthSameErasureGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeAnyOfWIthSameErasureGetCall(_callback); + + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return FakeAnyOfWIthSameErasureGet200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public FakeAnyOfWIthSameErasureGet200Response fakeAnyOfWIthSameErasureGet() throws ApiException { + ApiResponse localVarResp = fakeAnyOfWIthSameErasureGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return ApiResponse<FakeAnyOfWIthSameErasureGet200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public ApiResponse fakeAnyOfWIthSameErasureGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeAnyOfWIthSameErasureGetValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test route, this shouldn't cause a compiler error + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeAnyOfWIthSameErasureGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeAnyOfWIthSameErasureGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeFreeFormQueryParametersGet + * @param fixed (optional) + * @param freeForm (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call fakeFreeFormQueryParametersGetCall(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/free-form-query-parameters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (fixed != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fixed", fixed)); + } + + if (freeForm != null) { + localVarQueryParams.addAll(localVarApiClient.freeFormParameterToPairs(freeForm)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeFreeFormQueryParametersGetValidateBeforeCall(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm, final ApiCallback _callback) throws ApiException { + return fakeFreeFormQueryParametersGetCall(fixed, freeForm, _callback); + + } + + /** + * + * + * @param fixed (optional) + * @param freeForm (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void fakeFreeFormQueryParametersGet(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm) throws ApiException { + fakeFreeFormQueryParametersGetWithHttpInfo(fixed, freeForm); + } + + /** + * + * + * @param fixed (optional) + * @param freeForm (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse fakeFreeFormQueryParametersGetWithHttpInfo(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm) throws ApiException { + okhttp3.Call localVarCall = fakeFreeFormQueryParametersGetValidateBeforeCall(fixed, freeForm, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param fixed (optional) + * @param freeForm (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call fakeFreeFormQueryParametersGetAsync(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeFreeFormQueryParametersGetValidateBeforeCall(fixed, freeForm, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for fakeOneOfWIthSameErasureGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeOneOfWIthSameErasureGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/oneOfWIthSameErasure"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOneOfWIthSameErasureGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeOneOfWIthSameErasureGetCall(_callback); + + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return FakeOneOfWIthSameErasureGet200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public FakeOneOfWIthSameErasureGet200Response fakeOneOfWIthSameErasureGet() throws ApiException { + ApiResponse localVarResp = fakeOneOfWIthSameErasureGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return ApiResponse<FakeOneOfWIthSameErasureGet200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public ApiResponse fakeOneOfWIthSameErasureGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeOneOfWIthSameErasureGetValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test route, this shouldn't cause a compiler error + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeOneOfWIthSameErasureGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOneOfWIthSameErasureGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fooGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public okhttp3.Call fooGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/foo"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fooGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fooGetCall(_callback); + + } + + /** + * + * + * @return FooGetDefaultResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public FooGetDefaultResponse fooGet() throws ApiException { + ApiResponse localVarResp = fooGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * + * @return ApiResponse<FooGetDefaultResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public ApiResponse fooGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fooGetValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public okhttp3.Call fooGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fooGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 000000000000..34743c514d2e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,3457 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import tools.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import org.openapitools.client.model.FakeRefParameterPetIdParameter; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.FreeFormObjectTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.NullableFieldsMapResponse; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.RequiredNullableBody; +import org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for fakeGetFreeFormObjectGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call fakeGetFreeFormObjectGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/get-free-form-object"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeGetFreeFormObjectGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeGetFreeFormObjectGetCall(_callback); + + } + + /** + * + * Get a free form object or Json string + * @return FreeFormObjectTestClass + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public FreeFormObjectTestClass fakeGetFreeFormObjectGet() throws ApiException { + ApiResponse localVarResp = fakeGetFreeFormObjectGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * Get a free form object or Json string + * @return ApiResponse<FreeFormObjectTestClass> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse fakeGetFreeFormObjectGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeGetFreeFormObjectGetValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get a free form object or Json string + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call fakeGetFreeFormObjectGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeGetFreeFormObjectGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterBooleanSerialize + * @param body Input boolean as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeCall(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterBooleanSerializeValidateBeforeCall(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + return fakeOuterBooleanSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public Boolean fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body) throws ApiException { + ApiResponse localVarResp = fakeOuterBooleanSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return ApiResponse<Boolean> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(@javax.annotation.Nullable Boolean body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterBooleanSerializeValidateBeforeCall(body, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeAsync(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterBooleanSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterCompositeSerialize + * @param outerComposite Input composite as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeCall(@javax.annotation.Nullable OuterComposite outerComposite, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = outerComposite; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterCompositeSerializeValidateBeforeCall(@javax.annotation.Nullable OuterComposite outerComposite, final ApiCallback _callback) throws ApiException { + return fakeOuterCompositeSerializeCall(outerComposite, _callback); + + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public OuterComposite fakeOuterCompositeSerialize(@javax.annotation.Nullable OuterComposite outerComposite) throws ApiException { + ApiResponse localVarResp = fakeOuterCompositeSerializeWithHttpInfo(outerComposite); + return localVarResp.getData(); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return ApiResponse<OuterComposite> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(@javax.annotation.Nullable OuterComposite outerComposite) throws ApiException { + okhttp3.Call localVarCall = fakeOuterCompositeSerializeValidateBeforeCall(outerComposite, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeAsync(@javax.annotation.Nullable OuterComposite outerComposite, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterCompositeSerializeValidateBeforeCall(outerComposite, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterNumberSerialize + * @param body Input number as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeCall(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterNumberSerializeValidateBeforeCall(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + return fakeOuterNumberSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public BigDecimal fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal body) throws ApiException { + ApiResponse localVarResp = fakeOuterNumberSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return ApiResponse<BigDecimal> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public ApiResponse fakeOuterNumberSerializeWithHttpInfo(@javax.annotation.Nullable BigDecimal body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterNumberSerializeValidateBeforeCall(body, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeAsync(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterNumberSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterStringSerialize + * @param body Input string as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeCall(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterStringSerializeValidateBeforeCall(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + return fakeOuterStringSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public String fakeOuterStringSerialize(@javax.annotation.Nullable String body) throws ApiException { + ApiResponse localVarResp = fakeOuterStringSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public ApiResponse fakeOuterStringSerializeWithHttpInfo(@javax.annotation.Nullable String body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterStringSerializeValidateBeforeCall(body, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeAsync(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterStringSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeRefParameter + * @param petId to test oneOf in parameter $ref (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeRefParameterCall(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/pet/{petId}/reference/parameter" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeRefParameterValidateBeforeCall(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling fakeRefParameter(Async)"); + } + + return fakeRefParameterCall(petId, _callback); + + } + + /** + * fake reference parameter + * + * @param petId to test oneOf in parameter $ref (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void fakeRefParameter(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId) throws ApiException { + fakeRefParameterWithHttpInfo(petId); + } + + /** + * fake reference parameter + * + * @param petId to test oneOf in parameter $ref (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse fakeRefParameterWithHttpInfo(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId) throws ApiException { + okhttp3.Call localVarCall = fakeRefParameterValidateBeforeCall(petId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * fake reference parameter (asynchronously) + * + * @param petId to test oneOf in parameter $ref (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeRefParameterAsync(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeRefParameterValidateBeforeCall(petId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for fakeRequiredNullableBodyGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public okhttp3.Call fakeRequiredNullableBodyGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/required-nullable-body"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeRequiredNullableBodyGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeRequiredNullableBodyGetCall(_callback); + + } + + /** + * fields in the response body, required and nullable are both true + * + * @return RequiredNullableBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public RequiredNullableBody fakeRequiredNullableBodyGet() throws ApiException { + ApiResponse localVarResp = fakeRequiredNullableBodyGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * fields in the response body, required and nullable are both true + * + * @return ApiResponse<RequiredNullableBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public ApiResponse fakeRequiredNullableBodyGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeRequiredNullableBodyGetValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * fields in the response body, required and nullable are both true (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public okhttp3.Call fakeRequiredNullableBodyGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeRequiredNullableBodyGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeUploadRefRequestBodies + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeUploadRefRequestBodiesCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeUploadRefRequestBodiesValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling fakeUploadRefRequestBodies(Async)"); + } + + return fakeUploadRefRequestBodiesCall(petId, additionalMetadata, _file, _callback); + + } + + /** + * fake reference parameter + * + * @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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse fakeUploadRefRequestBodies(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = fakeUploadRefRequestBodiesWithHttpInfo(petId, additionalMetadata, _file); + return localVarResp.getData(); + } + + /** + * fake reference parameter + * + * @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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse fakeUploadRefRequestBodiesWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = fakeUploadRefRequestBodiesValidateBeforeCall(petId, additionalMetadata, _file, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * fake reference parameter (asynchronously) + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeUploadRefRequestBodiesAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeUploadRefRequestBodiesValidateBeforeCall(petId, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getFakeArrayofenums + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public okhttp3.Call getFakeArrayofenumsCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/array-of-enums"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFakeArrayofenumsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getFakeArrayofenumsCall(_callback); + + } + + /** + * Array of Enums + * + * @return List<OuterEnum> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public List getFakeArrayofenums() throws ApiException { + ApiResponse> localVarResp = getFakeArrayofenumsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Array of Enums + * + * @return ApiResponse<List<OuterEnum>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public ApiResponse> getFakeArrayofenumsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getFakeArrayofenumsValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference>(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Array of Enums (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public okhttp3.Call getFakeArrayofenumsAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getFakeArrayofenumsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getFakeHealth + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public okhttp3.Call getFakeHealthCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/health"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFakeHealthValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getFakeHealthCall(_callback); + + } + + /** + * Health check endpoint + * + * @return HealthCheckResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public HealthCheckResult getFakeHealth() throws ApiException { + ApiResponse localVarResp = getFakeHealthWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Health check endpoint + * + * @return ApiResponse<HealthCheckResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public ApiResponse getFakeHealthWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getFakeHealthValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Health check endpoint (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public okhttp3.Call getFakeHealthAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getFakeHealthValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getParameterNameMapping + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterNameMappingCall(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/parameter-name-mapping"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (type != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("type", type)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (underscoreType != null) { + localVarHeaderParams.put("_type", localVarApiClient.parameterToString(underscoreType)); + } + + + if (typeWithUnderscore != null) { + localVarHeaderParams.put("type_", localVarApiClient.parameterToString(typeWithUnderscore)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getParameterNameMappingValidateBeforeCall(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'underscoreType' is set + if (underscoreType == null) { + throw new ApiException("Missing the required parameter 'underscoreType' when calling getParameterNameMapping(Async)"); + } + + // verify the required parameter 'type' is set + if (type == null) { + throw new ApiException("Missing the required parameter 'type' when calling getParameterNameMapping(Async)"); + } + + // verify the required parameter 'typeWithUnderscore' is set + if (typeWithUnderscore == null) { + throw new ApiException("Missing the required parameter 'typeWithUnderscore' when calling getParameterNameMapping(Async)"); + } + + return getParameterNameMappingCall(underscoreType, type, typeWithUnderscore, _callback); + + } + + /** + * parameter name mapping test + * + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getParameterNameMapping(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore) throws ApiException { + getParameterNameMappingWithHttpInfo(underscoreType, type, typeWithUnderscore); + } + + /** + * parameter name mapping test + * + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getParameterNameMappingWithHttpInfo(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore) throws ApiException { + okhttp3.Call localVarCall = getParameterNameMappingValidateBeforeCall(underscoreType, type, typeWithUnderscore, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * parameter name mapping test (asynchronously) + * + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterNameMappingAsync(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getParameterNameMappingValidateBeforeCall(underscoreType, type, typeWithUnderscore, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testAdditionalPropertiesReference + * @param requestBody request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testAdditionalPropertiesReferenceCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/fake/additionalProperties-reference"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testAdditionalPropertiesReferenceValidateBeforeCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference(Async)"); + } + + return testAdditionalPropertiesReferenceCall(requestBody, _callback); + + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testAdditionalPropertiesReference(@javax.annotation.Nonnull Map requestBody) throws ApiException { + testAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { + okhttp3.Call localVarCall = testAdditionalPropertiesReferenceValidateBeforeCall(requestBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test referenced additionalProperties (asynchronously) + * + * @param requestBody request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testAdditionalPropertiesReferenceAsync(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testAdditionalPropertiesReferenceValidateBeforeCall(requestBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testBodyWithFileSchema + * @param fileSchemaTestClass (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaCall(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = fileSchemaTestClass; + + // create path and map variables + String localVarPath = "/fake/body-with-file-schema"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithFileSchemaValidateBeforeCall(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) { + throw new ApiException("Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema(Async)"); + } + + return testBodyWithFileSchemaCall(fileSchemaTestClass, _callback); + + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithFileSchema(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithFileSchemaWithHttpInfo(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { + okhttp3.Call localVarCall = testBodyWithFileSchemaValidateBeforeCall(fileSchemaTestClass, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaAsync(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyWithFileSchemaValidateBeforeCall(fileSchemaTestClass, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testBodyWithQueryParams + * @param query (required) + * @param user (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsCall(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (query != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithQueryParamsValidateBeforeCall(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException("Missing the required parameter 'query' when calling testBodyWithQueryParams(Async)"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling testBodyWithQueryParams(Async)"); + } + + return testBodyWithQueryParamsCall(query, user, _callback); + + } + + /** + * + * + * @param query (required) + * @param user (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithQueryParams(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(query, user); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = testBodyWithQueryParamsValidateBeforeCall(query, user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param query (required) + * @param user (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsAsync(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyWithQueryParamsValidateBeforeCall(query, user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testClientModel + * @param client client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = client; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClientModelValidateBeforeCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException("Missing the required parameter 'client' when calling testClientModel(Async)"); + } + + return testClientModelCall(client, _callback); + + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClientModel(@javax.annotation.Nonnull Client client) throws ApiException { + ApiResponse localVarResp = testClientModelWithHttpInfo(client); + return localVarResp.getData(); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return ApiResponse<Client> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClientModelWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { + okhttp3.Call localVarCall = testClientModelValidateBeforeCall(client, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test \"client\" model (asynchronously) + * To test \"client\" model + * @param client client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelAsync(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testClientModelValidateBeforeCall(client, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testEndpointParameters + * @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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersCall(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "http_basic_test" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEndpointParametersValidateBeforeCall(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException("Missing the required parameter 'number' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException("Missing the required parameter '_double' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) { + throw new ApiException("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException("Missing the required parameter '_byte' when calling testEndpointParameters(Async)"); + } + + return testEndpointParametersCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, _callback); + + } + + /** + * 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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable 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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse testEndpointParametersWithHttpInfo(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { + okhttp3.Call localVarCall = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 (asynchronously) + * 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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersAsync(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testEnumParameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersCall(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (enumFormStringArray != null) { + localVarFormParams.put("enum_form_string_array", enumFormStringArray); + } + + if (enumFormString != null) { + localVarFormParams.put("enum_form_string", enumFormString); + } + + if (enumQueryStringArray != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "enum_query_string_array", enumQueryStringArray)); + } + + if (enumQueryString != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_string", enumQueryString)); + } + + if (enumQueryInteger != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_integer", enumQueryInteger)); + } + + if (enumQueryDouble != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_double", enumQueryDouble)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (enumHeaderStringArray != null) { + localVarHeaderParams.put("enum_header_string_array", localVarApiClient.parameterToString(enumHeaderStringArray)); + } + + + if (enumHeaderString != null) { + localVarHeaderParams.put("enum_header_string", localVarApiClient.parameterToString(enumHeaderString)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEnumParametersValidateBeforeCall(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + return testEnumParametersCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, _callback); + + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public void testEnumParameters(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable 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) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public ApiResponse testEnumParametersWithHttpInfo(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString) throws ApiException { + okhttp3.Call localVarCall = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * To test enum parameters (asynchronously) + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersAsync(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + private okhttp3.Call testGroupParametersCall(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (requiredStringGroup != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("required_string_group", requiredStringGroup)); + } + + if (requiredInt64Group != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("required_int64_group", requiredInt64Group)); + } + + if (stringGroup != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("string_group", stringGroup)); + } + + if (int64Group != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("int64_group", int64Group)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (requiredBooleanGroup != null) { + localVarHeaderParams.put("required_boolean_group", localVarApiClient.parameterToString(requiredBooleanGroup)); + } + + + if (booleanGroup != null) { + localVarHeaderParams.put("boolean_group", localVarApiClient.parameterToString(booleanGroup)); + } + + + String[] localVarAuthNames = new String[] { "bearer_test" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testGroupParametersValidateBeforeCall(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requiredStringGroup' is set + if (requiredStringGroup == null) { + throw new ApiException("Missing the required parameter 'requiredStringGroup' when calling testGroupParameters(Async)"); + } + + // verify the required parameter 'requiredBooleanGroup' is set + if (requiredBooleanGroup == null) { + throw new ApiException("Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters(Async)"); + } + + // verify the required parameter 'requiredInt64Group' is set + if (requiredInt64Group == null) { + throw new ApiException("Missing the required parameter 'requiredInt64Group' when calling testGroupParameters(Async)"); + } + + return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + + } + + + private ApiResponse testGroupParametersWithHttpInfo(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { + okhttp3.Call localVarCall = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call testGroupParametersAsync(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APItestGroupParametersRequest { + @javax.annotation.Nonnull + private final Integer requiredStringGroup; + @javax.annotation.Nonnull + private final Boolean requiredBooleanGroup; + @javax.annotation.Nonnull + private final Long requiredInt64Group; + @javax.annotation.Nullable + private Integer stringGroup; + @javax.annotation.Nullable + private Boolean booleanGroup; + @javax.annotation.Nullable + private Long int64Group; + + private APItestGroupParametersRequest(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group) { + this.requiredStringGroup = requiredStringGroup; + this.requiredBooleanGroup = requiredBooleanGroup; + this.requiredInt64Group = requiredInt64Group; + } + + /** + * Set stringGroup + * @param stringGroup String in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest stringGroup(@javax.annotation.Nullable Integer stringGroup) { + this.stringGroup = stringGroup; + return this; + } + + /** + * Set booleanGroup + * @param booleanGroup Boolean in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest booleanGroup(@javax.annotation.Nullable Boolean booleanGroup) { + this.booleanGroup = booleanGroup; + return this; + } + + /** + * Set int64Group + * @param int64Group Integer in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest int64Group(@javax.annotation.Nullable Long int64Group) { + this.int64Group = int64Group; + return this; + } + + /** + * Build call for testGroupParameters + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + } + + /** + * Execute testGroupParameters request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public void execute() throws ApiException { + testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /** + * Execute testGroupParameters request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /** + * Execute testGroupParameters request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return testGroupParametersAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + } + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @return APItestGroupParametersRequest + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public APItestGroupParametersRequest testGroupParameters(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group) { + return new APItestGroupParametersRequest(requiredStringGroup, requiredBooleanGroup, requiredInt64Group); + } + /** + * Build call for testInlineAdditionalProperties + * @param requestBody request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineAdditionalPropertiesCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/fake/inline-additionalProperties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testInlineAdditionalPropertiesValidateBeforeCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties(Async)"); + } + + return testInlineAdditionalPropertiesCall(requestBody, _callback); + + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testInlineAdditionalProperties(@javax.annotation.Nonnull Map requestBody) throws ApiException { + testInlineAdditionalPropertiesWithHttpInfo(requestBody); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { + okhttp3.Call localVarCall = testInlineAdditionalPropertiesValidateBeforeCall(requestBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test inline additionalProperties (asynchronously) + * + * @param requestBody request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineAdditionalPropertiesAsync(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testInlineAdditionalPropertiesValidateBeforeCall(requestBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testInlineFreeformAdditionalProperties + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineFreeformAdditionalPropertiesCall(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = testInlineFreeformAdditionalPropertiesRequest; + + // create path and map variables + String localVarPath = "/fake/inline-freeform-additionalProperties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testInlineFreeformAdditionalPropertiesValidateBeforeCall(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set + if (testInlineFreeformAdditionalPropertiesRequest == null) { + throw new ApiException("Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties(Async)"); + } + + return testInlineFreeformAdditionalPropertiesCall(testInlineFreeformAdditionalPropertiesRequest, _callback); + + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testInlineFreeformAdditionalProperties(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { + testInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest); + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testInlineFreeformAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { + okhttp3.Call localVarCall = testInlineFreeformAdditionalPropertiesValidateBeforeCall(testInlineFreeformAdditionalPropertiesRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test inline free-form additionalProperties (asynchronously) + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineFreeformAdditionalPropertiesAsync(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testInlineFreeformAdditionalPropertiesValidateBeforeCall(testInlineFreeformAdditionalPropertiesRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testJsonFormData + * @param param field1 (required) + * @param param2 field2 (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testJsonFormDataCall(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/jsonFormData"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testJsonFormDataValidateBeforeCall(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'param' is set + if (param == null) { + throw new ApiException("Missing the required parameter 'param' when calling testJsonFormData(Async)"); + } + + // verify the required parameter 'param2' is set + if (param2 == null) { + throw new ApiException("Missing the required parameter 'param2' when calling testJsonFormData(Async)"); + } + + return testJsonFormDataCall(param, param2, _callback); + + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testJsonFormData(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testJsonFormDataWithHttpInfo(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { + okhttp3.Call localVarCall = testJsonFormDataValidateBeforeCall(param, param2, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test json serialization of form data (asynchronously) + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testJsonFormDataAsync(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testJsonFormDataValidateBeforeCall(param, param2, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testNullableRequiredFieldsAnyOf + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testNullableRequiredFieldsAnyOfCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/nullable-required-fields-anyof"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testNullableRequiredFieldsAnyOfValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return testNullableRequiredFieldsAnyOfCall(_callback); + + } + + /** + * test anyOf with map of objects containing nullable required fields + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * @return NullableFieldsMapResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public NullableFieldsMapResponse testNullableRequiredFieldsAnyOf() throws ApiException { + ApiResponse localVarResp = testNullableRequiredFieldsAnyOfWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * test anyOf with map of objects containing nullable required fields + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * @return ApiResponse<NullableFieldsMapResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testNullableRequiredFieldsAnyOfWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = testNullableRequiredFieldsAnyOfValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * test anyOf with map of objects containing nullable required fields (asynchronously) + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testNullableRequiredFieldsAnyOfAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testNullableRequiredFieldsAnyOfValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryParameterCollectionFormat + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testQueryParameterCollectionFormatCall(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/test-query-parameters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pipe != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "pipe", pipe)); + } + + if (ioutil != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "ioutil", ioutil)); + } + + if (http != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("ssv", "http", http)); + } + + if (url != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "url", url)); + } + + if (context != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "context", context)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryParameterCollectionFormatValidateBeforeCall(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pipe' is set + if (pipe == null) { + throw new ApiException("Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) { + throw new ApiException("Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'http' is set + if (http == null) { + throw new ApiException("Missing the required parameter 'http' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'url' is set + if (url == null) { + throw new ApiException("Missing the required parameter 'url' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'context' is set + if (context == null) { + throw new ApiException("Missing the required parameter 'context' when calling testQueryParameterCollectionFormat(Async)"); + } + + return testQueryParameterCollectionFormatCall(pipe, ioutil, http, url, context, _callback); + + } + + /** + * + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testQueryParameterCollectionFormat(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testQueryParameterCollectionFormatAsync(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testStringMapReference + * @param requestBody request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testStringMapReferenceCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/fake/stringMap-reference"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testStringMapReferenceValidateBeforeCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling testStringMapReference(Async)"); + } + + return testStringMapReferenceCall(requestBody, _callback); + + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testStringMapReference(@javax.annotation.Nonnull Map requestBody) throws ApiException { + testStringMapReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testStringMapReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { + okhttp3.Call localVarCall = testStringMapReferenceValidateBeforeCall(requestBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test referenced string map (asynchronously) + * + * @param requestBody request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testStringMapReferenceAsync(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testStringMapReferenceValidateBeforeCall(requestBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java new file mode 100644 index 000000000000..cdab39072fe0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,205 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import tools.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import org.openapitools.client.model.Client; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeClassnameTags123Api { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for testClassname + * @param client client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = client; + + // create path and map variables + String localVarPath = "/fake_classname_test"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key_query" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClassnameValidateBeforeCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException("Missing the required parameter 'client' when calling testClassname(Async)"); + } + + return testClassnameCall(client, _callback); + + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClassname(@javax.annotation.Nonnull Client client) throws ApiException { + ApiResponse localVarResp = testClassnameWithHttpInfo(client); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClassnameWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { + okhttp3.Call localVarCall = testClassnameValidateBeforeCall(client, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test class name in snake case (asynchronously) + * To test class name in snake case + * @param client client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameAsync(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testClassnameValidateBeforeCall(client, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..0aac3435cf8f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1329 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import tools.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PetApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addPet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call addPetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addPetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling addPet(Async)"); + } + + return addPetCall(pet, _callback); + + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void addPet(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Add a new pet to the store (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call addPetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deletePet + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePetValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); + } + + return deletePetCall(petId, apiKey, _callback); + + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deletes a pet (asynchronously) + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for findPetsByStatus + * @param status Status values that need to be considered for filter (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "status", status)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByStatusValidateBeforeCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + + return findPetsByStatusCall(status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + ApiResponse> localVarResp = findPetsByStatusWithHttpInfo(status); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null); + + Type localVarReturnType = new TypeReference>(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by status (asynchronously) + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusAsync(@javax.annotation.Nonnull List status, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback); + Type localVarReturnType = new TypeReference>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for findPetsByTags + * @param tags Tags to filter by (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByTagsValidateBeforeCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); + } + + return findPetsByTagsCall(tags, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { + ApiResponse> localVarResp = findPetsByTagsWithHttpInfo(tags); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null); + + Type localVarReturnType = new TypeReference>(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by tags (asynchronously) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsAsync(@javax.annotation.Nonnull List tags, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback); + Type localVarReturnType = new TypeReference>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPetById + * @param petId ID of pet to return (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + return getPetByIdCall(petId, _callback); + + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + ApiResponse localVarResp = getPetByIdWithHttpInfo(petId); + return localVarResp.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find pet by ID (asynchronously) + * Returns a single pet + * @param petId ID of pet to return (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdAsync(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling updatePet(Async)"); + } + + return updatePetCall(pet, _callback); + + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public void updatePet(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update an existing pet (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updatePetWithForm + * @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) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetWithFormValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); + } + + return updatePetWithFormCall(petId, name, status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updates a pet in the store with form data (asynchronously) + * + * @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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for uploadFile + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (contentType != null) { + localVarHeaderParams.put("Content-Type", localVarApiClient.parameterToString(contentType)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); + } + + return uploadFileCall(petId, contentType, additionalMetadata, _file, _callback); + + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = uploadFileWithHttpInfo(petId, contentType, additionalMetadata, _file); + return localVarResp.getData(); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, contentType, additionalMetadata, _file, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (asynchronously) + * + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, contentType, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for uploadFileWithRequiredFile + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileWithRequiredFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFileWithRequiredFile(Async)"); + } + + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) { + throw new ApiException("Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile(Async)"); + } + + return uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + ApiResponse localVarResp = uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (required) (asynchronously) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..d97876da1505 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,593 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import tools.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import org.openapitools.client.model.Order; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class StoreApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteOrder + * @param orderId ID of the order that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replace("{" + "order_id" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOrderValidateBeforeCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); + } + + return deleteOrderCall(orderId, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete purchase order by ID (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderAsync(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getInventory + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getInventoryCall(_callback); + + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Map getInventory() throws ApiException { + ApiResponse> localVarResp = getInventoryWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference>(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Returns pet inventories by status (asynchronously) + * Returns a map of status codes to quantities + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderById + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replace("{" + "order_id" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderByIdValidateBeforeCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); + } + + return getOrderByIdCall(orderId, _callback); + + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + ApiResponse localVarResp = getOrderByIdWithHttpInfo(orderId); + return localVarResp.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find purchase order by ID (asynchronously) + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdAsync(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for placeOrder + * @param order order placed for purchasing the pet (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = order; + + // create path and map variables + String localVarPath = "/store/order"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException("Missing the required parameter 'order' when calling placeOrder(Async)"); + } + + return placeOrderCall(order, _callback); + + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { + ApiResponse localVarResp = placeOrderWithHttpInfo(order); + return localVarResp.getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Place an order for a pet (asynchronously) + * + * @param order order placed for purchasing the pet (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderAsync(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..7ed3333ab470 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,1105 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import tools.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UserApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createUser + * @param user Created user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUserValidateBeforeCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUser(Async)"); + } + + return createUserCall(user, _callback); + + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create user (asynchronously) + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserAsync(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithArrayInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithArrayInput(Async)"); + } + + return createUsersWithArrayInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithListInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithList"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithListInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithListInput(Async)"); + } + + return createUsersWithListInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteUser + * @param username The name that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteUserValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); + } + + return deleteUserCall(username, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete user (asynchronously) + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getUserByName + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByNameValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); + } + + return getUserByNameCall(username, _callback); + + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + ApiResponse localVarResp = getUserByNameWithHttpInfo(username); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get user by user name (asynchronously) + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for loginUser + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
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 okhttp3.Call loginUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (username != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); + } + + if (password != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("password", password)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call loginUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); + } + + return loginUserCall(username, password, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + ApiResponse localVarResp = loginUserWithHttpInfo(username, password); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Logs user into the system (asynchronously) + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
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 okhttp3.Call loginUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for logoutUser + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return logoutUserCall(_callback); + + } + + /** + * Logs out current logged in user session + * + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Logs out current logged in user session (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateUser + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling updateUser(Async)"); + } + + return updateUserCall(username, user, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updated user (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/ValuesApi.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/ValuesApi.java new file mode 100644 index 000000000000..31fd02485eec --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/api/ValuesApi.java @@ -0,0 +1,199 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import tools.jackson.core.type.TypeReference; + +import java.io.IOException; + + +import org.openapitools.client.model.Variable; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ValuesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ValuesApi() { + this(Configuration.getDefaultApiClient()); + } + + public ValuesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getSomeValues + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public okhttp3.Call getSomeValuesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/values"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSomeValuesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getSomeValuesCall(_callback); + + } + + /** + * Get some primitive variable values + * + * @return Variable + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public Variable getSomeValues() throws ApiException { + ApiResponse localVarResp = getSomeValuesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get some primitive variable values + * + * @return ApiResponse<Variable> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public ApiResponse getSomeValuesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getSomeValuesValidateBeforeCall(null); + + Type localVarReturnType = new TypeReference(){}.getType(); + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get some primitive variable values (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public okhttp3.Call getSomeValuesAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSomeValuesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeReference(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..ed5f5fbc16ef --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..bd5e463d0b42 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..f655936f3a78 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..5aff174aff81 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..6f945f45ed46 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,43 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..59009502c11e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * 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; + +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..cefbf4af907b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * 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 okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..5521ee31599c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * 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.ApiException; +import org.openapitools.client.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..1ec47bee4310 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,144 @@ +/* + * 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 com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..4b9fa640514a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,434 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.HashMap; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("AdditionalPropertiesClass") +public class AdditionalPropertiesClass { + public static final String JSON_PROPERTY_MAP_PROPERTY = "map_property"; + @JsonProperty(JSON_PROPERTY_MAP_PROPERTY) + @javax.annotation.Nullable + private Map mapProperty = new HashMap<>(); + + public static final String JSON_PROPERTY_MAP_OF_MAP_PROPERTY = "map_of_map_property"; + @JsonProperty(JSON_PROPERTY_MAP_OF_MAP_PROPERTY) + @javax.annotation.Nullable + private Map> mapOfMapProperty = new HashMap<>(); + + public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1"; + @JsonProperty(JSON_PROPERTY_ANYTYPE1) + @javax.annotation.Nullable + private Object anytype1 = null; + + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1 = "map_with_undeclared_properties_anytype_1"; + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1) + @javax.annotation.Nullable + private Object mapWithUndeclaredPropertiesAnytype1; + + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2 = "map_with_undeclared_properties_anytype_2"; + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2) + @javax.annotation.Nullable + private Object mapWithUndeclaredPropertiesAnytype2; + + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3 = "map_with_undeclared_properties_anytype_3"; + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3) + @javax.annotation.Nullable + private Map mapWithUndeclaredPropertiesAnytype3 = new HashMap<>(); + + public static final String JSON_PROPERTY_EMPTY_MAP = "empty_map"; + @JsonProperty(JSON_PROPERTY_EMPTY_MAP) + @javax.annotation.Nullable + private Object emptyMap; + + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING = "map_with_undeclared_properties_string"; + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING) + @javax.annotation.Nullable + private Map mapWithUndeclaredPropertiesString = new HashMap<>(); + + public AdditionalPropertiesClass() { + } + + public AdditionalPropertiesClass mapProperty(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapProperty() { + return mapProperty; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapProperty(@javax.annotation.Nullable Map mapProperty) { + this.mapProperty = mapProperty; + } + + + public AdditionalPropertiesClass mapOfMapProperty(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP_OF_MAP_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_OF_MAP_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapOfMapProperty(@javax.annotation.Nullable Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + public AdditionalPropertiesClass anytype1(@javax.annotation.Nullable Object anytype1) { + this.anytype1 = anytype1; + return this; + } + + /** + * Get anytype1 + * @return anytype1 + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ANYTYPE1, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getAnytype1() { + return anytype1; + } + + @JsonProperty(value = JSON_PROPERTY_ANYTYPE1, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAnytype1(@javax.annotation.Nullable Object anytype1) { + this.anytype1 = anytype1; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype1(@javax.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype1) { + this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; + return this; + } + + /** + * Get mapWithUndeclaredPropertiesAnytype1 + * @return mapWithUndeclaredPropertiesAnytype1 + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getMapWithUndeclaredPropertiesAnytype1() { + return mapWithUndeclaredPropertiesAnytype1; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapWithUndeclaredPropertiesAnytype1(@javax.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype1) { + this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype2(@javax.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype2) { + this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; + return this; + } + + /** + * Get mapWithUndeclaredPropertiesAnytype2 + * @return mapWithUndeclaredPropertiesAnytype2 + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getMapWithUndeclaredPropertiesAnytype2() { + return mapWithUndeclaredPropertiesAnytype2; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapWithUndeclaredPropertiesAnytype2(@javax.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype2) { + this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype3(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapWithUndeclaredPropertiesAnytype3() { + return mapWithUndeclaredPropertiesAnytype3; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public void setMapWithUndeclaredPropertiesAnytype3(@javax.annotation.Nullable Map mapWithUndeclaredPropertiesAnytype3) { + this.mapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; + } + + + public AdditionalPropertiesClass emptyMap(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_EMPTY_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getEmptyMap() { + return emptyMap; + } + + @JsonProperty(value = JSON_PROPERTY_EMPTY_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmptyMap(@javax.annotation.Nullable Object emptyMap) { + this.emptyMap = emptyMap; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesString(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapWithUndeclaredPropertiesString() { + return mapWithUndeclaredPropertiesString; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapWithUndeclaredPropertiesString(@javax.annotation.Nullable Map mapWithUndeclaredPropertiesString) { + this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesClass instance itself + */ + public AdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("map_property", "map_of_map_property", "anytype_1", "map_with_undeclared_properties_anytype_1", "map_with_undeclared_properties_anytype_2", "map_with_undeclared_properties_anytype_3", "empty_map", "map_with_undeclared_properties_string")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java new file mode 100644 index 000000000000..389e299d0a88 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java @@ -0,0 +1,263 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributes; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfModelArrayAnyOf + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AllOfModelArrayAnyOf.JSON_PROPERTY_ID, + AllOfModelArrayAnyOf.JSON_PROPERTY_NAME, + AllOfModelArrayAnyOf.JSON_PROPERTY_LINK_LIST_COLUMN1, + AllOfModelArrayAnyOf.JSON_PROPERTY_ATTRIBUTES +}) +@JsonTypeName("AllOfModelArrayAnyOf") +public class AllOfModelArrayAnyOf { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name = "default-name"; + + public static final String JSON_PROPERTY_LINK_LIST_COLUMN1 = "linkListColumn1"; + @JsonProperty(JSON_PROPERTY_LINK_LIST_COLUMN1) + @javax.annotation.Nullable + private AllOfModelArrayAnyOfAllOfLinkListColumn1 linkListColumn1; + + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @javax.annotation.Nullable + private AllOfModelArrayAnyOfAllOfAttributes attributes; + + public AllOfModelArrayAnyOf() { + } + + public AllOfModelArrayAnyOf id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public AllOfModelArrayAnyOf name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public AllOfModelArrayAnyOf linkListColumn1(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfLinkListColumn1 linkListColumn1) { + this.linkListColumn1 = linkListColumn1; + return this; + } + + /** + * Get linkListColumn1 + * @return linkListColumn1 + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_LINK_LIST_COLUMN1, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AllOfModelArrayAnyOfAllOfLinkListColumn1 getLinkListColumn1() { + return linkListColumn1; + } + + @JsonProperty(value = JSON_PROPERTY_LINK_LIST_COLUMN1, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLinkListColumn1(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfLinkListColumn1 linkListColumn1) { + this.linkListColumn1 = linkListColumn1; + } + + + public AllOfModelArrayAnyOf attributes(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ATTRIBUTES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AllOfModelArrayAnyOfAllOfAttributes getAttributes() { + return attributes; + } + + @JsonProperty(value = JSON_PROPERTY_ATTRIBUTES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAttributes(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributes attributes) { + this.attributes = attributes; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfModelArrayAnyOf instance itself + */ + public AllOfModelArrayAnyOf putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfModelArrayAnyOf {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" linkListColumn1: ").append(toIndentedString(linkListColumn1)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name", "linkListColumn1", "attributes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java new file mode 100644 index 000000000000..627ce13f13ce --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java @@ -0,0 +1,170 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributesC; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfModelArrayAnyOfAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AllOfModelArrayAnyOfAllOfAttributes.JSON_PROPERTY_C +}) +@JsonTypeName("AllOfModelArrayAnyOf_allOf_attributes") +public class AllOfModelArrayAnyOfAllOfAttributes { + public static final String JSON_PROPERTY_C = "C"; + @JsonProperty(JSON_PROPERTY_C) + @javax.annotation.Nullable + private AllOfModelArrayAnyOfAllOfAttributesC C; + + public AllOfModelArrayAnyOfAllOfAttributes() { + } + + public AllOfModelArrayAnyOfAllOfAttributes C(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributesC C) { + this.C = C; + return this; + } + + /** + * Get C + * @return C + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_C, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AllOfModelArrayAnyOfAllOfAttributesC getC() { + return C; + } + + @JsonProperty(value = JSON_PROPERTY_C, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setC(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributesC C) { + this.C = C; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfModelArrayAnyOfAllOfAttributes instance itself + */ + public AllOfModelArrayAnyOfAllOfAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfModelArrayAnyOfAllOfAttributes {\n"); + sb.append(" C: ").append(toIndentedString(C)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("C")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java new file mode 100644 index 000000000000..9b93c4df2c34 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java @@ -0,0 +1,258 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Order; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.Tag; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = AllOfModelArrayAnyOfAllOfAttributesC.AllOfModelArrayAnyOfAllOfAttributesCDeserializer.class) +@JsonSerialize(using = AllOfModelArrayAnyOfAllOfAttributesC.AllOfModelArrayAnyOfAllOfAttributesCSerializer.class) +public class AllOfModelArrayAnyOfAllOfAttributesC extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AllOfModelArrayAnyOfAllOfAttributesC.class.getName()); + + + public static class AllOfModelArrayAnyOfAllOfAttributesCSerializer extends StdSerializer { + public AllOfModelArrayAnyOfAllOfAttributesCSerializer(Class t) { + super(t); + } + + public AllOfModelArrayAnyOfAllOfAttributesCSerializer() { + this(null); + } + + @Override + public void serialize(AllOfModelArrayAnyOfAllOfAttributesC value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + public static class AllOfModelArrayAnyOfAllOfAttributesCDeserializer extends StdDeserializer { + public AllOfModelArrayAnyOfAllOfAttributesCDeserializer() { + this(AllOfModelArrayAnyOfAllOfAttributesC.class); + } + + public AllOfModelArrayAnyOfAllOfAttributesCDeserializer(Class vc) { + super(vc); + } + + @Override + public AllOfModelArrayAnyOfAllOfAttributesC deserialize(JsonParser jp, DeserializationContext ctxt) throws JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize Order + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Order.class.equals(Integer.class) || Order.class.equals(Long.class) || Order.class.equals(Float.class) || Order.class.equals(Double.class) || Order.class.equals(Boolean.class) || Order.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Order.class.equals(Integer.class) || Order.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Order.class.equals(Float.class) || Order.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Order.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Order.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Order.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Order'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Order'", e); + } + + // deserialize Pet + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Pet.class.equals(Integer.class) || Pet.class.equals(Long.class) || Pet.class.equals(Float.class) || Pet.class.equals(Double.class) || Pet.class.equals(Boolean.class) || Pet.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Pet.class.equals(Integer.class) || Pet.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Pet.class.equals(Float.class) || Pet.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Pet.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Pet.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Pet.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Pet'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Pet'", e); + } + + if (match == 1) { + AllOfModelArrayAnyOfAllOfAttributesC ret = new AllOfModelArrayAnyOfAllOfAttributesC(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for AllOfModelArrayAnyOfAllOfAttributesC: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public AllOfModelArrayAnyOfAllOfAttributesC getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "AllOfModelArrayAnyOfAllOfAttributesC cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public AllOfModelArrayAnyOfAllOfAttributesC() { + super("oneOf", Boolean.FALSE); + } + + public AllOfModelArrayAnyOfAllOfAttributesC(Order o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public AllOfModelArrayAnyOfAllOfAttributesC(Pet o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Order", Order.class); + schemas.put("Pet", Pet.class); + JSON.registerDescendants(AllOfModelArrayAnyOfAllOfAttributesC.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return AllOfModelArrayAnyOfAllOfAttributesC.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Order, Pet + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Order.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Pet.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Order, Pet"); + } + + /** + * Get the actual instance, which can be the following: + * Order, Pet + * + * @return The actual instance (Order, Pet) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Order`. If the actual instance is not `Order`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Order` + * @throws ClassCastException if the instance is not `Order` + */ + public Order getOrder() throws ClassCastException { + return (Order)super.getActualInstance(); + } + + /** + * Get the actual instance of `Pet`. If the actual instance is not `Pet`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Pet` + * @throws ClassCastException if the instance is not `Pet` + */ + public Pet getPet() throws ClassCastException { + return (Pet)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java new file mode 100644 index 000000000000..817d6ac39847 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java @@ -0,0 +1,181 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1Value; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AllOfModelArrayAnyOfAllOfLinkListColumn1.JSON_PROPERTY_VALUE +}) +@JsonTypeName("AllOfModelArrayAnyOf_allOf_linkListColumn1") +public class AllOfModelArrayAnyOfAllOfLinkListColumn1 { + public static final String JSON_PROPERTY_VALUE = "value"; + @JsonProperty(JSON_PROPERTY_VALUE) + @javax.annotation.Nonnull + private List value = new ArrayList<>(); + + public AllOfModelArrayAnyOfAllOfLinkListColumn1() { + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1 value(@javax.annotation.Nonnull List value) { + this.value = value; + return this; + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1 addValueItem(AllOfModelArrayAnyOfAllOfLinkListColumn1Value valueItem) { + if (this.value == null) { + this.value = new ArrayList<>(); + } + this.value.add(valueItem); + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getValue() { + return value; + } + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@javax.annotation.Nonnull List value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfModelArrayAnyOfAllOfLinkListColumn1 instance itself + */ + public AllOfModelArrayAnyOfAllOfLinkListColumn1 putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfModelArrayAnyOfAllOfLinkListColumn1 {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("value")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java new file mode 100644 index 000000000000..33860667f95d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java @@ -0,0 +1,218 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Tag; +import org.openapitools.client.model.User; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = AllOfModelArrayAnyOfAllOfLinkListColumn1Value.AllOfModelArrayAnyOfAllOfLinkListColumn1ValueDeserializer.class) +@JsonSerialize(using = AllOfModelArrayAnyOfAllOfLinkListColumn1Value.AllOfModelArrayAnyOfAllOfLinkListColumn1ValueSerializer.class) +public class AllOfModelArrayAnyOfAllOfLinkListColumn1Value extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AllOfModelArrayAnyOfAllOfLinkListColumn1Value.class.getName()); + + + public static class AllOfModelArrayAnyOfAllOfLinkListColumn1ValueSerializer extends StdSerializer { + public AllOfModelArrayAnyOfAllOfLinkListColumn1ValueSerializer(Class t) { + super(t); + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1ValueSerializer() { + this(null); + } + + @Override + public void serialize(AllOfModelArrayAnyOfAllOfLinkListColumn1Value value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + public static class AllOfModelArrayAnyOfAllOfLinkListColumn1ValueDeserializer extends StdDeserializer { + public AllOfModelArrayAnyOfAllOfLinkListColumn1ValueDeserializer() { + this(AllOfModelArrayAnyOfAllOfLinkListColumn1Value.class); + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1ValueDeserializer(Class vc) { + super(vc); + } + + @Override + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value deserialize(JsonParser jp, DeserializationContext ctxt) throws JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + // deserialize Tag + try { + deserialized = ctxt.readTreeAsValue(tree, Tag.class); + AllOfModelArrayAnyOfAllOfLinkListColumn1Value ret = new AllOfModelArrayAnyOfAllOfLinkListColumn1Value(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Tag'", e); + } + + // deserialize User + try { + deserialized = ctxt.readTreeAsValue(tree, User.class); + AllOfModelArrayAnyOfAllOfLinkListColumn1Value ret = new AllOfModelArrayAnyOfAllOfLinkListColumn1Value(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'User'", e); + } + + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for AllOfModelArrayAnyOfAllOfLinkListColumn1Value: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "AllOfModelArrayAnyOfAllOfLinkListColumn1Value cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value() { + super("anyOf", Boolean.FALSE); + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(Tag o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(User o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Tag", Tag.class); + schemas.put("User", User.class); + JSON.registerDescendants(AllOfModelArrayAnyOfAllOfLinkListColumn1Value.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return AllOfModelArrayAnyOfAllOfLinkListColumn1Value.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Tag, User + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Tag.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(User.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Tag, User"); + } + + /** + * Get the actual instance, which can be the following: + * Tag, User + * + * @return The actual instance (Tag, User) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Tag`. If the actual instance is not `Tag`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Tag` + * @throws ClassCastException if the instance is not `Tag` + */ + public Tag getTag() throws ClassCastException { + return (Tag)super.getActualInstance(); + } + + /** + * Get the actual instance of `User`. If the actual instance is not `User`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `User` + * @throws ClassCastException if the instance is not `User` + */ + public User getUser() throws ClassCastException { + return (User)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java new file mode 100644 index 000000000000..71b842fbb9bb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -0,0 +1,168 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to double + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AllOfRefToDouble.JSON_PROPERTY_HEIGHT +}) +@JsonTypeName("AllOfRefToDouble") +public class AllOfRefToDouble { + public static final String JSON_PROPERTY_HEIGHT = "height"; + @JsonProperty(JSON_PROPERTY_HEIGHT) + @javax.annotation.Nullable + private Double height = 32.1d; + + public AllOfRefToDouble() { + } + + public AllOfRefToDouble height(@javax.annotation.Nullable Double height) { + this.height = height; + return this; + } + + /** + * Height as double + * @return height + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_HEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Double getHeight() { + return height; + } + + @JsonProperty(value = JSON_PROPERTY_HEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHeight(@javax.annotation.Nullable Double height) { + this.height = height; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToDouble instance itself + */ + public AllOfRefToDouble putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToDouble {\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("height")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java new file mode 100644 index 000000000000..e0a0402f07f3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -0,0 +1,168 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to float + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AllOfRefToFloat.JSON_PROPERTY_WEIGHT +}) +@JsonTypeName("AllOfRefToFloat") +public class AllOfRefToFloat { + public static final String JSON_PROPERTY_WEIGHT = "weight"; + @JsonProperty(JSON_PROPERTY_WEIGHT) + @javax.annotation.Nullable + private Float weight = 7.89f; + + public AllOfRefToFloat() { + } + + public AllOfRefToFloat weight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + return this; + } + + /** + * Weight as float + * @return weight + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_WEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Float getWeight() { + return weight; + } + + @JsonProperty(value = JSON_PROPERTY_WEIGHT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWeight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToFloat instance itself + */ + public AllOfRefToFloat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToFloat {\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("weight")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java new file mode 100644 index 000000000000..4c7c0ee614c3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -0,0 +1,168 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to long + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AllOfRefToLong.JSON_PROPERTY_ID +}) +@JsonTypeName("AllOfRefToLong") +public class AllOfRefToLong { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id = 10l; + + public AllOfRefToLong() { + } + + public AllOfRefToLong id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Id as long + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToLong instance itself + */ + public AllOfRefToLong putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToLong {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 000000000000..bc96655498ce --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Animal.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Animal + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the className to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = Dog.class, name = "Dog"), +}) + +@JsonPropertyOrder({ + Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_COLOR +}) +@JsonTypeName("Animal") +public class Animal { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @javax.annotation.Nonnull + protected String className; + + public static final String JSON_PROPERTY_COLOR = "color"; + @JsonProperty(JSON_PROPERTY_COLOR) + @javax.annotation.Nullable + private String color = "red"; + + public Animal() { + this.className = this.getClass().getSimpleName(); + } + + public Animal className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + + public Animal color(@javax.annotation.Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getColor() { + return color; + } + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setColor(@javax.annotation.Nullable String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Animal instance itself + */ + public Animal putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Apple.java new file mode 100644 index 000000000000..63a133309e83 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Apple.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Apple + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Apple.JSON_PROPERTY_CULTIVAR, + Apple.JSON_PROPERTY_ORIGIN +}) +@JsonTypeName("apple") +public class Apple { + public static final String JSON_PROPERTY_CULTIVAR = "cultivar"; + @JsonProperty(JSON_PROPERTY_CULTIVAR) + @javax.annotation.Nullable + private String cultivar; + + public static final String JSON_PROPERTY_ORIGIN = "origin"; + @JsonProperty(JSON_PROPERTY_ORIGIN) + @javax.annotation.Nullable + private String origin; + + public Apple() { + } + + public Apple cultivar(@javax.annotation.Nullable String cultivar) { + this.cultivar = cultivar; + return this; + } + + /** + * Get cultivar + * @return cultivar + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CULTIVAR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCultivar() { + return cultivar; + } + + @JsonProperty(value = JSON_PROPERTY_CULTIVAR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCultivar(@javax.annotation.Nullable String cultivar) { + this.cultivar = cultivar; + } + + + public Apple origin(@javax.annotation.Nullable String origin) { + this.origin = origin; + return this; + } + + /** + * Get origin + * @return origin + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ORIGIN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getOrigin() { + return origin; + } + + @JsonProperty(value = JSON_PROPERTY_ORIGIN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOrigin(@javax.annotation.Nullable String origin) { + this.origin = origin; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Apple instance itself + */ + public Apple putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("cultivar", "origin")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AppleReq.java new file mode 100644 index 000000000000..a4f68e5be9fe --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AppleReq.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AppleReq + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + AppleReq.JSON_PROPERTY_CULTIVAR, + AppleReq.JSON_PROPERTY_MEALY +}) +@JsonTypeName("appleReq") +public class AppleReq { + public static final String JSON_PROPERTY_CULTIVAR = "cultivar"; + @JsonProperty(JSON_PROPERTY_CULTIVAR) + @javax.annotation.Nonnull + private String cultivar; + + public static final String JSON_PROPERTY_MEALY = "mealy"; + @JsonProperty(JSON_PROPERTY_MEALY) + @javax.annotation.Nullable + private Boolean mealy; + + public AppleReq() { + } + + public AppleReq cultivar(@javax.annotation.Nonnull String cultivar) { + this.cultivar = cultivar; + return this; + } + + /** + * Get cultivar + * @return cultivar + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CULTIVAR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getCultivar() { + return cultivar; + } + + @JsonProperty(value = JSON_PROPERTY_CULTIVAR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCultivar(@javax.annotation.Nonnull String cultivar) { + this.cultivar = cultivar; + } + + + public AppleReq mealy(@javax.annotation.Nullable Boolean mealy) { + this.mealy = mealy; + return this; + } + + /** + * Get mealy + * @return mealy + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MEALY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMealy() { + return mealy; + } + + @JsonProperty(value = JSON_PROPERTY_MEALY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMealy(@javax.annotation.Nullable Boolean mealy) { + this.mealy = mealy; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AppleReq instance itself + */ + public AppleReq putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("cultivar", "mealy")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("cultivar")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayAnyOf.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayAnyOf.java new file mode 100644 index 000000000000..d7e5187554de --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayAnyOf.java @@ -0,0 +1,208 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = ArrayAnyOf.ArrayAnyOfDeserializer.class) +@JsonSerialize(using = ArrayAnyOf.ArrayAnyOfSerializer.class) +public class ArrayAnyOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ArrayAnyOf.class.getName()); + + + public static class ArrayAnyOfSerializer extends StdSerializer { + public ArrayAnyOfSerializer(Class t) { + super(t); + } + + public ArrayAnyOfSerializer() { + this(null); + } + + @Override + public void serialize(ArrayAnyOf value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + public static class ArrayAnyOfDeserializer extends StdDeserializer { + public ArrayAnyOfDeserializer() { + this(ArrayAnyOf.class); + } + + public ArrayAnyOfDeserializer(Class vc) { + super(vc); + } + + @Override + public ArrayAnyOf deserialize(JsonParser jp, DeserializationContext ctxt) throws JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + // deserialize Integer + try { + deserialized = ctxt.readTreeAsValue(tree, Integer.class); + ArrayAnyOf ret = new ArrayAnyOf(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + // deserialize List + try { + deserialized = ctxt.readTreeAsValue(tree, List.class); + ArrayAnyOf ret = new ArrayAnyOf(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for ArrayAnyOf: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public ArrayAnyOf getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "ArrayAnyOf cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public ArrayAnyOf() { + super("anyOf", Boolean.FALSE); + } + + public ArrayAnyOf(Integer o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ArrayAnyOf(List o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("List", List.class); + JSON.registerDescendants(ArrayAnyOf.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return ArrayAnyOf.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Integer, List + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, List"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, List + * + * @return The actual instance (Integer, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayDefault.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayDefault.java new file mode 100644 index 000000000000..cfcaebff5241 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayDefault.java @@ -0,0 +1,218 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayDefault + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ArrayDefault.JSON_PROPERTY_WITH_DEFAULT_EMPTY_BRACKET, + ArrayDefault.JSON_PROPERTY_WITHOUT_DEFAULT +}) +@JsonTypeName("ArrayDefault") +public class ArrayDefault { + public static final String JSON_PROPERTY_WITH_DEFAULT_EMPTY_BRACKET = "WithDefaultEmptyBracket"; + @JsonProperty(JSON_PROPERTY_WITH_DEFAULT_EMPTY_BRACKET) + @javax.annotation.Nullable + private List withDefaultEmptyBracket = new ArrayList<>(); + + public static final String JSON_PROPERTY_WITHOUT_DEFAULT = "WithoutDefault"; + @JsonProperty(JSON_PROPERTY_WITHOUT_DEFAULT) + @javax.annotation.Nullable + private List withoutDefault = new ArrayList<>(); + + public ArrayDefault() { + } + + public ArrayDefault withDefaultEmptyBracket(@javax.annotation.Nullable List withDefaultEmptyBracket) { + this.withDefaultEmptyBracket = withDefaultEmptyBracket; + return this; + } + + public ArrayDefault addWithDefaultEmptyBracketItem(String withDefaultEmptyBracketItem) { + if (this.withDefaultEmptyBracket == null) { + this.withDefaultEmptyBracket = new ArrayList<>(); + } + this.withDefaultEmptyBracket.add(withDefaultEmptyBracketItem); + return this; + } + + /** + * Get withDefaultEmptyBracket + * @return withDefaultEmptyBracket + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_WITH_DEFAULT_EMPTY_BRACKET, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getWithDefaultEmptyBracket() { + return withDefaultEmptyBracket; + } + + @JsonProperty(value = JSON_PROPERTY_WITH_DEFAULT_EMPTY_BRACKET, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWithDefaultEmptyBracket(@javax.annotation.Nullable List withDefaultEmptyBracket) { + this.withDefaultEmptyBracket = withDefaultEmptyBracket; + } + + + public ArrayDefault withoutDefault(@javax.annotation.Nullable List withoutDefault) { + this.withoutDefault = withoutDefault; + return this; + } + + public ArrayDefault addWithoutDefaultItem(String withoutDefaultItem) { + if (this.withoutDefault == null) { + this.withoutDefault = new ArrayList<>(); + } + this.withoutDefault.add(withoutDefaultItem); + return this; + } + + /** + * Get withoutDefault + * @return withoutDefault + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_WITHOUT_DEFAULT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getWithoutDefault() { + return withoutDefault; + } + + @JsonProperty(value = JSON_PROPERTY_WITHOUT_DEFAULT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setWithoutDefault(@javax.annotation.Nullable List withoutDefault) { + this.withoutDefault = withoutDefault; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayDefault instance itself + */ + public ArrayDefault putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayDefault {\n"); + sb.append(" withDefaultEmptyBracket: ").append(toIndentedString(withDefaultEmptyBracket)).append("\n"); + sb.append(" withoutDefault: ").append(toIndentedString(withoutDefault)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("WithDefaultEmptyBracket", "WithoutDefault")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..7e21cafd3073 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,180 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfArrayOfNumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER +}) +@JsonTypeName("ArrayOfArrayOfNumberOnly") +public class ArrayOfArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) + @javax.annotation.Nullable + private List> arrayArrayNumber = new ArrayList<>(); + + public ArrayOfArrayOfNumberOnly() { + } + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayArrayNumber(@javax.annotation.Nullable List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfArrayOfNumberOnly instance itself + */ + public ArrayOfArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ArrayArrayNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java new file mode 100644 index 000000000000..84dca923f39a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java @@ -0,0 +1,242 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ArrayOfInlineAllOfArrayAllofDogPropertyInner; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfInlineAllOf + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ArrayOfInlineAllOf.JSON_PROPERTY_ID, + ArrayOfInlineAllOf.JSON_PROPERTY_NAME, + ArrayOfInlineAllOf.JSON_PROPERTY_ARRAY_ALLOF_DOG_PROPERTY +}) +@JsonTypeName("ArrayOfInlineAllOf") +public class ArrayOfInlineAllOf { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_ARRAY_ALLOF_DOG_PROPERTY = "array_allof_dog_property"; + @JsonProperty(JSON_PROPERTY_ARRAY_ALLOF_DOG_PROPERTY) + @javax.annotation.Nullable + private List arrayAllofDogProperty = new ArrayList<>(); + + public ArrayOfInlineAllOf() { + } + + public ArrayOfInlineAllOf id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public ArrayOfInlineAllOf name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public ArrayOfInlineAllOf arrayAllofDogProperty(@javax.annotation.Nullable List arrayAllofDogProperty) { + this.arrayAllofDogProperty = arrayAllofDogProperty; + return this; + } + + public ArrayOfInlineAllOf addArrayAllofDogPropertyItem(ArrayOfInlineAllOfArrayAllofDogPropertyInner arrayAllofDogPropertyItem) { + if (this.arrayAllofDogProperty == null) { + this.arrayAllofDogProperty = new ArrayList<>(); + } + this.arrayAllofDogProperty.add(arrayAllofDogPropertyItem); + return this; + } + + /** + * Get arrayAllofDogProperty + * @return arrayAllofDogProperty + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ARRAY_ALLOF_DOG_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayAllofDogProperty() { + return arrayAllofDogProperty; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ALLOF_DOG_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayAllofDogProperty(@javax.annotation.Nullable List arrayAllofDogProperty) { + this.arrayAllofDogProperty = arrayAllofDogProperty; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfInlineAllOf instance itself + */ + public ArrayOfInlineAllOf putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfInlineAllOf {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" arrayAllofDogProperty: ").append(toIndentedString(arrayAllofDogProperty)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name", "array_allof_dog_property")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java new file mode 100644 index 000000000000..8b28de960822 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ArrayOfInlineAllOfArrayAllofDogPropertyInner.JSON_PROPERTY_BREED, + ArrayOfInlineAllOfArrayAllofDogPropertyInner.JSON_PROPERTY_COLOR +}) +@JsonTypeName("ArrayOfInlineAllOf_array_allof_dog_property_inner") +public class ArrayOfInlineAllOfArrayAllofDogPropertyInner { + public static final String JSON_PROPERTY_BREED = "breed"; + @JsonProperty(JSON_PROPERTY_BREED) + @javax.annotation.Nullable + private String breed; + + public static final String JSON_PROPERTY_COLOR = "color"; + @JsonProperty(JSON_PROPERTY_COLOR) + @javax.annotation.Nullable + private String color; + + public ArrayOfInlineAllOfArrayAllofDogPropertyInner() { + } + + public ArrayOfInlineAllOfArrayAllofDogPropertyInner breed(@javax.annotation.Nullable String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BREED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBreed() { + return breed; + } + + @JsonProperty(value = JSON_PROPERTY_BREED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBreed(@javax.annotation.Nullable String breed) { + this.breed = breed; + } + + + public ArrayOfInlineAllOfArrayAllofDogPropertyInner color(@javax.annotation.Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getColor() { + return color; + } + + @JsonProperty(value = JSON_PROPERTY_COLOR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setColor(@javax.annotation.Nullable String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfInlineAllOfArrayAllofDogPropertyInner instance itself + */ + public ArrayOfInlineAllOfArrayAllofDogPropertyInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfInlineAllOfArrayAllofDogPropertyInner {\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("breed", "color")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..c7ce704f955c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -0,0 +1,180 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfNumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER +}) +@JsonTypeName("ArrayOfNumberOnly") +public class ArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber"; + @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) + @javax.annotation.Nullable + private List arrayNumber = new ArrayList<>(); + + public ArrayOfNumberOnly() { + } + + public ArrayOfNumberOnly arrayNumber(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayNumber() { + return arrayNumber; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayNumber(@javax.annotation.Nullable List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfNumberOnly instance itself + */ + public ArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ArrayNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOneOf.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOneOf.java new file mode 100644 index 000000000000..ebe804dd72cd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOneOf.java @@ -0,0 +1,246 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = ArrayOneOf.ArrayOneOfDeserializer.class) +@JsonSerialize(using = ArrayOneOf.ArrayOneOfSerializer.class) +public class ArrayOneOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ArrayOneOf.class.getName()); + + + public static class ArrayOneOfSerializer extends StdSerializer { + public ArrayOneOfSerializer(Class t) { + super(t); + } + + public ArrayOneOfSerializer() { + this(null); + } + + @Override + public void serialize(ArrayOneOf value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + public static class ArrayOneOfDeserializer extends StdDeserializer { + public ArrayOneOfDeserializer() { + this(ArrayOneOf.class); + } + + public ArrayOneOfDeserializer(Class vc) { + super(vc); + } + + @Override + public ArrayOneOf deserialize(JsonParser jp, DeserializationContext ctxt) throws JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize Integer + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Integer.class.equals(Integer.class) || Integer.class.equals(Long.class) || Integer.class.equals(Float.class) || Integer.class.equals(Double.class) || Integer.class.equals(Boolean.class) || Integer.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Integer.class.equals(Integer.class) || Integer.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Integer.class.equals(Float.class) || Integer.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Integer.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Integer.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Integer.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Integer'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + // deserialize List + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (List.class.equals(Integer.class) || List.class.equals(Long.class) || List.class.equals(Float.class) || List.class.equals(Double.class) || List.class.equals(Boolean.class) || List.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((List.class.equals(Integer.class) || List.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((List.class.equals(Float.class) || List.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (List.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (List.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, List.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'List'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + if (match == 1) { + ArrayOneOf ret = new ArrayOneOf(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for ArrayOneOf: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public ArrayOneOf getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "ArrayOneOf cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public ArrayOneOf() { + super("oneOf", Boolean.FALSE); + } + + public ArrayOneOf(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ArrayOneOf(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("List", List.class); + JSON.registerDescendants(ArrayOneOf.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return ArrayOneOf.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Integer, List + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, List"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, List + * + * @return The actual instance (Integer, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayTest.java new file mode 100644 index 000000000000..c59c1bcdcb27 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -0,0 +1,258 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL +}) +@JsonTypeName("ArrayTest") +public class ArrayTest { + public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string"; + @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) + @javax.annotation.Nullable + private List arrayOfString = new ArrayList<>(); + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) + @javax.annotation.Nullable + private List> arrayArrayOfInteger = new ArrayList<>(); + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) + @javax.annotation.Nullable + private List> arrayArrayOfModel = new ArrayList<>(); + + public ArrayTest() { + } + + public ArrayTest arrayOfString(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_OF_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayOfString() { + return arrayOfString; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_OF_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayOfString(@javax.annotation.Nullable List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + + public ArrayTest arrayArrayOfInteger(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayArrayOfInteger(@javax.annotation.Nullable List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + + public ArrayTest arrayArrayOfModel(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayArrayOfModel(@javax.annotation.Nullable List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayTest instance itself + */ + public ArrayTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("array_of_string", "array_array_of_integer", "array_array_of_model")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Banana.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Banana.java new file mode 100644 index 000000000000..a8151d252dfe --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Banana.java @@ -0,0 +1,170 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Banana + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Banana.JSON_PROPERTY_LENGTH_CM +}) +@JsonTypeName("banana") +public class Banana { + public static final String JSON_PROPERTY_LENGTH_CM = "lengthCm"; + @JsonProperty(JSON_PROPERTY_LENGTH_CM) + @javax.annotation.Nullable + private BigDecimal lengthCm; + + public Banana() { + } + + public Banana lengthCm(@javax.annotation.Nullable BigDecimal lengthCm) { + this.lengthCm = lengthCm; + return this; + } + + /** + * Get lengthCm + * @return lengthCm + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_LENGTH_CM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getLengthCm() { + return lengthCm; + } + + @JsonProperty(value = JSON_PROPERTY_LENGTH_CM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLengthCm(@javax.annotation.Nullable BigDecimal lengthCm) { + this.lengthCm = lengthCm; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Banana instance itself + */ + public Banana putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Banana {\n"); + sb.append(" lengthCm: ").append(toIndentedString(lengthCm)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("lengthCm")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BananaReq.java new file mode 100644 index 000000000000..f1cc630ef0b0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BananaReq.java @@ -0,0 +1,201 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BananaReq + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + BananaReq.JSON_PROPERTY_LENGTH_CM, + BananaReq.JSON_PROPERTY_SWEET +}) +@JsonTypeName("bananaReq") +public class BananaReq { + public static final String JSON_PROPERTY_LENGTH_CM = "lengthCm"; + @JsonProperty(JSON_PROPERTY_LENGTH_CM) + @javax.annotation.Nonnull + private BigDecimal lengthCm; + + public static final String JSON_PROPERTY_SWEET = "sweet"; + @JsonProperty(JSON_PROPERTY_SWEET) + @javax.annotation.Nullable + private Boolean sweet; + + public BananaReq() { + } + + public BananaReq lengthCm(@javax.annotation.Nonnull BigDecimal lengthCm) { + this.lengthCm = lengthCm; + return this; + } + + /** + * Get lengthCm + * @return lengthCm + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_LENGTH_CM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getLengthCm() { + return lengthCm; + } + + @JsonProperty(value = JSON_PROPERTY_LENGTH_CM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setLengthCm(@javax.annotation.Nonnull BigDecimal lengthCm) { + this.lengthCm = lengthCm; + } + + + public BananaReq sweet(@javax.annotation.Nullable Boolean sweet) { + this.sweet = sweet; + return this; + } + + /** + * Get sweet + * @return sweet + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SWEET, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getSweet() { + return sweet; + } + + @JsonProperty(value = JSON_PROPERTY_SWEET, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSweet(@javax.annotation.Nullable Boolean sweet) { + this.sweet = sweet; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BananaReq instance itself + */ + public BananaReq putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("lengthCm", "sweet")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("lengthCm")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BasquePig.java new file mode 100644 index 000000000000..e05a52c5eb4c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BasquePig.java @@ -0,0 +1,168 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BasquePig + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + BasquePig.JSON_PROPERTY_CLASS_NAME +}) +@JsonTypeName("BasquePig") +public class BasquePig { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @javax.annotation.Nonnull + private String className; + + public BasquePig() { + } + + public BasquePig className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BasquePig instance itself + */ + public BasquePig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BasquePig {\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Capitalization.java new file mode 100644 index 000000000000..45a9d2335ed4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Capitalization.java @@ -0,0 +1,323 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Capitalization + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("Capitalization") +public class Capitalization { + public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel"; + @JsonProperty(JSON_PROPERTY_SMALL_CAMEL) + @javax.annotation.Nullable + private String smallCamel; + + public static final String JSON_PROPERTY_CAPITAL_CAMEL = "CapitalCamel"; + @JsonProperty(JSON_PROPERTY_CAPITAL_CAMEL) + @javax.annotation.Nullable + private String capitalCamel; + + public static final String JSON_PROPERTY_SMALL_SNAKE = "small_Snake"; + @JsonProperty(JSON_PROPERTY_SMALL_SNAKE) + @javax.annotation.Nullable + private String smallSnake; + + public static final String JSON_PROPERTY_CAPITAL_SNAKE = "Capital_Snake"; + @JsonProperty(JSON_PROPERTY_CAPITAL_SNAKE) + @javax.annotation.Nullable + private String capitalSnake; + + public static final String JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + @JsonProperty(JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS) + @javax.annotation.Nullable + private String scAETHFlowPoints; + + public static final String JSON_PROPERTY_A_T_T_N_A_M_E = "ATT_NAME"; + @JsonProperty(JSON_PROPERTY_A_T_T_N_A_M_E) + @javax.annotation.Nullable + private String ATT_NAME; + + public Capitalization() { + } + + public Capitalization smallCamel(@javax.annotation.Nullable String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SMALL_CAMEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSmallCamel() { + return smallCamel; + } + + @JsonProperty(value = JSON_PROPERTY_SMALL_CAMEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSmallCamel(@javax.annotation.Nullable String smallCamel) { + this.smallCamel = smallCamel; + } + + + public Capitalization capitalCamel(@javax.annotation.Nullable String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CAPITAL_CAMEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCapitalCamel() { + return capitalCamel; + } + + @JsonProperty(value = JSON_PROPERTY_CAPITAL_CAMEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCapitalCamel(@javax.annotation.Nullable String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + + public Capitalization smallSnake(@javax.annotation.Nullable String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SMALL_SNAKE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSmallSnake() { + return smallSnake; + } + + @JsonProperty(value = JSON_PROPERTY_SMALL_SNAKE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSmallSnake(@javax.annotation.Nullable String smallSnake) { + this.smallSnake = smallSnake; + } + + + public Capitalization capitalSnake(@javax.annotation.Nullable String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CAPITAL_SNAKE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCapitalSnake() { + return capitalSnake; + } + + @JsonProperty(value = JSON_PROPERTY_CAPITAL_SNAKE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCapitalSnake(@javax.annotation.Nullable String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + + public Capitalization scAETHFlowPoints(@javax.annotation.Nullable String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + @JsonProperty(value = JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setScAETHFlowPoints(@javax.annotation.Nullable String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + + public Capitalization ATT_NAME(@javax.annotation.Nullable String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_A_T_T_N_A_M_E, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getATTNAME() { + return ATT_NAME; + } + + @JsonProperty(value = JSON_PROPERTY_A_T_T_N_A_M_E, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setATTNAME(@javax.annotation.Nullable String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Capitalization instance itself + */ + public Capitalization putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 000000000000..980281ce2059 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,181 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Map; +import org.openapitools.client.model.Animal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Cat + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the className to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) + +@JsonPropertyOrder({ + Cat.JSON_PROPERTY_DECLAWED +}) +@JsonTypeName("Cat") +public class Cat extends Animal { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + @JsonProperty(JSON_PROPERTY_DECLAWED) + @javax.annotation.Nullable + private Boolean declawed; + + public Cat() { + this.className = this.getClass().getSimpleName(); + } + + public Cat declawed(@javax.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DECLAWED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDeclawed() { + return declawed; + } + + @JsonProperty(value = JSON_PROPERTY_DECLAWED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeclawed(@javax.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Cat instance itself + */ + public Cat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "declawed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..e443e5ccb839 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,199 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Category + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) +@JsonTypeName("Category") +public class Category { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name = "default-name"; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ClassModel.java new file mode 100644 index 000000000000..67fae0d33e96 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ClassModel.java @@ -0,0 +1,168 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model with \"_class\" property + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ClassModel.JSON_PROPERTY_PROPERTY_CLASS +}) +@JsonTypeName("ClassModel") +public class ClassModel { + public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class"; + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @javax.annotation.Nullable + private String propertyClass; + + public ClassModel() { + } + + public ClassModel propertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PROPERTY_CLASS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPropertyClass() { + return propertyClass; + } + + @JsonProperty(value = JSON_PROPERTY_PROPERTY_CLASS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ClassModel instance itself + */ + public ClassModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("_class")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Client.java new file mode 100644 index 000000000000..e22d35659fe9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Client.java @@ -0,0 +1,168 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Client.JSON_PROPERTY_CLIENT +}) +@JsonTypeName("Client") +public class Client { + public static final String JSON_PROPERTY_CLIENT = "client"; + @JsonProperty(JSON_PROPERTY_CLIENT) + @javax.annotation.Nullable + private String client; + + public Client() { + } + + public Client client(@javax.annotation.Nullable String client) { + this.client = client; + return this; + } + + /** + * Get client + * @return client + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CLIENT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getClient() { + return client; + } + + @JsonProperty(value = JSON_PROPERTY_CLIENT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setClient(@javax.annotation.Nullable String client) { + this.client = client; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Client instance itself + */ + public Client putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("client")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java new file mode 100644 index 000000000000..471b1f5dbb95 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -0,0 +1,199 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ComplexQuadrilateral + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ComplexQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, + ComplexQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE +}) +@JsonTypeName("ComplexQuadrilateral") +public class ComplexQuadrilateral { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType"; + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @javax.annotation.Nonnull + private String quadrilateralType; + + public ComplexQuadrilateral() { + } + + public ComplexQuadrilateral shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public ComplexQuadrilateral quadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setQuadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ComplexQuadrilateral instance itself + */ + public ComplexQuadrilateral putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DanishPig.java new file mode 100644 index 000000000000..7ae7106cdf6f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DanishPig.java @@ -0,0 +1,168 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DanishPig + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + DanishPig.JSON_PROPERTY_CLASS_NAME +}) +@JsonTypeName("DanishPig") +public class DanishPig { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @javax.annotation.Nonnull + private String className; + + public DanishPig() { + } + + public DanishPig className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DanishPig instance itself + */ + public DanishPig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DanishPig {\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DeprecatedObject.java new file mode 100644 index 000000000000..bf3474837eff --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -0,0 +1,170 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DeprecatedObject + * @deprecated + */ +@Deprecated +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + DeprecatedObject.JSON_PROPERTY_NAME +}) +@JsonTypeName("DeprecatedObject") +public class DeprecatedObject { + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nullable + private String name; + + public DeprecatedObject() { + } + + public DeprecatedObject name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DeprecatedObject instance itself + */ + public DeprecatedObject putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeprecatedObject {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 000000000000..5e210193afc5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,180 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Animal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Dog + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the className to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) + +@JsonPropertyOrder({ + Dog.JSON_PROPERTY_BREED +}) +@JsonTypeName("Dog") +public class Dog extends Animal { + public static final String JSON_PROPERTY_BREED = "breed"; + @JsonProperty(JSON_PROPERTY_BREED) + @javax.annotation.Nullable + private String breed; + + public Dog() { + this.className = this.getClass().getSimpleName(); + } + + public Dog breed(@javax.annotation.Nullable String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BREED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBreed() { + return breed; + } + + @JsonProperty(value = JSON_PROPERTY_BREED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBreed(@javax.annotation.Nullable String breed) { + this.breed = breed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Dog instance itself + */ + public Dog putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "breed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Drawing.java new file mode 100644 index 000000000000..0ebf6bda0c8a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Drawing.java @@ -0,0 +1,291 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Fruit; +import org.openapitools.client.model.NullableShape; +import org.openapitools.client.model.Shape; +import org.openapitools.client.model.ShapeOrNull; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Drawing + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Drawing.JSON_PROPERTY_MAIN_SHAPE, + Drawing.JSON_PROPERTY_SHAPE_OR_NULL, + Drawing.JSON_PROPERTY_NULLABLE_SHAPE, + Drawing.JSON_PROPERTY_SHAPES +}) +@JsonTypeName("Drawing") +public class Drawing { + public static final String JSON_PROPERTY_MAIN_SHAPE = "mainShape"; + @JsonProperty(JSON_PROPERTY_MAIN_SHAPE) + @javax.annotation.Nullable + private Shape mainShape; + + public static final String JSON_PROPERTY_SHAPE_OR_NULL = "shapeOrNull"; + @JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL) + @javax.annotation.Nullable + private ShapeOrNull shapeOrNull; + + public static final String JSON_PROPERTY_NULLABLE_SHAPE = "nullableShape"; + @JsonProperty(JSON_PROPERTY_NULLABLE_SHAPE) + @javax.annotation.Nullable + private NullableShape nullableShape; + + public static final String JSON_PROPERTY_SHAPES = "shapes"; + @JsonProperty(JSON_PROPERTY_SHAPES) + @javax.annotation.Nullable + private List shapes = new ArrayList<>(); + + public Drawing() { + } + + public Drawing mainShape(@javax.annotation.Nullable Shape mainShape) { + this.mainShape = mainShape; + return this; + } + + /** + * Get mainShape + * @return mainShape + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MAIN_SHAPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Shape getMainShape() { + return mainShape; + } + + @JsonProperty(value = JSON_PROPERTY_MAIN_SHAPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMainShape(@javax.annotation.Nullable Shape mainShape) { + this.mainShape = mainShape; + } + + + public Drawing shapeOrNull(@javax.annotation.Nullable ShapeOrNull shapeOrNull) { + this.shapeOrNull = shapeOrNull; + return this; + } + + /** + * Get shapeOrNull + * @return shapeOrNull + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SHAPE_OR_NULL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ShapeOrNull getShapeOrNull() { + return shapeOrNull; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_OR_NULL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShapeOrNull(@javax.annotation.Nullable ShapeOrNull shapeOrNull) { + this.shapeOrNull = shapeOrNull; + } + + + public Drawing nullableShape(@javax.annotation.Nullable NullableShape nullableShape) { + this.nullableShape = nullableShape; + return this; + } + + /** + * Get nullableShape + * @return nullableShape + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NULLABLE_SHAPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public NullableShape getNullableShape() { + return nullableShape; + } + + @JsonProperty(value = JSON_PROPERTY_NULLABLE_SHAPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNullableShape(@javax.annotation.Nullable NullableShape nullableShape) { + this.nullableShape = nullableShape; + } + + + public Drawing shapes(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_SHAPES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getShapes() { + return shapes; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShapes(@javax.annotation.Nullable List shapes) { + this.shapes = shapes; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Drawing instance itself + */ + public Drawing putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Drawing {\n"); + sb.append(" mainShape: ").append(toIndentedString(mainShape)).append("\n"); + sb.append(" shapeOrNull: ").append(toIndentedString(shapeOrNull)).append("\n"); + sb.append(" nullableShape: ").append(toIndentedString(nullableShape)).append("\n"); + sb.append(" shapes: ").append(toIndentedString(shapes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("mainShape", "shapeOrNull", "nullableShape", "shapes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumArrays.java new file mode 100644 index 000000000000..2f1c9f431fde --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -0,0 +1,282 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EnumArrays + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + EnumArrays.JSON_PROPERTY_JUST_SYMBOL, + EnumArrays.JSON_PROPERTY_ARRAY_ENUM +}) +@JsonTypeName("EnumArrays") +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"; + @JsonProperty(JSON_PROPERTY_JUST_SYMBOL) + @javax.annotation.Nullable + 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"; + @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) + @javax.annotation.Nullable + private List arrayEnum = new ArrayList<>(); + + public EnumArrays() { + } + + public EnumArrays justSymbol(@javax.annotation.Nullable JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_JUST_SYMBOL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + @JsonProperty(value = JSON_PROPERTY_JUST_SYMBOL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setJustSymbol(@javax.annotation.Nullable JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + + public EnumArrays arrayEnum(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayEnum() { + return arrayEnum; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayEnum(@javax.annotation.Nullable List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumArrays instance itself + */ + public EnumArrays putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("just_symbol", "array_enum")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumClass.java new file mode 100644 index 000000000000..5e4eb56e8483 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumClass.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.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +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/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java new file mode 100644 index 000000000000..30ce3ab6aa23 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java @@ -0,0 +1,214 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * An object to test discriminator of enum string + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "enum_str_type", // ignore manually set enum_str_type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the enum_str_type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "enum_str_type", visible = true) + +@JsonPropertyOrder({ + EnumStringDiscriminator.JSON_PROPERTY_ENUM_STR_TYPE +}) +@JsonTypeName("EnumStringDiscriminator") +public class EnumStringDiscriminator { + /** + * enum string type + */ + public enum EnumStrTypeEnum { + A("type_a"), + + B("type_b"); + + private String value; + + EnumStrTypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStrTypeEnum fromValue(String value) { + for (EnumStrTypeEnum b : EnumStrTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + } + + public static final String JSON_PROPERTY_ENUM_STR_TYPE = "enum_str_type"; + @JsonProperty(JSON_PROPERTY_ENUM_STR_TYPE) + @javax.annotation.Nonnull + protected EnumStrTypeEnum enumStrType; + + public EnumStringDiscriminator() { + + } + + public EnumStringDiscriminator enumStrType(@javax.annotation.Nonnull EnumStrTypeEnum enumStrType) { + this.enumStrType = enumStrType; + return this; + } + + /** + * enum string type + * @return enumStrType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ENUM_STR_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public EnumStrTypeEnum getEnumStrType() { + return enumStrType; + } + + @JsonProperty(value = JSON_PROPERTY_ENUM_STR_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEnumStrType(@javax.annotation.Nonnull EnumStrTypeEnum enumStrType) { + this.enumStrType = enumStrType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumStringDiscriminator instance itself + */ + public EnumStringDiscriminator putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumStringDiscriminator {\n"); + sb.append(" enumStrType: ").append(toIndentedString(enumStrType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("enum_str_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("enum_str_type")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumTest.java new file mode 100644 index 000000000000..f9ed98626685 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumTest.java @@ -0,0 +1,625 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.OuterEnumDefaultValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.openapitools.client.model.OuterEnumIntegerDefaultValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EnumTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + EnumTest.JSON_PROPERTY_ENUM_STRING, + EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, + EnumTest.JSON_PROPERTY_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_ENUM_INTEGER_ONLY, + EnumTest.JSON_PROPERTY_ENUM_NUMBER, + EnumTest.JSON_PROPERTY_OUTER_ENUM, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE +}) +@JsonTypeName("Enum_Test") +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"; + @JsonProperty(JSON_PROPERTY_ENUM_STRING) + @javax.annotation.Nullable + 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"; + @JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED) + @javax.annotation.Nonnull + 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"; + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER) + @javax.annotation.Nullable + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumIntegerOnly + */ + public enum EnumIntegerOnlyEnum { + NUMBER_2(2), + + NUMBER_MINUS_2(-2); + + private Integer value; + + EnumIntegerOnlyEnum(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerOnlyEnum fromValue(Integer value) { + for (EnumIntegerOnlyEnum b : EnumIntegerOnlyEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + } + + public static final String JSON_PROPERTY_ENUM_INTEGER_ONLY = "enum_integer_only"; + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER_ONLY) + @javax.annotation.Nullable + private EnumIntegerOnlyEnum enumIntegerOnly; + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_ENUM_NUMBER) + @javax.annotation.Nullable + private EnumNumberEnum enumNumber; + + public static final String JSON_PROPERTY_OUTER_ENUM = "outerEnum"; + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + @javax.annotation.Nullable + private OuterEnum outerEnum; + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER = "outerEnumInteger"; + @Deprecated + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER) + @javax.annotation.Nullable + private OuterEnumInteger outerEnumInteger; + + public static final String JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE = "outerEnumDefaultValue"; + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE) + @javax.annotation.Nullable + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE = "outerEnumIntegerDefaultValue"; + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE) + @javax.annotation.Nullable + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + + public EnumTest() { + } + + public EnumTest enumString(@javax.annotation.Nullable EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ENUM_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumStringEnum getEnumString() { + return enumString; + } + + @JsonProperty(value = JSON_PROPERTY_ENUM_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumString(@javax.annotation.Nullable EnumStringEnum enumString) { + this.enumString = enumString; + } + + + public EnumTest enumStringRequired(@javax.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ENUM_STRING_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + @JsonProperty(value = JSON_PROPERTY_ENUM_STRING_REQUIRED, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setEnumStringRequired(@javax.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + + public EnumTest enumInteger(@javax.annotation.Nullable EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ENUM_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + @JsonProperty(value = JSON_PROPERTY_ENUM_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumInteger(@javax.annotation.Nullable EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + public EnumTest enumIntegerOnly(@javax.annotation.Nullable EnumIntegerOnlyEnum enumIntegerOnly) { + this.enumIntegerOnly = enumIntegerOnly; + return this; + } + + /** + * Get enumIntegerOnly + * @return enumIntegerOnly + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ENUM_INTEGER_ONLY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumIntegerOnlyEnum getEnumIntegerOnly() { + return enumIntegerOnly; + } + + @JsonProperty(value = JSON_PROPERTY_ENUM_INTEGER_ONLY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumIntegerOnly(@javax.annotation.Nullable EnumIntegerOnlyEnum enumIntegerOnly) { + this.enumIntegerOnly = enumIntegerOnly; + } + + + public EnumTest enumNumber(@javax.annotation.Nullable EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ENUM_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + @JsonProperty(value = JSON_PROPERTY_ENUM_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnumNumber(@javax.annotation.Nullable EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + public EnumTest outerEnum(@javax.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnum getOuterEnum() { + return outerEnum; + } + + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnum(@javax.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + + @Deprecated + public EnumTest outerEnumInteger(@javax.annotation.Nullable OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return this; + } + + /** + * Get outerEnumInteger + * @return outerEnumInteger + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + @Deprecated + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnumInteger(@javax.annotation.Nullable OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + + public EnumTest outerEnumDefaultValue(@javax.annotation.Nullable OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + /** + * Get outerEnumDefaultValue + * @return outerEnumDefaultValue + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnumDefaultValue(@javax.annotation.Nullable OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + + public EnumTest outerEnumIntegerDefaultValue(@javax.annotation.Nullable OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + /** + * Get outerEnumIntegerDefaultValue + * @return outerEnumIntegerDefaultValue + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + @JsonProperty(value = JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOuterEnumIntegerDefaultValue(@javax.annotation.Nullable OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumTest instance itself + */ + public EnumTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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(" enumIntegerOnly: ").append(toIndentedString(enumIntegerOnly)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); + sb.append(" outerEnumDefaultValue: ").append(toIndentedString(outerEnumDefaultValue)).append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ").append(toIndentedString(outerEnumIntegerDefaultValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("enum_string", "enum_string_required", "enum_integer", "enum_integer_only", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("enum_string_required")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java new file mode 100644 index 000000000000..63fc4bf0f914 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -0,0 +1,199 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EquilateralTriangle + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + EquilateralTriangle.JSON_PROPERTY_SHAPE_TYPE, + EquilateralTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) +@JsonTypeName("EquilateralTriangle") +public class EquilateralTriangle { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @javax.annotation.Nonnull + private String triangleType; + + public EquilateralTriangle() { + } + + public EquilateralTriangle shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public EquilateralTriangle triangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTriangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EquilateralTriangle instance itself + */ + public EquilateralTriangle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java new file mode 100644 index 000000000000..bde28b1435d3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java @@ -0,0 +1,209 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = FakeAnyOfWIthSameErasureGet200Response.FakeAnyOfWIthSameErasureGet200ResponseDeserializer.class) +@JsonSerialize(using = FakeAnyOfWIthSameErasureGet200Response.FakeAnyOfWIthSameErasureGet200ResponseSerializer.class) +public class FakeAnyOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FakeAnyOfWIthSameErasureGet200Response.class.getName()); + + + public static class FakeAnyOfWIthSameErasureGet200ResponseSerializer extends StdSerializer { + public FakeAnyOfWIthSameErasureGet200ResponseSerializer(Class t) { + super(t); + } + + public FakeAnyOfWIthSameErasureGet200ResponseSerializer() { + this(null); + } + + @Override + public void serialize(FakeAnyOfWIthSameErasureGet200Response value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + public static class FakeAnyOfWIthSameErasureGet200ResponseDeserializer extends StdDeserializer { + public FakeAnyOfWIthSameErasureGet200ResponseDeserializer() { + this(FakeAnyOfWIthSameErasureGet200Response.class); + } + + public FakeAnyOfWIthSameErasureGet200ResponseDeserializer(Class vc) { + super(vc); + } + + @Override + public FakeAnyOfWIthSameErasureGet200Response deserialize(JsonParser jp, DeserializationContext ctxt) throws JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + // deserialize List + try { + deserialized = ctxt.readTreeAsValue(tree, List.class); + FakeAnyOfWIthSameErasureGet200Response ret = new FakeAnyOfWIthSameErasureGet200Response(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + // deserialize List + try { + deserialized = ctxt.readTreeAsValue(tree, List.class); + FakeAnyOfWIthSameErasureGet200Response ret = new FakeAnyOfWIthSameErasureGet200Response(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for FakeAnyOfWIthSameErasureGet200Response: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public FakeAnyOfWIthSameErasureGet200Response getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "FakeAnyOfWIthSameErasureGet200Response cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public FakeAnyOfWIthSameErasureGet200Response() { + super("anyOf", Boolean.FALSE); + } + + public FakeAnyOfWIthSameErasureGet200Response(List o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public FakeAnyOfWIthSameErasureGet200Response(List o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List", List.class); + schemas.put("List", List.class); + JSON.registerDescendants(FakeAnyOfWIthSameErasureGet200Response.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return FakeAnyOfWIthSameErasureGet200Response.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * List, List + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List, List"); + } + + /** + * Get the actual instance, which can be the following: + * List, List + * + * @return The actual instance (List, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java new file mode 100644 index 000000000000..90b5f1cde9bb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java @@ -0,0 +1,247 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = FakeOneOfWIthSameErasureGet200Response.FakeOneOfWIthSameErasureGet200ResponseDeserializer.class) +@JsonSerialize(using = FakeOneOfWIthSameErasureGet200Response.FakeOneOfWIthSameErasureGet200ResponseSerializer.class) +public class FakeOneOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FakeOneOfWIthSameErasureGet200Response.class.getName()); + + + public static class FakeOneOfWIthSameErasureGet200ResponseSerializer extends StdSerializer { + public FakeOneOfWIthSameErasureGet200ResponseSerializer(Class t) { + super(t); + } + + public FakeOneOfWIthSameErasureGet200ResponseSerializer() { + this(null); + } + + @Override + public void serialize(FakeOneOfWIthSameErasureGet200Response value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + public static class FakeOneOfWIthSameErasureGet200ResponseDeserializer extends StdDeserializer { + public FakeOneOfWIthSameErasureGet200ResponseDeserializer() { + this(FakeOneOfWIthSameErasureGet200Response.class); + } + + public FakeOneOfWIthSameErasureGet200ResponseDeserializer(Class vc) { + super(vc); + } + + @Override + public FakeOneOfWIthSameErasureGet200Response deserialize(JsonParser jp, DeserializationContext ctxt) throws JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize List + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (List.class.equals(Integer.class) || List.class.equals(Long.class) || List.class.equals(Float.class) || List.class.equals(Double.class) || List.class.equals(Boolean.class) || List.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((List.class.equals(Integer.class) || List.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((List.class.equals(Float.class) || List.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (List.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (List.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, List.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'List'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + // deserialize List + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (List.class.equals(Integer.class) || List.class.equals(Long.class) || List.class.equals(Float.class) || List.class.equals(Double.class) || List.class.equals(Boolean.class) || List.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((List.class.equals(Integer.class) || List.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((List.class.equals(Float.class) || List.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (List.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (List.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, List.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'List'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + if (match == 1) { + FakeOneOfWIthSameErasureGet200Response ret = new FakeOneOfWIthSameErasureGet200Response(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for FakeOneOfWIthSameErasureGet200Response: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public FakeOneOfWIthSameErasureGet200Response getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "FakeOneOfWIthSameErasureGet200Response cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public FakeOneOfWIthSameErasureGet200Response() { + super("oneOf", Boolean.FALSE); + } + + public FakeOneOfWIthSameErasureGet200Response(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public FakeOneOfWIthSameErasureGet200Response(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List", List.class); + schemas.put("List", List.class); + JSON.registerDescendants(FakeOneOfWIthSameErasureGet200Response.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return FakeOneOfWIthSameErasureGet200Response.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * List, List + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List, List"); + } + + /** + * Get the actual instance, which can be the following: + * List, List + * + * @return The actual instance (List, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java new file mode 100644 index 000000000000..43bf1a4c60fb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java @@ -0,0 +1,246 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = FakeRefParameterPetIdParameter.FakeRefParameterPetIdParameterDeserializer.class) +@JsonSerialize(using = FakeRefParameterPetIdParameter.FakeRefParameterPetIdParameterSerializer.class) +public class FakeRefParameterPetIdParameter extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FakeRefParameterPetIdParameter.class.getName()); + + + public static class FakeRefParameterPetIdParameterSerializer extends StdSerializer { + public FakeRefParameterPetIdParameterSerializer(Class t) { + super(t); + } + + public FakeRefParameterPetIdParameterSerializer() { + this(null); + } + + @Override + public void serialize(FakeRefParameterPetIdParameter value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + public static class FakeRefParameterPetIdParameterDeserializer extends StdDeserializer { + public FakeRefParameterPetIdParameterDeserializer() { + this(FakeRefParameterPetIdParameter.class); + } + + public FakeRefParameterPetIdParameterDeserializer(Class vc) { + super(vc); + } + + @Override + public FakeRefParameterPetIdParameter deserialize(JsonParser jp, DeserializationContext ctxt) throws JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize Integer + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Integer.class.equals(Integer.class) || Integer.class.equals(Long.class) || Integer.class.equals(Float.class) || Integer.class.equals(Double.class) || Integer.class.equals(Boolean.class) || Integer.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Integer.class.equals(Integer.class) || Integer.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Integer.class.equals(Float.class) || Integer.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Integer.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Integer.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Integer.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Integer'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + // deserialize String + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (String.class.equals(Integer.class) || String.class.equals(Long.class) || String.class.equals(Float.class) || String.class.equals(Double.class) || String.class.equals(Boolean.class) || String.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((String.class.equals(Integer.class) || String.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((String.class.equals(Float.class) || String.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (String.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (String.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, String.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + if (match == 1) { + FakeRefParameterPetIdParameter ret = new FakeRefParameterPetIdParameter(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for FakeRefParameterPetIdParameter: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public FakeRefParameterPetIdParameter getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "FakeRefParameterPetIdParameter cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public FakeRefParameterPetIdParameter() { + super("oneOf", Boolean.FALSE); + } + + public FakeRefParameterPetIdParameter(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public FakeRefParameterPetIdParameter(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("String", String.class); + JSON.registerDescendants(FakeRefParameterPetIdParameter.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return FakeRefParameterPetIdParameter.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Integer, String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, String"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, String + * + * @return The actual instance (Integer, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..b54cc56a1bc3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,211 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FileSchemaTestClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + FileSchemaTestClass.JSON_PROPERTY_FILE, + FileSchemaTestClass.JSON_PROPERTY_FILES +}) +@JsonTypeName("FileSchemaTestClass") +public class FileSchemaTestClass { + public static final String JSON_PROPERTY_FILE = "file"; + @JsonProperty(JSON_PROPERTY_FILE) + @javax.annotation.Nullable + private ModelFile _file; + + public static final String JSON_PROPERTY_FILES = "files"; + @JsonProperty(JSON_PROPERTY_FILES) + @javax.annotation.Nullable + private List files = new ArrayList<>(); + + public FileSchemaTestClass() { + } + + public FileSchemaTestClass _file(@javax.annotation.Nullable ModelFile _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ModelFile getFile() { + return _file; + } + + @JsonProperty(value = JSON_PROPERTY_FILE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFile(@javax.annotation.Nullable ModelFile _file) { + this._file = _file; + } + + + public FileSchemaTestClass files(@javax.annotation.Nullable List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(ModelFile filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_FILES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getFiles() { + return files; + } + + @JsonProperty(value = JSON_PROPERTY_FILES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFiles(@javax.annotation.Nullable List files) { + this.files = files; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FileSchemaTestClass instance itself + */ + public FileSchemaTestClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("file", "files")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Foo.java new file mode 100644 index 000000000000..48d20549e301 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Foo.java @@ -0,0 +1,168 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Foo + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Foo.JSON_PROPERTY_BAR +}) +@JsonTypeName("Foo") +public class Foo { + public static final String JSON_PROPERTY_BAR = "bar"; + @JsonProperty(JSON_PROPERTY_BAR) + @javax.annotation.Nullable + private String bar = "bar"; + + public Foo() { + } + + public Foo bar(@javax.annotation.Nullable String bar) { + this.bar = bar; + return this; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BAR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + @JsonProperty(value = JSON_PROPERTY_BAR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBar(@javax.annotation.Nullable String bar) { + this.bar = bar; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Foo instance itself + */ + public Foo putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Foo {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java new file mode 100644 index 000000000000..117141b28783 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -0,0 +1,170 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Foo; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FooGetDefaultResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + FooGetDefaultResponse.JSON_PROPERTY_STRING +}) +@JsonTypeName("_foo_get_default_response") +public class FooGetDefaultResponse { + public static final String JSON_PROPERTY_STRING = "string"; + @JsonProperty(JSON_PROPERTY_STRING) + @javax.annotation.Nullable + private Foo string; + + public FooGetDefaultResponse() { + } + + public FooGetDefaultResponse string(@javax.annotation.Nullable Foo string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Foo getString() { + return string; + } + + @JsonProperty(value = JSON_PROPERTY_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setString(@javax.annotation.Nullable Foo string) { + this.string = string; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FooGetDefaultResponse instance itself + */ + public FooGetDefaultResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("string")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FormatTest.java new file mode 100644 index 000000000000..e00e4d663914 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FormatTest.java @@ -0,0 +1,680 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FormatTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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_DECIMAL, + 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_UUID_WITH_DEFAULT, + FormatTest.JSON_PROPERTY_PASSWORD, + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS, + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER +}) +@JsonTypeName("format_test") +public class FormatTest { + public static final String JSON_PROPERTY_INTEGER = "integer"; + @JsonProperty(JSON_PROPERTY_INTEGER) + @javax.annotation.Nullable + private Integer integer; + + public static final String JSON_PROPERTY_INT32 = "int32"; + @JsonProperty(JSON_PROPERTY_INT32) + @javax.annotation.Nullable + private Integer int32; + + public static final String JSON_PROPERTY_INT64 = "int64"; + @JsonProperty(JSON_PROPERTY_INT64) + @javax.annotation.Nullable + private Long int64; + + public static final String JSON_PROPERTY_NUMBER = "number"; + @JsonProperty(JSON_PROPERTY_NUMBER) + @javax.annotation.Nonnull + private BigDecimal number; + + public static final String JSON_PROPERTY_FLOAT = "float"; + @JsonProperty(JSON_PROPERTY_FLOAT) + @javax.annotation.Nullable + private Float _float; + + public static final String JSON_PROPERTY_DOUBLE = "double"; + @JsonProperty(JSON_PROPERTY_DOUBLE) + @javax.annotation.Nullable + private Double _double; + + public static final String JSON_PROPERTY_DECIMAL = "decimal"; + @JsonProperty(JSON_PROPERTY_DECIMAL) + @javax.annotation.Nullable + private BigDecimal decimal; + + public static final String JSON_PROPERTY_STRING = "string"; + @JsonProperty(JSON_PROPERTY_STRING) + @javax.annotation.Nullable + private String string; + + public static final String JSON_PROPERTY_BYTE = "byte"; + @JsonProperty(JSON_PROPERTY_BYTE) + @javax.annotation.Nonnull + private byte[] _byte; + + public static final String JSON_PROPERTY_BINARY = "binary"; + @JsonProperty(JSON_PROPERTY_BINARY) + @javax.annotation.Nullable + private File binary; + + public static final String JSON_PROPERTY_DATE = "date"; + @JsonProperty(JSON_PROPERTY_DATE) + @javax.annotation.Nonnull + private LocalDate date; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @javax.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_UUID = "uuid"; + @JsonProperty(JSON_PROPERTY_UUID) + @javax.annotation.Nullable + private UUID uuid; + + public static final String JSON_PROPERTY_UUID_WITH_DEFAULT = "uuid_with_default"; + @JsonProperty(JSON_PROPERTY_UUID_WITH_DEFAULT) + @javax.annotation.Nullable + private UUID uuidWithDefault = UUID.fromString("11111111-206d-4f12-9f12-3d1e525a8e84"); + + public static final String JSON_PROPERTY_PASSWORD = "password"; + @JsonProperty(JSON_PROPERTY_PASSWORD) + @javax.annotation.Nonnull + private String password; + + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS = "pattern_with_digits"; + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS) + @javax.annotation.Nullable + private String patternWithDigits; + + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER = "pattern_with_digits_and_delimiter"; + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER) + @javax.annotation.Nullable + private String patternWithDigitsAndDelimiter; + + public FormatTest() { + } + + public FormatTest integer(@javax.annotation.Nullable Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInteger() { + return integer; + } + + @JsonProperty(value = JSON_PROPERTY_INTEGER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInteger(@javax.annotation.Nullable Integer integer) { + this.integer = integer; + } + + + public FormatTest int32(@javax.annotation.Nullable Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_INT32, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInt32() { + return int32; + } + + @JsonProperty(value = JSON_PROPERTY_INT32, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInt32(@javax.annotation.Nullable Integer int32) { + this.int32 = int32; + } + + + public FormatTest int64(@javax.annotation.Nullable Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_INT64, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getInt64() { + return int64; + } + + @JsonProperty(value = JSON_PROPERTY_INT64, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setInt64(@javax.annotation.Nullable Long int64) { + this.int64 = int64; + } + + + public FormatTest number(@javax.annotation.Nonnull BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NUMBER, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumber() { + return number; + } + + @JsonProperty(value = JSON_PROPERTY_NUMBER, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNumber(@javax.annotation.Nonnull BigDecimal number) { + this.number = number; + } + + + public FormatTest _float(@javax.annotation.Nullable Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_FLOAT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Float getFloat() { + return _float; + } + + @JsonProperty(value = JSON_PROPERTY_FLOAT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFloat(@javax.annotation.Nullable Float _float) { + this._float = _float; + } + + + public FormatTest _double(@javax.annotation.Nullable Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DOUBLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Double getDouble() { + return _double; + } + + @JsonProperty(value = JSON_PROPERTY_DOUBLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDouble(@javax.annotation.Nullable Double _double) { + this._double = _double; + } + + + public FormatTest decimal(@javax.annotation.Nullable BigDecimal decimal) { + this.decimal = decimal; + return this; + } + + /** + * Get decimal + * @return decimal + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DECIMAL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getDecimal() { + return decimal; + } + + @JsonProperty(value = JSON_PROPERTY_DECIMAL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDecimal(@javax.annotation.Nullable BigDecimal decimal) { + this.decimal = decimal; + } + + + public FormatTest string(@javax.annotation.Nullable String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getString() { + return string; + } + + @JsonProperty(value = JSON_PROPERTY_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setString(@javax.annotation.Nullable String string) { + this.string = string; + } + + + public FormatTest _byte(@javax.annotation.Nonnull byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_BYTE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public byte[] getByte() { + return _byte; + } + + @JsonProperty(value = JSON_PROPERTY_BYTE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setByte(@javax.annotation.Nonnull byte[] _byte) { + this._byte = _byte; + } + + + public FormatTest binary(@javax.annotation.Nullable File binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BINARY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public File getBinary() { + return binary; + } + + @JsonProperty(value = JSON_PROPERTY_BINARY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBinary(@javax.annotation.Nullable File binary) { + this.binary = binary; + } + + + public FormatTest date(@javax.annotation.Nonnull LocalDate date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public LocalDate getDate() { + return date; + } + + @JsonProperty(value = JSON_PROPERTY_DATE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setDate(@javax.annotation.Nonnull LocalDate date) { + this.date = date; + } + + + public FormatTest dateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DATE_TIME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + @JsonProperty(value = JSON_PROPERTY_DATE_TIME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public FormatTest uuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_UUID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuid() { + return uuid; + } + + @JsonProperty(value = JSON_PROPERTY_UUID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + + public FormatTest uuidWithDefault(@javax.annotation.Nullable UUID uuidWithDefault) { + this.uuidWithDefault = uuidWithDefault; + return this; + } + + /** + * Get uuidWithDefault + * @return uuidWithDefault + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_UUID_WITH_DEFAULT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuidWithDefault() { + return uuidWithDefault; + } + + @JsonProperty(value = JSON_PROPERTY_UUID_WITH_DEFAULT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuidWithDefault(@javax.annotation.Nullable UUID uuidWithDefault) { + this.uuidWithDefault = uuidWithDefault; + } + + + public FormatTest password(@javax.annotation.Nonnull String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PASSWORD, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPassword() { + return password; + } + + @JsonProperty(value = JSON_PROPERTY_PASSWORD, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPassword(@javax.annotation.Nonnull String password) { + this.password = password; + } + + + public FormatTest patternWithDigits(@javax.annotation.Nullable String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + return this; + } + + /** + * A string that is a 10 digit number. Can have leading zeros. + * @return patternWithDigits + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PATTERN_WITH_DIGITS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPatternWithDigits() { + return patternWithDigits; + } + + @JsonProperty(value = JSON_PROPERTY_PATTERN_WITH_DIGITS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPatternWithDigits(@javax.annotation.Nullable String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + } + + + public FormatTest patternWithDigitsAndDelimiter(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; + } + + @JsonProperty(value = JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPatternWithDigitsAndDelimiter(@javax.annotation.Nullable String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FormatTest instance itself + */ + public FormatTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" decimal: ").append(toIndentedString(decimal)).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(" uuidWithDefault: ").append(toIndentedString(uuidWithDefault)).append("\n"); + sb.append(" password: ").append("*").append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer", "int32", "int64", "number", "float", "double", "decimal", "string", "byte", "binary", "date", "dateTime", "uuid", "uuid_with_default", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("number", "byte", "date", "password")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java new file mode 100644 index 000000000000..5a3ebe45120f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 org.openapitools.client.model.FreeFormObjectTestClassProperties; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FreeFormObjectTestClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + FreeFormObjectTestClass.JSON_PROPERTY_NAME, + FreeFormObjectTestClass.JSON_PROPERTY_PROPERTIES +}) +@JsonTypeName("FreeFormObjectTestClass") +public class FreeFormObjectTestClass { + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nullable + private String name; + + public static final String JSON_PROPERTY_PROPERTIES = "properties"; + @JsonProperty(JSON_PROPERTY_PROPERTIES) + @javax.annotation.Nullable + private FreeFormObjectTestClassProperties properties; + + public FreeFormObjectTestClass() { + } + + public FreeFormObjectTestClass name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public FreeFormObjectTestClass properties(@javax.annotation.Nullable FreeFormObjectTestClassProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get properties + * @return properties + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PROPERTIES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public FreeFormObjectTestClassProperties getProperties() { + return properties; + } + + @JsonProperty(value = JSON_PROPERTY_PROPERTIES, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setProperties(@javax.annotation.Nullable FreeFormObjectTestClassProperties properties) { + this.properties = properties; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FreeFormObjectTestClass instance itself + */ + public FreeFormObjectTestClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FreeFormObjectTestClass {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "properties")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java new file mode 100644 index 000000000000..343e04eb30e6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java @@ -0,0 +1,247 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Map; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = FreeFormObjectTestClassProperties.FreeFormObjectTestClassPropertiesDeserializer.class) +@JsonSerialize(using = FreeFormObjectTestClassProperties.FreeFormObjectTestClassPropertiesSerializer.class) +public class FreeFormObjectTestClassProperties extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FreeFormObjectTestClassProperties.class.getName()); + + + public static class FreeFormObjectTestClassPropertiesSerializer extends StdSerializer { + public FreeFormObjectTestClassPropertiesSerializer(Class t) { + super(t); + } + + public FreeFormObjectTestClassPropertiesSerializer() { + this(null); + } + + @Override + public void serialize(FreeFormObjectTestClassProperties value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + public static class FreeFormObjectTestClassPropertiesDeserializer extends StdDeserializer { + public FreeFormObjectTestClassPropertiesDeserializer() { + this(FreeFormObjectTestClassProperties.class); + } + + public FreeFormObjectTestClassPropertiesDeserializer(Class vc) { + super(vc); + } + + @Override + public FreeFormObjectTestClassProperties deserialize(JsonParser jp, DeserializationContext ctxt) throws JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize Map + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Map.class.equals(Integer.class) || Map.class.equals(Long.class) || Map.class.equals(Float.class) || Map.class.equals(Double.class) || Map.class.equals(Boolean.class) || Map.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Map.class.equals(Integer.class) || Map.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Map.class.equals(Float.class) || Map.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Map.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Map.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Map.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Map'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Map'", e); + } + + // deserialize String + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (String.class.equals(Integer.class) || String.class.equals(Long.class) || String.class.equals(Float.class) || String.class.equals(Double.class) || String.class.equals(Boolean.class) || String.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((String.class.equals(Integer.class) || String.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((String.class.equals(Float.class) || String.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (String.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (String.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, String.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + if (match == 1) { + FreeFormObjectTestClassProperties ret = new FreeFormObjectTestClassProperties(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for FreeFormObjectTestClassProperties: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public FreeFormObjectTestClassProperties getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "FreeFormObjectTestClassProperties cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public FreeFormObjectTestClassProperties() { + super("oneOf", Boolean.FALSE); + } + + public FreeFormObjectTestClassProperties(Map o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public FreeFormObjectTestClassProperties(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Map", Map.class); + schemas.put("String", String.class); + JSON.registerDescendants(FreeFormObjectTestClassProperties.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return FreeFormObjectTestClassProperties.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Map, String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Map.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Map, String"); + } + + /** + * Get the actual instance, which can be the following: + * Map, String + * + * @return The actual instance (Map, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Map`. If the actual instance is not `Map`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Map` + * @throws ClassCastException if the instance is not `Map` + */ + public Map getMap() throws ClassCastException { + return (Map)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Fruit.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Fruit.java new file mode 100644 index 000000000000..a9acf71299e7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Fruit.java @@ -0,0 +1,253 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Fruit.FruitDeserializer.class) +@JsonSerialize(using = Fruit.FruitSerializer.class) +public class Fruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Fruit.class.getName()); + + + public static class FruitSerializer extends StdSerializer { + public FruitSerializer(Class t) { + super(t); + } + + public FruitSerializer() { + this(null); + } + + @Override + public void serialize(Fruit value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + 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 JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize Apple + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Apple.class.equals(Integer.class) || Apple.class.equals(Long.class) || Apple.class.equals(Float.class) || Apple.class.equals(Double.class) || Apple.class.equals(Boolean.class) || Apple.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Apple.class.equals(Integer.class) || Apple.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Apple.class.equals(Float.class) || Apple.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Apple.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Apple.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Apple.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Apple'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Apple'", e); + } + + // deserialize Banana + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Banana.class.equals(Integer.class) || Banana.class.equals(Long.class) || Banana.class.equals(Float.class) || Banana.class.equals(Double.class) || Banana.class.equals(Boolean.class) || Banana.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Banana.class.equals(Integer.class) || Banana.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Banana.class.equals(Float.class) || Banana.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Banana.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Banana.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Banana.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Banana'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Banana'", e); + } + + if (match == 1) { + Fruit ret = new Fruit(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for Fruit: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Fruit getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "Fruit cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final 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", Apple.class); + schemas.put("Banana", Banana.class); + JSON.registerDescendants(Fruit.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return Fruit.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Apple, Banana + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Apple.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Banana.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } + + /** + * Get the actual instance, which can be the following: + * Apple, Banana + * + * @return The actual instance (Apple, Banana) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Apple`. If the actual instance is not `Apple`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Apple` + * @throws ClassCastException if the instance is not `Apple` + */ + public Apple getApple() throws ClassCastException { + return (Apple)super.getActualInstance(); + } + + /** + * Get the actual instance of `Banana`. If the actual instance is not `Banana`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Banana` + * @throws ClassCastException if the instance is not `Banana` + */ + public Banana getBanana() throws ClassCastException { + return (Banana)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FruitReq.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FruitReq.java new file mode 100644 index 000000000000..8d1d6eacad2b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FruitReq.java @@ -0,0 +1,260 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = FruitReq.FruitReqDeserializer.class) +@JsonSerialize(using = FruitReq.FruitReqSerializer.class) +public class FruitReq extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FruitReq.class.getName()); + + + public static class FruitReqSerializer extends StdSerializer { + public FruitReqSerializer(Class t) { + super(t); + } + + public FruitReqSerializer() { + this(null); + } + + @Override + public void serialize(FruitReq value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + 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 JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize AppleReq + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AppleReq.class.equals(Integer.class) || AppleReq.class.equals(Long.class) || AppleReq.class.equals(Float.class) || AppleReq.class.equals(Double.class) || AppleReq.class.equals(Boolean.class) || AppleReq.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((AppleReq.class.equals(Integer.class) || AppleReq.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((AppleReq.class.equals(Float.class) || AppleReq.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (AppleReq.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (AppleReq.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, AppleReq.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'AppleReq'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AppleReq'", e); + } + + // deserialize BananaReq + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (BananaReq.class.equals(Integer.class) || BananaReq.class.equals(Long.class) || BananaReq.class.equals(Float.class) || BananaReq.class.equals(Double.class) || BananaReq.class.equals(Boolean.class) || BananaReq.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((BananaReq.class.equals(Integer.class) || BananaReq.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((BananaReq.class.equals(Float.class) || BananaReq.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (BananaReq.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (BananaReq.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, BananaReq.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'BananaReq'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'BananaReq'", e); + } + + if (match == 1) { + FruitReq ret = new FruitReq(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for FruitReq: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public FruitReq getNullValue(DeserializationContext ctxt) { + return null; + } + } + + // store a list of schema names defined in oneOf + public static final 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", AppleReq.class); + schemas.put("BananaReq", BananaReq.class); + JSON.registerDescendants(FruitReq.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return FruitReq.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * AppleReq, BananaReq + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(AppleReq.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(BananaReq.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be AppleReq, BananaReq"); + } + + /** + * Get the actual instance, which can be the following: + * AppleReq, BananaReq + * + * @return The actual instance (AppleReq, BananaReq) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AppleReq`. If the actual instance is not `AppleReq`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `AppleReq` + * @throws ClassCastException if the instance is not `AppleReq` + */ + public AppleReq getAppleReq() throws ClassCastException { + return (AppleReq)super.getActualInstance(); + } + + /** + * Get the actual instance of `BananaReq`. If the actual instance is not `BananaReq`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BananaReq` + * @throws ClassCastException if the instance is not `BananaReq` + */ + public BananaReq getBananaReq() throws ClassCastException { + return (BananaReq)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GmFruit.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GmFruit.java new file mode 100644 index 000000000000..c4c3a4d0c92d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GmFruit.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = GmFruit.GmFruitDeserializer.class) +@JsonSerialize(using = GmFruit.GmFruitSerializer.class) +public class GmFruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GmFruit.class.getName()); + + + public static class GmFruitSerializer extends StdSerializer { + public GmFruitSerializer(Class t) { + super(t); + } + + public GmFruitSerializer() { + this(null); + } + + @Override + public void serialize(GmFruit value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + 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 JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + // deserialize Apple + try { + deserialized = ctxt.readTreeAsValue(tree, Apple.class); + GmFruit ret = new GmFruit(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Apple'", e); + } + + // deserialize Banana + try { + deserialized = ctxt.readTreeAsValue(tree, Banana.class); + GmFruit ret = new GmFruit(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Banana'", e); + } + + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for GmFruit: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public GmFruit getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "GmFruit cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final 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", Apple.class); + schemas.put("Banana", Banana.class); + JSON.registerDescendants(GmFruit.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return GmFruit.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Apple, Banana + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Apple.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Banana.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } + + /** + * Get the actual instance, which can be the following: + * Apple, Banana + * + * @return The actual instance (Apple, Banana) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Apple`. If the actual instance is not `Apple`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Apple` + * @throws ClassCastException if the instance is not `Apple` + */ + public Apple getApple() throws ClassCastException { + return (Apple)super.getActualInstance(); + } + + /** + * Get the actual instance of `Banana`. If the actual instance is not `Banana`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Banana` + * @throws ClassCastException if the instance is not `Banana` + */ + public Banana getBanana() throws ClassCastException { + return (Banana)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java new file mode 100644 index 000000000000..6090e464651e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -0,0 +1,181 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * GrandparentAnimal + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the pet_type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ParentPet.class, name = "ParentPet"), +}) + +@JsonPropertyOrder({ + GrandparentAnimal.JSON_PROPERTY_PET_TYPE +}) +@JsonTypeName("GrandparentAnimal") +public class GrandparentAnimal { + public static final String JSON_PROPERTY_PET_TYPE = "pet_type"; + @JsonProperty(JSON_PROPERTY_PET_TYPE) + @javax.annotation.Nonnull + protected String petType; + + public GrandparentAnimal() { + this.petType = this.getClass().getSimpleName(); + } + + public GrandparentAnimal petType(@javax.annotation.Nonnull String petType) { + this.petType = petType; + return this; + } + + /** + * Get petType + * @return petType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PET_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPetType() { + return petType; + } + + @JsonProperty(value = JSON_PROPERTY_PET_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPetType(@javax.annotation.Nonnull String petType) { + this.petType = petType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the GrandparentAnimal instance itself + */ + public GrandparentAnimal putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GrandparentAnimal {\n"); + sb.append(" petType: ").append(toIndentedString(petType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("pet_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("pet_type")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..c49db8e90a3c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * HasOnlyReadOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + HasOnlyReadOnly.JSON_PROPERTY_BAR, + HasOnlyReadOnly.JSON_PROPERTY_FOO +}) +@JsonTypeName("hasOnlyReadOnly") +public class HasOnlyReadOnly { + public static final String JSON_PROPERTY_BAR = "bar"; + @JsonProperty(JSON_PROPERTY_BAR) + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @javax.annotation.Nullable + private String bar; + + public static final String JSON_PROPERTY_FOO = "foo"; + @JsonProperty(JSON_PROPERTY_FOO) + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @javax.annotation.Nullable + private String foo; + + public HasOnlyReadOnly() { + } + + public HasOnlyReadOnly( + String bar, + String foo + ) { + this(); + this.bar = bar; + this.foo = foo; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BAR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + /** + * Get foo + * @return foo + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_FOO, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getFoo() { + return foo; + } + + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the HasOnlyReadOnly instance itself + */ + public HasOnlyReadOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar", "foo")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HealthCheckResult.java new file mode 100644 index 000000000000..2e34ff5ca05e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HealthCheckResult.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.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + HealthCheckResult.JSON_PROPERTY_NULLABLE_MESSAGE +}) +@JsonTypeName("HealthCheckResult") +public class HealthCheckResult { + public static final String JSON_PROPERTY_NULLABLE_MESSAGE = "NullableMessage"; + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) + @javax.annotation.Nullable + private String nullableMessage; + + public HealthCheckResult() { + } + + public HealthCheckResult nullableMessage(@javax.annotation.Nullable String nullableMessage) { + this.nullableMessage = nullableMessage; + return this; + } + + /** + * Get nullableMessage + * @return nullableMessage + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NULLABLE_MESSAGE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getNullableMessage() { + return nullableMessage; + } + + @JsonProperty(value = JSON_PROPERTY_NULLABLE_MESSAGE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNullableMessage(@javax.annotation.Nullable String nullableMessage) { + this.nullableMessage = nullableMessage; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the HealthCheckResult instance itself + */ + public HealthCheckResult putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("NullableMessage")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java new file mode 100644 index 000000000000..fa8df0d4e4e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -0,0 +1,199 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IsoscelesTriangle + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + IsoscelesTriangle.JSON_PROPERTY_SHAPE_TYPE, + IsoscelesTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) +@JsonTypeName("IsoscelesTriangle") +public class IsoscelesTriangle { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @javax.annotation.Nonnull + private String triangleType; + + public IsoscelesTriangle() { + } + + public IsoscelesTriangle shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public IsoscelesTriangle triangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTriangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IsoscelesTriangle instance itself + */ + public IsoscelesTriangle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Mammal.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Mammal.java new file mode 100644 index 000000000000..0a041094ffe3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Mammal.java @@ -0,0 +1,332 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Mammal.MammalDeserializer.class) +@JsonSerialize(using = Mammal.MammalSerializer.class) +public class Mammal extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Mammal.class.getName()); + + + public static class MammalSerializer extends StdSerializer { + public MammalSerializer(Class t) { + super(t); + } + + public MammalSerializer() { + this(null); + } + + @Override + public void serialize(Mammal value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + 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 JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + Mammal newMammal = new Mammal(); + String discriminatorValue = tree.path("className").asText(null); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "Pig": + deserialized = ctxt.readTreeAsValue(tree, Pig.class); + newMammal.setActualInstance(deserialized); + return newMammal; + case "whale": + deserialized = ctxt.readTreeAsValue(tree, Whale.class); + newMammal.setActualInstance(deserialized); + return newMammal; + case "zebra": + deserialized = ctxt.readTreeAsValue(tree, Zebra.class); + newMammal.setActualInstance(deserialized); + return newMammal; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Mammal. Possible values: Pig whale zebra", discriminatorValue)); + } + } + + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize Pig + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Pig.class.equals(Integer.class) || Pig.class.equals(Long.class) || Pig.class.equals(Float.class) || Pig.class.equals(Double.class) || Pig.class.equals(Boolean.class) || Pig.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Pig.class.equals(Integer.class) || Pig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Pig.class.equals(Float.class) || Pig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Pig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Pig.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Pig.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Pig'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Pig'", e); + } + + // deserialize Whale + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Whale.class.equals(Integer.class) || Whale.class.equals(Long.class) || Whale.class.equals(Float.class) || Whale.class.equals(Double.class) || Whale.class.equals(Boolean.class) || Whale.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Whale.class.equals(Integer.class) || Whale.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Whale.class.equals(Float.class) || Whale.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Whale.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Whale.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Whale.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Whale'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Whale'", e); + } + + // deserialize Zebra + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Zebra.class.equals(Integer.class) || Zebra.class.equals(Long.class) || Zebra.class.equals(Float.class) || Zebra.class.equals(Double.class) || Zebra.class.equals(Boolean.class) || Zebra.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Zebra.class.equals(Integer.class) || Zebra.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Zebra.class.equals(Float.class) || Zebra.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Zebra.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Zebra.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Zebra.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Zebra'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Zebra'", e); + } + + if (match == 1) { + Mammal ret = new Mammal(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for Mammal: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Mammal getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "Mammal cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final 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", Pig.class); + schemas.put("Whale", Whale.class); + schemas.put("Zebra", Zebra.class); + JSON.registerDescendants(Mammal.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Pig", Pig.class); + mappings.put("whale", Whale.class); + mappings.put("zebra", Zebra.class); + mappings.put("mammal", Mammal.class); + JSON.registerDiscriminator(Mammal.class, "className", mappings); + } + + @Override + public Map> getSchemas() { + return Mammal.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Pig, Whale, Zebra + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Pig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Whale.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Zebra.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Pig, Whale, Zebra"); + } + + /** + * Get the actual instance, which can be the following: + * Pig, Whale, Zebra + * + * @return The actual instance (Pig, Whale, Zebra) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Pig`. If the actual instance is not `Pig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Pig` + * @throws ClassCastException if the instance is not `Pig` + */ + public Pig getPig() throws ClassCastException { + return (Pig)super.getActualInstance(); + } + + /** + * Get the actual instance of `Whale`. If the actual instance is not `Whale`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Whale` + * @throws ClassCastException if the instance is not `Whale` + */ + public Whale getWhale() throws ClassCastException { + return (Whale)super.getActualInstance(); + } + + /** + * Get the actual instance of `Zebra`. If the actual instance is not `Zebra`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Zebra` + * @throws ClassCastException if the instance is not `Zebra` + */ + public Zebra getZebra() throws ClassCastException { + return (Zebra)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MammalAnyof.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MammalAnyof.java new file mode 100644 index 000000000000..09e2a169ce54 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MammalAnyof.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = MammalAnyof.MammalAnyofDeserializer.class) +@JsonSerialize(using = MammalAnyof.MammalAnyofSerializer.class) +public class MammalAnyof extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(MammalAnyof.class.getName()); + + + public static class MammalAnyofSerializer extends StdSerializer { + public MammalAnyofSerializer(Class t) { + super(t); + } + + public MammalAnyofSerializer() { + this(null); + } + + @Override + public void serialize(MammalAnyof value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + public static class MammalAnyofDeserializer extends StdDeserializer { + public MammalAnyofDeserializer() { + this(MammalAnyof.class); + } + + public MammalAnyofDeserializer(Class vc) { + super(vc); + } + + @Override + public MammalAnyof deserialize(JsonParser jp, DeserializationContext ctxt) throws JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + Class cls = JSON.getClassForElement(tree, new MammalAnyof().getClass()); + if (cls != null) { + deserialized = ctxt.readTreeAsValue(tree, ctxt.constructType(cls)); + MammalAnyof ret = new MammalAnyof(); + ret.setActualInstance(deserialized); + return ret; + } + // deserialize Pig + try { + deserialized = ctxt.readTreeAsValue(tree, Pig.class); + MammalAnyof ret = new MammalAnyof(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Pig'", e); + } + + // deserialize Whale + try { + deserialized = ctxt.readTreeAsValue(tree, Whale.class); + MammalAnyof ret = new MammalAnyof(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Whale'", e); + } + + // deserialize Zebra + try { + deserialized = ctxt.readTreeAsValue(tree, Zebra.class); + MammalAnyof ret = new MammalAnyof(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Zebra'", e); + } + + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for MammalAnyof: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public MammalAnyof getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "MammalAnyof cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public MammalAnyof() { + super("anyOf", Boolean.FALSE); + } + + public MammalAnyof(Pig o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public MammalAnyof(Whale o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public MammalAnyof(Zebra o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Pig", Pig.class); + schemas.put("Whale", Whale.class); + schemas.put("Zebra", Zebra.class); + JSON.registerDescendants(MammalAnyof.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Pig", Pig.class); + mappings.put("whale", Whale.class); + mappings.put("zebra", Zebra.class); + mappings.put("mammal_anyof", MammalAnyof.class); + JSON.registerDiscriminator(MammalAnyof.class, "className", mappings); + } + + @Override + public Map> getSchemas() { + return MammalAnyof.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Pig, Whale, Zebra + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Pig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Whale.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Zebra.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Pig, Whale, Zebra"); + } + + /** + * Get the actual instance, which can be the following: + * Pig, Whale, Zebra + * + * @return The actual instance (Pig, Whale, Zebra) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Pig`. If the actual instance is not `Pig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Pig` + * @throws ClassCastException if the instance is not `Pig` + */ + public Pig getPig() throws ClassCastException { + return (Pig)super.getActualInstance(); + } + + /** + * Get the actual instance of `Whale`. If the actual instance is not `Whale`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Whale` + * @throws ClassCastException if the instance is not `Whale` + */ + public Whale getWhale() throws ClassCastException { + return (Whale)super.getActualInstance(); + } + + /** + * Get the actual instance of `Zebra`. If the actual instance is not `Zebra`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Zebra` + * @throws ClassCastException if the instance is not `Zebra` + */ + public Zebra getZebra() throws ClassCastException { + return (Zebra)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MapTest.java new file mode 100644 index 000000000000..471c71011971 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,331 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * MapTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("MapTest") +public class MapTest { + public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string"; + @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) + @javax.annotation.Nullable + private Map> mapMapOfString = new HashMap<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) + @javax.annotation.Nullable + private Map mapOfEnumString = new HashMap<>(); + + public static final String JSON_PROPERTY_DIRECT_MAP = "direct_map"; + @JsonProperty(JSON_PROPERTY_DIRECT_MAP) + @javax.annotation.Nullable + private Map directMap = new HashMap<>(); + + public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map"; + @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) + @javax.annotation.Nullable + private Map indirectMap = new HashMap<>(); + + public MapTest() { + } + + public MapTest mapMapOfString(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP_MAP_OF_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map> getMapMapOfString() { + return mapMapOfString; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_MAP_OF_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapMapOfString(@javax.annotation.Nullable Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + + public MapTest mapOfEnumString(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP_OF_ENUM_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + @JsonProperty(value = JSON_PROPERTY_MAP_OF_ENUM_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMapOfEnumString(@javax.annotation.Nullable Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + + public MapTest directMap(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_DIRECT_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getDirectMap() { + return directMap; + } + + @JsonProperty(value = JSON_PROPERTY_DIRECT_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDirectMap(@javax.annotation.Nullable Map directMap) { + this.directMap = directMap; + } + + + public MapTest indirectMap(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_INDIRECT_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getIndirectMap() { + return indirectMap; + } + + @JsonProperty(value = JSON_PROPERTY_INDIRECT_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIndirectMap(@javax.annotation.Nullable Map indirectMap) { + this.indirectMap = indirectMap; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MapTest instance itself + */ + public MapTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..7ce74f3a9a41 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,243 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_MAP +}) +@JsonTypeName("MixedPropertiesAndAdditionalPropertiesClass") +public class MixedPropertiesAndAdditionalPropertiesClass { + public static final String JSON_PROPERTY_UUID = "uuid"; + @JsonProperty(JSON_PROPERTY_UUID) + @javax.annotation.Nullable + private UUID uuid; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @javax.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_MAP = "map"; + @JsonProperty(JSON_PROPERTY_MAP) + @javax.annotation.Nullable + private Map map = new HashMap<>(); + + public MixedPropertiesAndAdditionalPropertiesClass() { + } + + public MixedPropertiesAndAdditionalPropertiesClass uuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_UUID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuid() { + return uuid; + } + + @JsonProperty(value = JSON_PROPERTY_UUID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DATE_TIME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + @JsonProperty(value = JSON_PROPERTY_DATE_TIME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public MixedPropertiesAndAdditionalPropertiesClass map(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMap() { + return map; + } + + @JsonProperty(value = JSON_PROPERTY_MAP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMap(@javax.annotation.Nullable Map map) { + this.map = map; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MixedPropertiesAndAdditionalPropertiesClass instance itself + */ + public MixedPropertiesAndAdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("uuid", "dateTime", "map")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Model200Response.java new file mode 100644 index 000000000000..e5d366c952db --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Model200Response.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model name starting with number + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Model200Response.JSON_PROPERTY_NAME, + Model200Response.JSON_PROPERTY_PROPERTY_CLASS +}) +@JsonTypeName("200_response") +public class Model200Response { + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nullable + private Integer name; + + public static final String JSON_PROPERTY_PROPERTY_CLASS = "class"; + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @javax.annotation.Nullable + private String propertyClass; + + public Model200Response() { + } + + public Model200Response name(@javax.annotation.Nullable Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable Integer name) { + this.name = name; + } + + + public Model200Response propertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PROPERTY_CLASS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPropertyClass() { + return propertyClass; + } + + @JsonProperty(value = JSON_PROPERTY_PROPERTY_CLASS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Model200Response instance itself + */ + public Model200Response putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "class")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..17dd00b0e149 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,231 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelApiResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) +@JsonTypeName("ApiResponse") +public class ModelApiResponse { + public static final String JSON_PROPERTY_CODE = "code"; + @JsonProperty(JSON_PROPERTY_CODE) + @javax.annotation.Nullable + private Integer code; + + public static final String JSON_PROPERTY_TYPE = "type"; + @JsonProperty(JSON_PROPERTY_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + @JsonProperty(JSON_PROPERTY_MESSAGE) + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getCode() { + return code; + } + + @JsonProperty(value = JSON_PROPERTY_CODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MESSAGE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMessage() { + return message; + } + + @JsonProperty(value = JSON_PROPERTY_MESSAGE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("code", "type", "message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelFile.java new file mode 100644 index 000000000000..203a61b27ee2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelFile.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Must be named `File` for test. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ModelFile.JSON_PROPERTY_SOURCE_U_R_I +}) +@JsonTypeName("File") +public class ModelFile { + public static final String JSON_PROPERTY_SOURCE_U_R_I = "sourceURI"; + @JsonProperty(JSON_PROPERTY_SOURCE_U_R_I) + @javax.annotation.Nullable + private String sourceURI; + + public ModelFile() { + } + + public ModelFile sourceURI(@javax.annotation.Nullable String sourceURI) { + this.sourceURI = sourceURI; + return this; + } + + /** + * Test capitalization + * @return sourceURI + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SOURCE_U_R_I, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSourceURI() { + return sourceURI; + } + + @JsonProperty(value = JSON_PROPERTY_SOURCE_U_R_I, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSourceURI(@javax.annotation.Nullable String sourceURI) { + this.sourceURI = sourceURI; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelFile instance itself + */ + public ModelFile putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelFile {\n"); + sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("sourceURI")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelList.java new file mode 100644 index 000000000000..6ce2a025f709 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelList.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ModelList.JSON_PROPERTY_123LIST +}) +@JsonTypeName("List") +public class ModelList { + public static final String JSON_PROPERTY_123LIST = "123-list"; + @JsonProperty(JSON_PROPERTY_123LIST) + @javax.annotation.Nullable + private String _123list; + + public ModelList() { + } + + public ModelList _123list(@javax.annotation.Nullable String _123list) { + this._123list = _123list; + return this; + } + + /** + * Get _123list + * @return _123list + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_123LIST, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String get123list() { + return _123list; + } + + @JsonProperty(value = JSON_PROPERTY_123LIST, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void set123list(@javax.annotation.Nullable String _123list) { + this._123list = _123list; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelList instance itself + */ + public ModelList putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelList {\n"); + sb.append(" _123list: ").append(toIndentedString(_123list)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("123-list")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelReturn.java new file mode 100644 index 000000000000..d088af9105fc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing reserved words + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ModelReturn.JSON_PROPERTY_RETURN +}) +@JsonTypeName("Return") +public class ModelReturn { + public static final String JSON_PROPERTY_RETURN = "return"; + @JsonProperty(JSON_PROPERTY_RETURN) + @javax.annotation.Nullable + private Integer _return; + + public ModelReturn() { + } + + public ModelReturn _return(@javax.annotation.Nullable Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_RETURN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getReturn() { + return _return; + } + + @JsonProperty(value = JSON_PROPERTY_RETURN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReturn(@javax.annotation.Nullable Integer _return) { + this._return = _return; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelReturn instance itself + */ + public ModelReturn putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("return")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java new file mode 100644 index 000000000000..11284554eed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java @@ -0,0 +1,201 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 org.openapitools.client.model.ArrayAnyOf; +import org.openapitools.client.model.ArrayOneOf; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelWithOneOfAnyOfProperties + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ModelWithOneOfAnyOfProperties.JSON_PROPERTY_ONEOF_PROP, + ModelWithOneOfAnyOfProperties.JSON_PROPERTY_ANYOF_PROP +}) +@JsonTypeName("ModelWithOneOfAnyOfProperties") +public class ModelWithOneOfAnyOfProperties { + public static final String JSON_PROPERTY_ONEOF_PROP = "oneof_prop"; + @JsonProperty(JSON_PROPERTY_ONEOF_PROP) + @javax.annotation.Nullable + private ArrayOneOf oneofProp; + + public static final String JSON_PROPERTY_ANYOF_PROP = "anyof_prop"; + @JsonProperty(JSON_PROPERTY_ANYOF_PROP) + @javax.annotation.Nullable + private ArrayAnyOf anyofProp; + + public ModelWithOneOfAnyOfProperties() { + } + + public ModelWithOneOfAnyOfProperties oneofProp(@javax.annotation.Nullable ArrayOneOf oneofProp) { + this.oneofProp = oneofProp; + return this; + } + + /** + * Get oneofProp + * @return oneofProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ONEOF_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ArrayOneOf getOneofProp() { + return oneofProp; + } + + @JsonProperty(value = JSON_PROPERTY_ONEOF_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOneofProp(@javax.annotation.Nullable ArrayOneOf oneofProp) { + this.oneofProp = oneofProp; + } + + + public ModelWithOneOfAnyOfProperties anyofProp(@javax.annotation.Nullable ArrayAnyOf anyofProp) { + this.anyofProp = anyofProp; + return this; + } + + /** + * Get anyofProp + * @return anyofProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ANYOF_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ArrayAnyOf getAnyofProp() { + return anyofProp; + } + + @JsonProperty(value = JSON_PROPERTY_ANYOF_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAnyofProp(@javax.annotation.Nullable ArrayAnyOf anyofProp) { + this.anyofProp = anyofProp; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelWithOneOfAnyOfProperties instance itself + */ + public ModelWithOneOfAnyOfProperties putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelWithOneOfAnyOfProperties {\n"); + sb.append(" oneofProp: ").append(toIndentedString(oneofProp)).append("\n"); + sb.append(" anyofProp: ").append(toIndentedString(anyofProp)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("oneof_prop", "anyof_prop")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Name.java new file mode 100644 index 000000000000..98fc8c2be4ee --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Name.java @@ -0,0 +1,252 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model name same as property name + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Name.JSON_PROPERTY_NAME, + Name.JSON_PROPERTY_SNAKE_CASE, + Name.JSON_PROPERTY_PROPERTY, + Name.JSON_PROPERTY_123NUMBER +}) +@JsonTypeName("Name") +public class Name { + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private Integer name; + + public static final String JSON_PROPERTY_SNAKE_CASE = "snake_case"; + @JsonProperty(JSON_PROPERTY_SNAKE_CASE) + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @javax.annotation.Nullable + private Integer snakeCase; + + public static final String JSON_PROPERTY_PROPERTY = "property"; + @JsonProperty(JSON_PROPERTY_PROPERTY) + @javax.annotation.Nullable + private String property; + + public static final String JSON_PROPERTY_123NUMBER = "123Number"; + @JsonProperty(JSON_PROPERTY_123NUMBER) + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @javax.annotation.Nullable + private Integer _123number; + + public Name() { + } + + public Name( + Integer snakeCase, + Integer _123number + ) { + this(); + this.snakeCase = snakeCase; + this._123number = _123number; + } + + public Name name(@javax.annotation.Nonnull Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull Integer name) { + this.name = name; + } + + + /** + * Get snakeCase + * @return snakeCase + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SNAKE_CASE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getSnakeCase() { + return snakeCase; + } + + + + public Name property(@javax.annotation.Nullable String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getProperty() { + return property; + } + + @JsonProperty(value = JSON_PROPERTY_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setProperty(@javax.annotation.Nullable String property) { + this.property = property; + } + + + /** + * Get _123number + * @return _123number + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_123NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer get123number() { + return _123number; + } + + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Name instance itself + */ + public Name putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "snake_case", "property", "123Number")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java new file mode 100644 index 000000000000..1a3f326727f8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java @@ -0,0 +1,179 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NestedArrayWithDefaultValues + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NestedArrayWithDefaultValues.JSON_PROPERTY_NESTED_ARRAY +}) +@JsonTypeName("NestedArrayWithDefaultValues") +public class NestedArrayWithDefaultValues { + public static final String JSON_PROPERTY_NESTED_ARRAY = "nestedArray"; + @JsonProperty(JSON_PROPERTY_NESTED_ARRAY) + @javax.annotation.Nullable + private List> nestedArray; + + public NestedArrayWithDefaultValues() { + } + + public NestedArrayWithDefaultValues nestedArray(@javax.annotation.Nullable List> nestedArray) { + this.nestedArray = nestedArray; + return this; + } + + public NestedArrayWithDefaultValues addNestedArrayItem(List nestedArrayItem) { + if (this.nestedArray == null) { + this.nestedArray = new ArrayList<>(); + } + this.nestedArray.add(nestedArrayItem); + return this; + } + + /** + * Get nestedArray + * @return nestedArray + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NESTED_ARRAY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getNestedArray() { + return nestedArray; + } + + @JsonProperty(value = JSON_PROPERTY_NESTED_ARRAY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNestedArray(@javax.annotation.Nullable List> nestedArray) { + this.nestedArray = nestedArray; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NestedArrayWithDefaultValues instance itself + */ + public NestedArrayWithDefaultValues putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NestedArrayWithDefaultValues {\n"); + sb.append(" nestedArray: ").append(toIndentedString(nestedArray)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("nestedArray")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPet.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPet.java new file mode 100644 index 000000000000..677b5eb9ee9c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPet.java @@ -0,0 +1,474 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.NewPetCategoryInlineAllof; +import org.openapitools.client.model.Tag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NewPet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NewPet.JSON_PROPERTY_ID, + NewPet.JSON_PROPERTY_CATEGORY_INLINE_ALLOF, + NewPet.JSON_PROPERTY_CATEGORY_ALL_OF_REF, + NewPet.JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION, + NewPet.JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION_READONLY, + NewPet.JSON_PROPERTY_NAME, + NewPet.JSON_PROPERTY_PHOTO_URLS, + NewPet.JSON_PROPERTY_TAGS, + NewPet.JSON_PROPERTY_STATUS +}) +@JsonTypeName("NewPet") +public class NewPet { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY_INLINE_ALLOF = "category_inline_allof"; + @JsonProperty(JSON_PROPERTY_CATEGORY_INLINE_ALLOF) + @javax.annotation.Nullable + private NewPetCategoryInlineAllof categoryInlineAllof; + + public static final String JSON_PROPERTY_CATEGORY_ALL_OF_REF = "category_allOf_ref"; + @JsonProperty(JSON_PROPERTY_CATEGORY_ALL_OF_REF) + @javax.annotation.Nullable + private Category categoryAllOfRef; + + public static final String JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION = "category_allOf_ref_description"; + @JsonProperty(JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION) + @javax.annotation.Nullable + private Category categoryAllOfRefDescription; + + public static final String JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION_READONLY = "category_allOf_ref_description_readonly"; + @JsonProperty(JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION_READONLY) + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @javax.annotation.Nullable + private Category categoryAllOfRefDescriptionReadonly; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @JsonProperty(JSON_PROPERTY_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public NewPet() { + } + + public NewPet( + Category categoryAllOfRefDescriptionReadonly + ) { + this(); + this.categoryAllOfRefDescriptionReadonly = categoryAllOfRefDescriptionReadonly; + } + + public NewPet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public NewPet categoryInlineAllof(@javax.annotation.Nullable NewPetCategoryInlineAllof categoryInlineAllof) { + this.categoryInlineAllof = categoryInlineAllof; + return this; + } + + /** + * Get categoryInlineAllof + * @return categoryInlineAllof + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY_INLINE_ALLOF, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public NewPetCategoryInlineAllof getCategoryInlineAllof() { + return categoryInlineAllof; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY_INLINE_ALLOF, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategoryInlineAllof(@javax.annotation.Nullable NewPetCategoryInlineAllof categoryInlineAllof) { + this.categoryInlineAllof = categoryInlineAllof; + } + + + public NewPet categoryAllOfRef(@javax.annotation.Nullable Category categoryAllOfRef) { + this.categoryAllOfRef = categoryAllOfRef; + return this; + } + + /** + * Get categoryAllOfRef + * @return categoryAllOfRef + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY_ALL_OF_REF, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategoryAllOfRef() { + return categoryAllOfRef; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY_ALL_OF_REF, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategoryAllOfRef(@javax.annotation.Nullable Category categoryAllOfRef) { + this.categoryAllOfRef = categoryAllOfRef; + } + + + public NewPet categoryAllOfRefDescription(@javax.annotation.Nullable Category categoryAllOfRefDescription) { + this.categoryAllOfRefDescription = categoryAllOfRefDescription; + return this; + } + + /** + * Adding description to property using allOf + * @return categoryAllOfRefDescription + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategoryAllOfRefDescription() { + return categoryAllOfRefDescription; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategoryAllOfRefDescription(@javax.annotation.Nullable Category categoryAllOfRefDescription) { + this.categoryAllOfRefDescription = categoryAllOfRefDescription; + } + + + /** + * Adding description to readonly property using allOf + * @return categoryAllOfRefDescriptionReadonly + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY_ALL_OF_REF_DESCRIPTION_READONLY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategoryAllOfRefDescriptionReadonly() { + return categoryAllOfRefDescriptionReadonly; + } + + + + public NewPet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public NewPet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public NewPet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public NewPet tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public NewPet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public NewPet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NewPet instance itself + */ + public NewPet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewPet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" categoryInlineAllof: ").append(toIndentedString(categoryInlineAllof)).append("\n"); + sb.append(" categoryAllOfRef: ").append(toIndentedString(categoryAllOfRef)).append("\n"); + sb.append(" categoryAllOfRefDescription: ").append(toIndentedString(categoryAllOfRefDescription)).append("\n"); + sb.append(" categoryAllOfRefDescriptionReadonly: ").append(toIndentedString(categoryAllOfRefDescriptionReadonly)).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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category_inline_allof", "category_allOf_ref", "category_allOf_ref_description", "category_allOf_ref_description_readonly", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java new file mode 100644 index 000000000000..20d65250a16d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java @@ -0,0 +1,232 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.NewPetCategoryInlineAllofAllOfCategoryTag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NewPetCategoryInlineAllof + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NewPetCategoryInlineAllof.JSON_PROPERTY_ID, + NewPetCategoryInlineAllof.JSON_PROPERTY_NAME, + NewPetCategoryInlineAllof.JSON_PROPERTY_CATEGORY_TAG +}) +@JsonTypeName("NewPet_category_inline_allof") +public class NewPetCategoryInlineAllof { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name = "default-name"; + + public static final String JSON_PROPERTY_CATEGORY_TAG = "category_tag"; + @JsonProperty(JSON_PROPERTY_CATEGORY_TAG) + @javax.annotation.Nullable + private NewPetCategoryInlineAllofAllOfCategoryTag categoryTag; + + public NewPetCategoryInlineAllof() { + } + + public NewPetCategoryInlineAllof id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public NewPetCategoryInlineAllof name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public NewPetCategoryInlineAllof categoryTag(@javax.annotation.Nullable NewPetCategoryInlineAllofAllOfCategoryTag categoryTag) { + this.categoryTag = categoryTag; + return this; + } + + /** + * Get categoryTag + * @return categoryTag + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY_TAG, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public NewPetCategoryInlineAllofAllOfCategoryTag getCategoryTag() { + return categoryTag; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY_TAG, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategoryTag(@javax.annotation.Nullable NewPetCategoryInlineAllofAllOfCategoryTag categoryTag) { + this.categoryTag = categoryTag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NewPetCategoryInlineAllof instance itself + */ + public NewPetCategoryInlineAllof putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewPetCategoryInlineAllof {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" categoryTag: ").append(toIndentedString(categoryTag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name", "category_tag")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java new file mode 100644 index 000000000000..8dc723a2c0f2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NewPetCategoryInlineAllofAllOfCategoryTag + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NewPetCategoryInlineAllofAllOfCategoryTag.JSON_PROPERTY_ID, + NewPetCategoryInlineAllofAllOfCategoryTag.JSON_PROPERTY_NAME +}) +@JsonTypeName("NewPet_category_inline_allof_allOf_category_tag") +public class NewPetCategoryInlineAllofAllOfCategoryTag { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nullable + private String name; + + public NewPetCategoryInlineAllofAllOfCategoryTag() { + } + + public NewPetCategoryInlineAllofAllOfCategoryTag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public NewPetCategoryInlineAllofAllOfCategoryTag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NewPetCategoryInlineAllofAllOfCategoryTag instance itself + */ + public NewPetCategoryInlineAllofAllOfCategoryTag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewPetCategoryInlineAllofAllOfCategoryTag {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java new file mode 100644 index 000000000000..a054631207dc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java @@ -0,0 +1,580 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NullableClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("NullableClass") +public class NullableClass { + public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + @javax.annotation.Nullable + private Integer integerProp; + + public static final String JSON_PROPERTY_NUMBER_PROP = "number_prop"; + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + @javax.annotation.Nullable + private BigDecimal numberProp; + + public static final String JSON_PROPERTY_BOOLEAN_PROP = "boolean_prop"; + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + @javax.annotation.Nullable + private Boolean booleanProp; + + public static final String JSON_PROPERTY_STRING_PROP = "string_prop"; + @JsonProperty(JSON_PROPERTY_STRING_PROP) + @javax.annotation.Nullable + private String stringProp; + + public static final String JSON_PROPERTY_DATE_PROP = "date_prop"; + @JsonProperty(JSON_PROPERTY_DATE_PROP) + @javax.annotation.Nullable + private LocalDate dateProp; + + public static final String JSON_PROPERTY_DATETIME_PROP = "datetime_prop"; + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + @javax.annotation.Nullable + private OffsetDateTime datetimeProp; + + public static final String JSON_PROPERTY_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + @javax.annotation.Nullable + private List arrayNullableProp; + + public static final String JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + @javax.annotation.Nullable + private List arrayAndItemsNullableProp; + + public static final String JSON_PROPERTY_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + @JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE) + @javax.annotation.Nullable + private List arrayItemsNullable = new ArrayList<>(); + + public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + @javax.annotation.Nullable + private Map objectNullableProp; + + public static final String JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + @javax.annotation.Nullable + private Map objectAndItemsNullableProp; + + public static final String JSON_PROPERTY_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + @JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE) + @javax.annotation.Nullable + private Map objectItemsNullable = new HashMap<>(); + + public NullableClass() { + } + + public NullableClass integerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + return this; + } + + /** + * Get integerProp + * @return integerProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_INTEGER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getIntegerProp() { + return integerProp; + } + + @JsonProperty(value = JSON_PROPERTY_INTEGER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setIntegerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + } + + + public NullableClass numberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + return this; + } + + /** + * Get numberProp + * @return numberProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NUMBER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getNumberProp() { + return numberProp; + } + + @JsonProperty(value = JSON_PROPERTY_NUMBER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setNumberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + } + + + public NullableClass booleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + return this; + } + + /** + * Get booleanProp + * @return booleanProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BOOLEAN_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getBooleanProp() { + return booleanProp; + } + + @JsonProperty(value = JSON_PROPERTY_BOOLEAN_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBooleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + } + + + public NullableClass stringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + return this; + } + + /** + * Get stringProp + * @return stringProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STRING_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getStringProp() { + return stringProp; + } + + @JsonProperty(value = JSON_PROPERTY_STRING_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + } + + + public NullableClass dateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + return this; + } + + /** + * Get dateProp + * @return dateProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DATE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public LocalDate getDateProp() { + return dateProp; + } + + @JsonProperty(value = JSON_PROPERTY_DATE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + } + + + public NullableClass datetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DATETIME_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDatetimeProp() { + return datetimeProp; + } + + @JsonProperty(value = JSON_PROPERTY_DATETIME_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDatetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + } + + + public NullableClass arrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + return this; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null) { + this.arrayNullableProp = new ArrayList<>(); + } + this.arrayNullableProp.add(arrayNullablePropItem); + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ARRAY_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayNullableProp() { + return arrayNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + + public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null) { + this.arrayAndItemsNullableProp = new ArrayList<>(); + } + this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem); + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + + public NullableClass arrayItemsNullable(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setArrayItemsNullable(@javax.annotation.Nullable List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + + public NullableClass objectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + return this; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null) { + this.objectNullableProp = new HashMap<>(); + } + this.objectNullableProp.put(key, objectNullablePropItem); + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OBJECT_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getObjectNullableProp() { + return objectNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setObjectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + + public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null) { + this.objectAndItemsNullableProp = new HashMap<>(); + } + this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem); + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public void setObjectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + + public NullableClass objectItemsNullable(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_OBJECT_ITEMS_NULLABLE, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_ITEMS_NULLABLE, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public void setObjectItemsNullable(@javax.annotation.Nullable Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableClass instance itself + */ + public NullableClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableEnum.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableEnum.java new file mode 100644 index 000000000000..ba51d9f2c263 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableEnum.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets NullableEnum + */ +public enum NullableEnum { + + CUSTOM("custom"); + + private String value; + + NullableEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static NullableEnum fromValue(String value) { + for (NullableEnum b : NullableEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java new file mode 100644 index 000000000000..543f6e662bc7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java @@ -0,0 +1,199 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Error response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NullableFieldsMapError.JSON_PROPERTY_STATUS, + NullableFieldsMapError.JSON_PROPERTY_REASON +}) +@JsonTypeName("NullableFieldsMapError") +public class NullableFieldsMapError { + public static final String JSON_PROPERTY_STATUS = "status"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String JSON_PROPERTY_REASON = "reason"; + @JsonProperty(JSON_PROPERTY_REASON) + @javax.annotation.Nonnull + private String reason; + + public NullableFieldsMapError() { + } + + public NullableFieldsMapError status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + + public NullableFieldsMapError reason(@javax.annotation.Nonnull String reason) { + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_REASON, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getReason() { + return reason; + } + + @JsonProperty(value = JSON_PROPERTY_REASON, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setReason(@javax.annotation.Nonnull String reason) { + this.reason = reason; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsMapError instance itself + */ + public NullableFieldsMapError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableFieldsMapError {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("status", "reason")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status", "reason")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java new file mode 100644 index 000000000000..b5d8a78ded81 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java @@ -0,0 +1,216 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsMapError; +import org.openapitools.client.model.NullableFieldsMapSuccess; +import org.openapitools.client.model.NullableFieldsValue; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = NullableFieldsMapResponse.NullableFieldsMapResponseDeserializer.class) +@JsonSerialize(using = NullableFieldsMapResponse.NullableFieldsMapResponseSerializer.class) +public class NullableFieldsMapResponse extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(NullableFieldsMapResponse.class.getName()); + + + public static class NullableFieldsMapResponseSerializer extends StdSerializer { + public NullableFieldsMapResponseSerializer(Class t) { + super(t); + } + + public NullableFieldsMapResponseSerializer() { + this(null); + } + + @Override + public void serialize(NullableFieldsMapResponse value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + public static class NullableFieldsMapResponseDeserializer extends StdDeserializer { + public NullableFieldsMapResponseDeserializer() { + this(NullableFieldsMapResponse.class); + } + + public NullableFieldsMapResponseDeserializer(Class vc) { + super(vc); + } + + @Override + public NullableFieldsMapResponse deserialize(JsonParser jp, DeserializationContext ctxt) throws JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + // deserialize NullableFieldsMapError + try { + deserialized = ctxt.readTreeAsValue(tree, NullableFieldsMapError.class); + NullableFieldsMapResponse ret = new NullableFieldsMapResponse(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'NullableFieldsMapError'", e); + } + + // deserialize NullableFieldsMapSuccess + try { + deserialized = ctxt.readTreeAsValue(tree, NullableFieldsMapSuccess.class); + NullableFieldsMapResponse ret = new NullableFieldsMapResponse(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'NullableFieldsMapSuccess'", e); + } + + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for NullableFieldsMapResponse: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public NullableFieldsMapResponse getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "NullableFieldsMapResponse cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public NullableFieldsMapResponse() { + super("anyOf", Boolean.FALSE); + } + + public NullableFieldsMapResponse(NullableFieldsMapError o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public NullableFieldsMapResponse(NullableFieldsMapSuccess o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("NullableFieldsMapError", NullableFieldsMapError.class); + schemas.put("NullableFieldsMapSuccess", NullableFieldsMapSuccess.class); + JSON.registerDescendants(NullableFieldsMapResponse.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return NullableFieldsMapResponse.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * NullableFieldsMapError, NullableFieldsMapSuccess + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(NullableFieldsMapError.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(NullableFieldsMapSuccess.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be NullableFieldsMapError, NullableFieldsMapSuccess"); + } + + /** + * Get the actual instance, which can be the following: + * NullableFieldsMapError, NullableFieldsMapSuccess + * + * @return The actual instance (NullableFieldsMapError, NullableFieldsMapSuccess) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `NullableFieldsMapError`. If the actual instance is not `NullableFieldsMapError`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `NullableFieldsMapError` + * @throws ClassCastException if the instance is not `NullableFieldsMapError` + */ + public NullableFieldsMapError getNullableFieldsMapError() throws ClassCastException { + return (NullableFieldsMapError)super.getActualInstance(); + } + + /** + * Get the actual instance of `NullableFieldsMapSuccess`. If the actual instance is not `NullableFieldsMapSuccess`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `NullableFieldsMapSuccess` + * @throws ClassCastException if the instance is not `NullableFieldsMapSuccess` + */ + public NullableFieldsMapSuccess getNullableFieldsMapSuccess() throws ClassCastException { + return (NullableFieldsMapSuccess)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java new file mode 100644 index 000000000000..b42100d23ed0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java @@ -0,0 +1,210 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Success response containing a map of objects with nullable fields + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NullableFieldsMapSuccess.JSON_PROPERTY_STATUS, + NullableFieldsMapSuccess.JSON_PROPERTY_POSITIONS +}) +@JsonTypeName("NullableFieldsMapSuccess") +public class NullableFieldsMapSuccess { + public static final String JSON_PROPERTY_STATUS = "status"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String JSON_PROPERTY_POSITIONS = "positions"; + @JsonProperty(JSON_PROPERTY_POSITIONS) + @javax.annotation.Nonnull + private Map positions; + + public NullableFieldsMapSuccess() { + } + + public NullableFieldsMapSuccess status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + + public NullableFieldsMapSuccess positions(@javax.annotation.Nonnull Map positions) { + this.positions = positions; + return this; + } + + public NullableFieldsMapSuccess putPositionsItem(String key, NullableFieldsValue positionsItem) { + if (this.positions == null) { + this.positions = new HashMap<>(); + } + this.positions.put(key, positionsItem); + return this; + } + + /** + * Get positions + * @return positions + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_POSITIONS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Map getPositions() { + return positions; + } + + @JsonProperty(value = JSON_PROPERTY_POSITIONS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPositions(@javax.annotation.Nonnull Map positions) { + this.positions = positions; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsMapSuccess instance itself + */ + public NullableFieldsMapSuccess putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableFieldsMapSuccess {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" positions: ").append(toIndentedString(positions)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("status", "positions")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status", "positions")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsValue.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsValue.java new file mode 100644 index 000000000000..b5773ee48b60 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsValue.java @@ -0,0 +1,199 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with required but nullable string fields + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NullableFieldsValue.JSON_PROPERTY_BEFORE, + NullableFieldsValue.JSON_PROPERTY_AFTER +}) +@JsonTypeName("NullableFieldsValue") +public class NullableFieldsValue { + public static final String JSON_PROPERTY_BEFORE = "before"; + @JsonProperty(JSON_PROPERTY_BEFORE) + @javax.annotation.Nullable + private String before; + + public static final String JSON_PROPERTY_AFTER = "after"; + @JsonProperty(JSON_PROPERTY_AFTER) + @javax.annotation.Nullable + private String after; + + public NullableFieldsValue() { + } + + public NullableFieldsValue before(@javax.annotation.Nullable String before) { + this.before = before; + return this; + } + + /** + * Get before + * @return before + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BEFORE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getBefore() { + return before; + } + + @JsonProperty(value = JSON_PROPERTY_BEFORE, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setBefore(@javax.annotation.Nullable String before) { + this.before = before; + } + + + public NullableFieldsValue after(@javax.annotation.Nullable String after) { + this.after = after; + return this; + } + + /** + * Get after + * @return after + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_AFTER, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAfter() { + return after; + } + + @JsonProperty(value = JSON_PROPERTY_AFTER, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setAfter(@javax.annotation.Nullable String after) { + this.after = after; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsValue instance itself + */ + public NullableFieldsValue putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableFieldsValue {\n"); + sb.append(" before: ").append(toIndentedString(before)).append("\n"); + sb.append(" after: ").append(toIndentedString(after)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("before", "after")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("before", "after")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableShape.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableShape.java new file mode 100644 index 000000000000..5d6c76a215d7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableShape.java @@ -0,0 +1,284 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = NullableShape.NullableShapeDeserializer.class) +@JsonSerialize(using = NullableShape.NullableShapeSerializer.class) +public class NullableShape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(NullableShape.class.getName()); + + + public static class NullableShapeSerializer extends StdSerializer { + public NullableShapeSerializer(Class t) { + super(t); + } + + public NullableShapeSerializer() { + this(null); + } + + @Override + public void serialize(NullableShape value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + 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 JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + NullableShape newNullableShape = new NullableShape(); + String discriminatorValue = tree.path("shapeType").asText(null); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "Quadrilateral": + deserialized = ctxt.readTreeAsValue(tree, Quadrilateral.class); + newNullableShape.setActualInstance(deserialized); + return newNullableShape; + case "Triangle": + deserialized = ctxt.readTreeAsValue(tree, Triangle.class); + newNullableShape.setActualInstance(deserialized); + return newNullableShape; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for NullableShape. Possible values: Quadrilateral Triangle", discriminatorValue)); + } + } + + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize Quadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Quadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + // deserialize Triangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Triangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + if (match == 1) { + NullableShape ret = new NullableShape(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for NullableShape: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public NullableShape getNullValue(DeserializationContext ctxt) { + return null; + } + } + + // store a list of schema names defined in oneOf + public static final 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", Quadrilateral.class); + schemas.put("Triangle", Triangle.class); + JSON.registerDescendants(NullableShape.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Quadrilateral", Quadrilateral.class); + mappings.put("Triangle", Triangle.class); + mappings.put("NullableShape", NullableShape.class); + JSON.registerDiscriminator(NullableShape.class, "shapeType", mappings); + } + + @Override + public Map> getSchemas() { + return NullableShape.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NumberOnly.java new file mode 100644 index 000000000000..586e5afbae94 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.math.BigDecimal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + NumberOnly.JSON_PROPERTY_JUST_NUMBER +}) +@JsonTypeName("NumberOnly") +public class NumberOnly { + public static final String JSON_PROPERTY_JUST_NUMBER = "JustNumber"; + @JsonProperty(JSON_PROPERTY_JUST_NUMBER) + @javax.annotation.Nullable + private BigDecimal justNumber; + + public NumberOnly() { + } + + public NumberOnly justNumber(@javax.annotation.Nullable BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_JUST_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getJustNumber() { + return justNumber; + } + + @JsonProperty(value = JSON_PROPERTY_JUST_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setJustNumber(@javax.annotation.Nullable BigDecimal justNumber) { + this.justNumber = justNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NumberOnly instance itself + */ + public NumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("JustNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java new file mode 100644 index 000000000000..703c21e23c48 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -0,0 +1,289 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.DeprecatedObject; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ObjectWithDeprecatedFields + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ObjectWithDeprecatedFields.JSON_PROPERTY_UUID, + ObjectWithDeprecatedFields.JSON_PROPERTY_ID, + ObjectWithDeprecatedFields.JSON_PROPERTY_DEPRECATED_REF, + ObjectWithDeprecatedFields.JSON_PROPERTY_BARS +}) +@JsonTypeName("ObjectWithDeprecatedFields") +public class ObjectWithDeprecatedFields { + public static final String JSON_PROPERTY_UUID = "uuid"; + @JsonProperty(JSON_PROPERTY_UUID) + @javax.annotation.Nullable + private String uuid; + + public static final String JSON_PROPERTY_ID = "id"; + @Deprecated + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private BigDecimal id; + + public static final String JSON_PROPERTY_DEPRECATED_REF = "deprecatedRef"; + @Deprecated + @JsonProperty(JSON_PROPERTY_DEPRECATED_REF) + @javax.annotation.Nullable + private DeprecatedObject deprecatedRef; + + public static final String JSON_PROPERTY_BARS = "bars"; + @Deprecated + @JsonProperty(JSON_PROPERTY_BARS) + @javax.annotation.Nullable + private List bars = new ArrayList<>(); + + public ObjectWithDeprecatedFields() { + } + + public ObjectWithDeprecatedFields uuid(@javax.annotation.Nullable String uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_UUID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUuid() { + return uuid; + } + + @JsonProperty(value = JSON_PROPERTY_UUID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUuid(@javax.annotation.Nullable String uuid) { + this.uuid = uuid; + } + + + @Deprecated + public ObjectWithDeprecatedFields id(@javax.annotation.Nullable BigDecimal id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getId() { + return id; + } + + @Deprecated + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable BigDecimal id) { + this.id = id; + } + + + @Deprecated + public ObjectWithDeprecatedFields deprecatedRef(@javax.annotation.Nullable DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return this; + } + + /** + * Get deprecatedRef + * @return deprecatedRef + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DEPRECATED_REF, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public DeprecatedObject getDeprecatedRef() { + return deprecatedRef; + } + + @Deprecated + @JsonProperty(value = JSON_PROPERTY_DEPRECATED_REF, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeprecatedRef(@javax.annotation.Nullable DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + } + + + @Deprecated + public ObjectWithDeprecatedFields bars(@javax.annotation.Nullable List bars) { + this.bars = bars; + return this; + } + + public ObjectWithDeprecatedFields addBarsItem(String barsItem) { + if (this.bars == null) { + this.bars = new ArrayList<>(); + } + this.bars.add(barsItem); + return this; + } + + /** + * Get bars + * @return bars + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BARS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getBars() { + return bars; + } + + @Deprecated + @JsonProperty(value = JSON_PROPERTY_BARS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBars(@javax.annotation.Nullable List bars) { + this.bars = bars; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ObjectWithDeprecatedFields instance itself + */ + public ObjectWithDeprecatedFields putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObjectWithDeprecatedFields {\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" deprecatedRef: ").append(toIndentedString(deprecatedRef)).append("\n"); + sb.append(" bars: ").append(toIndentedString(bars)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("uuid", "id", "deprecatedRef", "bars")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..1b4d43394d63 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,362 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.time.OffsetDateTime; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Order + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("Order") +public class Order { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_PET_ID = "petId"; + @JsonProperty(JSON_PROPERTY_PET_ID) + @javax.annotation.Nullable + private Long petId; + + public static final String JSON_PROPERTY_QUANTITY = "quantity"; + @JsonProperty(JSON_PROPERTY_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @javax.annotation.Nullable + 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + @JsonProperty(JSON_PROPERTY_COMPLETE) + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PET_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getPetId() { + return petId; + } + + @JsonProperty(value = JSON_PROPERTY_PET_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_QUANTITY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getQuantity() { + return quantity; + } + + @JsonProperty(value = JSON_PROPERTY_QUANTITY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SHIP_DATE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getShipDate() { + return shipDate; + } + + @JsonProperty(value = JSON_PROPERTY_SHIP_DATE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_COMPLETE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getComplete() { + return complete; + } + + @JsonProperty(value = JSON_PROPERTY_COMPLETE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "petId", "quantity", "shipDate", "status", "complete")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterComposite.java new file mode 100644 index 000000000000..58b0322b87cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -0,0 +1,231 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.math.BigDecimal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OuterComposite + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + OuterComposite.JSON_PROPERTY_MY_NUMBER, + OuterComposite.JSON_PROPERTY_MY_STRING, + OuterComposite.JSON_PROPERTY_MY_BOOLEAN +}) +@JsonTypeName("OuterComposite") +public class OuterComposite { + public static final String JSON_PROPERTY_MY_NUMBER = "my_number"; + @JsonProperty(JSON_PROPERTY_MY_NUMBER) + @javax.annotation.Nullable + private BigDecimal myNumber; + + public static final String JSON_PROPERTY_MY_STRING = "my_string"; + @JsonProperty(JSON_PROPERTY_MY_STRING) + @javax.annotation.Nullable + private String myString; + + public static final String JSON_PROPERTY_MY_BOOLEAN = "my_boolean"; + @JsonProperty(JSON_PROPERTY_MY_BOOLEAN) + @javax.annotation.Nullable + private Boolean myBoolean; + + public OuterComposite() { + } + + public OuterComposite myNumber(@javax.annotation.Nullable BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MY_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getMyNumber() { + return myNumber; + } + + @JsonProperty(value = JSON_PROPERTY_MY_NUMBER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMyNumber(@javax.annotation.Nullable BigDecimal myNumber) { + this.myNumber = myNumber; + } + + + public OuterComposite myString(@javax.annotation.Nullable String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MY_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMyString() { + return myString; + } + + @JsonProperty(value = JSON_PROPERTY_MY_STRING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMyString(@javax.annotation.Nullable String myString) { + this.myString = myString; + } + + + public OuterComposite myBoolean(@javax.annotation.Nullable Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MY_BOOLEAN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMyBoolean() { + return myBoolean; + } + + @JsonProperty(value = JSON_PROPERTY_MY_BOOLEAN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMyBoolean(@javax.annotation.Nullable Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OuterComposite instance itself + */ + public OuterComposite putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("my_number", "my_string", "my_boolean")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnum.java new file mode 100644 index 000000000000..d9a9210f4849 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -0,0 +1,66 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +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"), + + LOWER_CASE_S("s"), + + UPPER_CASE_S("S"); + + 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/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..2566002f1b54 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.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.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +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/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnumInteger.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnumInteger.java new file mode 100644 index 000000000000..f932cd106263 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnumInteger.java @@ -0,0 +1,63 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumInteger + */ +@Deprecated +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/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..81ec9e780ee9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.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.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +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/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ParentPet.java new file mode 100644 index 000000000000..6c270e01feef --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ParentPet.java @@ -0,0 +1,149 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.GrandparentAnimal; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ParentPet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonIgnoreProperties( + value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the pet_type to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true) + +@JsonPropertyOrder({ +}) +@JsonTypeName("ParentPet") +public class ParentPet extends GrandparentAnimal { + public ParentPet() { + this.petType = this.getClass().getSimpleName(); + } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ParentPet instance itself + */ + public ParentPet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParentPet {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(0); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("pet_type")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..80d399a0d3fe --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,382 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("Pet") +public class Pet { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @JsonProperty(JSON_PROPERTY_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @JsonProperty(JSON_PROPERTY_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetComposition.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetComposition.java new file mode 100644 index 000000000000..1279cbfb87fa --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetComposition.java @@ -0,0 +1,382 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetComposition + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + PetComposition.JSON_PROPERTY_ID, + PetComposition.JSON_PROPERTY_CATEGORY, + PetComposition.JSON_PROPERTY_NAME, + PetComposition.JSON_PROPERTY_PHOTO_URLS, + PetComposition.JSON_PROPERTY_TAGS, + PetComposition.JSON_PROPERTY_STATUS +}) +@JsonTypeName("PetComposition") +public class PetComposition { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @JsonProperty(JSON_PROPERTY_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @JsonProperty(JSON_PROPERTY_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetComposition() { + } + + public PetComposition id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetComposition category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetComposition name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PetComposition photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetComposition addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetComposition tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetComposition addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public PetComposition status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetComposition instance itself + */ + public PetComposition putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetComposition {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetRef.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetRef.java new file mode 100644 index 000000000000..0d3d07fd4bb9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetRef.java @@ -0,0 +1,382 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetRef + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + PetRef.JSON_PROPERTY_ID, + PetRef.JSON_PROPERTY_CATEGORY, + PetRef.JSON_PROPERTY_NAME, + PetRef.JSON_PROPERTY_PHOTO_URLS, + PetRef.JSON_PROPERTY_TAGS, + PetRef.JSON_PROPERTY_STATUS +}) +@JsonTypeName("PetRef") +public class PetRef { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @JsonProperty(JSON_PROPERTY_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @JsonProperty(JSON_PROPERTY_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetRef() { + } + + public PetRef id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetRef category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetRef name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PetRef photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetRef addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetRef tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetRef addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public PetRef status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetRef instance itself + */ + public PetRef putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetRef {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetUsingAllOf.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetUsingAllOf.java new file mode 100644 index 000000000000..2109b845074c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetUsingAllOf.java @@ -0,0 +1,382 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetUsingAllOf + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + PetUsingAllOf.JSON_PROPERTY_ID, + PetUsingAllOf.JSON_PROPERTY_CATEGORY, + PetUsingAllOf.JSON_PROPERTY_NAME, + PetUsingAllOf.JSON_PROPERTY_PHOTO_URLS, + PetUsingAllOf.JSON_PROPERTY_TAGS, + PetUsingAllOf.JSON_PROPERTY_STATUS +}) +@JsonTypeName("PetUsingAllOf") +public class PetUsingAllOf { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @JsonProperty(JSON_PROPERTY_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @JsonProperty(JSON_PROPERTY_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetUsingAllOf() { + } + + public PetUsingAllOf id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetUsingAllOf category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * multi line description 2nd line last line + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetUsingAllOf name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PetUsingAllOf photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetUsingAllOf addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetUsingAllOf tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetUsingAllOf addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public PetUsingAllOf status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetUsingAllOf instance itself + */ + public PetUsingAllOf putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetUsingAllOf {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java new file mode 100644 index 000000000000..d662947eddec --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java @@ -0,0 +1,382 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetWithRequiredTags + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + PetWithRequiredTags.JSON_PROPERTY_ID, + PetWithRequiredTags.JSON_PROPERTY_CATEGORY, + PetWithRequiredTags.JSON_PROPERTY_NAME, + PetWithRequiredTags.JSON_PROPERTY_PHOTO_URLS, + PetWithRequiredTags.JSON_PROPERTY_TAGS, + PetWithRequiredTags.JSON_PROPERTY_STATUS +}) +@JsonTypeName("PetWithRequiredTags") +public class PetWithRequiredTags { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @JsonProperty(JSON_PROPERTY_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @JsonProperty(JSON_PROPERTY_TAGS) + @javax.annotation.Nonnull + private List tags = new ArrayList<>(); + + /** + * 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"; + @JsonProperty(JSON_PROPERTY_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetWithRequiredTags() { + } + + public PetWithRequiredTags id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetWithRequiredTags category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + @JsonProperty(value = JSON_PROPERTY_CATEGORY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetWithRequiredTags name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PetWithRequiredTags photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetWithRequiredTags addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + @JsonProperty(value = JSON_PROPERTY_PHOTO_URLS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetWithRequiredTags tags(@javax.annotation.Nonnull List tags) { + this.tags = tags; + return this; + } + + public PetWithRequiredTags addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TAGS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getTags() { + return tags; + } + + @JsonProperty(value = JSON_PROPERTY_TAGS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTags(@javax.annotation.Nonnull List tags) { + this.tags = tags; + } + + + public PetWithRequiredTags status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + @JsonProperty(value = JSON_PROPERTY_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetWithRequiredTags instance itself + */ + public PetWithRequiredTags putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetWithRequiredTags {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls", "tags")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pig.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pig.java new file mode 100644 index 000000000000..424af469ec66 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pig.java @@ -0,0 +1,277 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.DanishPig; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Pig.PigDeserializer.class) +@JsonSerialize(using = Pig.PigSerializer.class) +public class Pig extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Pig.class.getName()); + + + public static class PigSerializer extends StdSerializer { + public PigSerializer(Class t) { + super(t); + } + + public PigSerializer() { + this(null); + } + + @Override + public void serialize(Pig value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + 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 JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + Pig newPig = new Pig(); + String discriminatorValue = tree.path("className").asText(null); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "BasquePig": + deserialized = ctxt.readTreeAsValue(tree, BasquePig.class); + newPig.setActualInstance(deserialized); + return newPig; + case "DanishPig": + deserialized = ctxt.readTreeAsValue(tree, DanishPig.class); + newPig.setActualInstance(deserialized); + return newPig; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Pig. Possible values: BasquePig DanishPig", discriminatorValue)); + } + } + + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize BasquePig + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (BasquePig.class.equals(Integer.class) || BasquePig.class.equals(Long.class) || BasquePig.class.equals(Float.class) || BasquePig.class.equals(Double.class) || BasquePig.class.equals(Boolean.class) || BasquePig.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((BasquePig.class.equals(Integer.class) || BasquePig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((BasquePig.class.equals(Float.class) || BasquePig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (BasquePig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (BasquePig.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, BasquePig.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'BasquePig'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'BasquePig'", e); + } + + // deserialize DanishPig + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DanishPig.class.equals(Integer.class) || DanishPig.class.equals(Long.class) || DanishPig.class.equals(Float.class) || DanishPig.class.equals(Double.class) || DanishPig.class.equals(Boolean.class) || DanishPig.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((DanishPig.class.equals(Integer.class) || DanishPig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((DanishPig.class.equals(Float.class) || DanishPig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (DanishPig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (DanishPig.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, DanishPig.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'DanishPig'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DanishPig'", e); + } + + if (match == 1) { + Pig ret = new Pig(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for Pig: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Pig getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "Pig cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final 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", BasquePig.class); + schemas.put("DanishPig", DanishPig.class); + JSON.registerDescendants(Pig.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("BasquePig", BasquePig.class); + mappings.put("DanishPig", DanishPig.class); + mappings.put("Pig", Pig.class); + JSON.registerDiscriminator(Pig.class, "className", mappings); + } + + @Override + public Map> getSchemas() { + return Pig.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * BasquePig, DanishPig + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(BasquePig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(DanishPig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BasquePig, DanishPig"); + } + + /** + * Get the actual instance, which can be the following: + * BasquePig, DanishPig + * + * @return The actual instance (BasquePig, DanishPig) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BasquePig`. If the actual instance is not `BasquePig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BasquePig` + * @throws ClassCastException if the instance is not `BasquePig` + */ + public BasquePig getBasquePig() throws ClassCastException { + return (BasquePig)super.getActualInstance(); + } + + /** + * Get the actual instance of `DanishPig`. If the actual instance is not `DanishPig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `DanishPig` + * @throws ClassCastException if the instance is not `DanishPig` + */ + public DanishPig getDanishPig() throws ClassCastException { + return (DanishPig)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PropertyNameCollision.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PropertyNameCollision.java new file mode 100644 index 000000000000..b0432b9716dd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PropertyNameCollision.java @@ -0,0 +1,230 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PropertyNameCollision + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + PropertyNameCollision.JSON_PROPERTY_UNDERSCORE_TYPE, + PropertyNameCollision.JSON_PROPERTY_TYPE, + PropertyNameCollision.JSON_PROPERTY_TYPE_WITH_UNDERSCORE +}) +@JsonTypeName("PropertyNameCollision") +public class PropertyNameCollision { + public static final String JSON_PROPERTY_UNDERSCORE_TYPE = "_type"; + @JsonProperty(JSON_PROPERTY_UNDERSCORE_TYPE) + @javax.annotation.Nullable + private String underscoreType; + + public static final String JSON_PROPERTY_TYPE = "type"; + @JsonProperty(JSON_PROPERTY_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String JSON_PROPERTY_TYPE_WITH_UNDERSCORE = "type_"; + @JsonProperty(JSON_PROPERTY_TYPE_WITH_UNDERSCORE) + @javax.annotation.Nullable + private String typeWithUnderscore; + + public PropertyNameCollision() { + } + + public PropertyNameCollision underscoreType(@javax.annotation.Nullable String underscoreType) { + this.underscoreType = underscoreType; + return this; + } + + /** + * Get underscoreType + * @return underscoreType + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_UNDERSCORE_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUnderscoreType() { + return underscoreType; + } + + @JsonProperty(value = JSON_PROPERTY_UNDERSCORE_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUnderscoreType(@javax.annotation.Nullable String underscoreType) { + this.underscoreType = underscoreType; + } + + + public PropertyNameCollision type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public PropertyNameCollision typeWithUnderscore(@javax.annotation.Nullable String typeWithUnderscore) { + this.typeWithUnderscore = typeWithUnderscore; + return this; + } + + /** + * Get typeWithUnderscore + * @return typeWithUnderscore + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TYPE_WITH_UNDERSCORE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getTypeWithUnderscore() { + return typeWithUnderscore; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE_WITH_UNDERSCORE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTypeWithUnderscore(@javax.annotation.Nullable String typeWithUnderscore) { + this.typeWithUnderscore = typeWithUnderscore; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PropertyNameCollision instance itself + */ + public PropertyNameCollision putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertyNameCollision {\n"); + sb.append(" underscoreType: ").append(toIndentedString(underscoreType)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" typeWithUnderscore: ").append(toIndentedString(typeWithUnderscore)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("_type", "type", "type_")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Quadrilateral.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Quadrilateral.java new file mode 100644 index 000000000000..4cc7c6318adf --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Quadrilateral.java @@ -0,0 +1,277 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Quadrilateral.QuadrilateralDeserializer.class) +@JsonSerialize(using = Quadrilateral.QuadrilateralSerializer.class) +public class Quadrilateral extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Quadrilateral.class.getName()); + + + public static class QuadrilateralSerializer extends StdSerializer { + public QuadrilateralSerializer(Class t) { + super(t); + } + + public QuadrilateralSerializer() { + this(null); + } + + @Override + public void serialize(Quadrilateral value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + 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 JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + Quadrilateral newQuadrilateral = new Quadrilateral(); + String discriminatorValue = tree.path("quadrilateralType").asText(null); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "ComplexQuadrilateral": + deserialized = ctxt.readTreeAsValue(tree, ComplexQuadrilateral.class); + newQuadrilateral.setActualInstance(deserialized); + return newQuadrilateral; + case "SimpleQuadrilateral": + deserialized = ctxt.readTreeAsValue(tree, SimpleQuadrilateral.class); + newQuadrilateral.setActualInstance(deserialized); + return newQuadrilateral; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Quadrilateral. Possible values: ComplexQuadrilateral SimpleQuadrilateral", discriminatorValue)); + } + } + + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize ComplexQuadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ComplexQuadrilateral.class.equals(Integer.class) || ComplexQuadrilateral.class.equals(Long.class) || ComplexQuadrilateral.class.equals(Float.class) || ComplexQuadrilateral.class.equals(Double.class) || ComplexQuadrilateral.class.equals(Boolean.class) || ComplexQuadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((ComplexQuadrilateral.class.equals(Integer.class) || ComplexQuadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((ComplexQuadrilateral.class.equals(Float.class) || ComplexQuadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (ComplexQuadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (ComplexQuadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, ComplexQuadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'ComplexQuadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ComplexQuadrilateral'", e); + } + + // deserialize SimpleQuadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SimpleQuadrilateral.class.equals(Integer.class) || SimpleQuadrilateral.class.equals(Long.class) || SimpleQuadrilateral.class.equals(Float.class) || SimpleQuadrilateral.class.equals(Double.class) || SimpleQuadrilateral.class.equals(Boolean.class) || SimpleQuadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((SimpleQuadrilateral.class.equals(Integer.class) || SimpleQuadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((SimpleQuadrilateral.class.equals(Float.class) || SimpleQuadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (SimpleQuadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (SimpleQuadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, SimpleQuadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'SimpleQuadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SimpleQuadrilateral'", e); + } + + if (match == 1) { + Quadrilateral ret = new Quadrilateral(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for Quadrilateral: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Quadrilateral getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "Quadrilateral cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final 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", ComplexQuadrilateral.class); + schemas.put("SimpleQuadrilateral", SimpleQuadrilateral.class); + JSON.registerDescendants(Quadrilateral.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("ComplexQuadrilateral", ComplexQuadrilateral.class); + mappings.put("SimpleQuadrilateral", SimpleQuadrilateral.class); + mappings.put("Quadrilateral", Quadrilateral.class); + JSON.registerDiscriminator(Quadrilateral.class, "quadrilateralType", mappings); + } + + @Override + public Map> getSchemas() { + return Quadrilateral.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * ComplexQuadrilateral, SimpleQuadrilateral + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ComplexQuadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(SimpleQuadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be ComplexQuadrilateral, SimpleQuadrilateral"); + } + + /** + * Get the actual instance, which can be the following: + * ComplexQuadrilateral, SimpleQuadrilateral + * + * @return The actual instance (ComplexQuadrilateral, SimpleQuadrilateral) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ComplexQuadrilateral`. If the actual instance is not `ComplexQuadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ComplexQuadrilateral` + * @throws ClassCastException if the instance is not `ComplexQuadrilateral` + */ + public ComplexQuadrilateral getComplexQuadrilateral() throws ClassCastException { + return (ComplexQuadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `SimpleQuadrilateral`. If the actual instance is not `SimpleQuadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SimpleQuadrilateral` + * @throws ClassCastException if the instance is not `SimpleQuadrilateral` + */ + public SimpleQuadrilateral getSimpleQuadrilateral() throws ClassCastException { + return (SimpleQuadrilateral)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java new file mode 100644 index 000000000000..608e60c73525 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -0,0 +1,168 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * QuadrilateralInterface + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + QuadrilateralInterface.JSON_PROPERTY_QUADRILATERAL_TYPE +}) +@JsonTypeName("QuadrilateralInterface") +public class QuadrilateralInterface { + public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType"; + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @javax.annotation.Nonnull + private String quadrilateralType; + + public QuadrilateralInterface() { + } + + public QuadrilateralInterface quadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setQuadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the QuadrilateralInterface instance itself + */ + public QuadrilateralInterface putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuadrilateralInterface {\n"); + sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("quadrilateralType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("quadrilateralType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..cf9751878072 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -0,0 +1,197 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReadOnlyFirst + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ReadOnlyFirst.JSON_PROPERTY_BAR, + ReadOnlyFirst.JSON_PROPERTY_BAZ +}) +@JsonTypeName("ReadOnlyFirst") +public class ReadOnlyFirst { + public static final String JSON_PROPERTY_BAR = "bar"; + @JsonProperty(JSON_PROPERTY_BAR) + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @javax.annotation.Nullable + private String bar; + + public static final String JSON_PROPERTY_BAZ = "baz"; + @JsonProperty(JSON_PROPERTY_BAZ) + @javax.annotation.Nullable + private String baz; + + public ReadOnlyFirst() { + } + + public ReadOnlyFirst( + String bar + ) { + this(); + this.bar = bar; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BAR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + public ReadOnlyFirst baz(@javax.annotation.Nullable String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BAZ, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBaz() { + return baz; + } + + @JsonProperty(value = JSON_PROPERTY_BAZ, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBaz(@javax.annotation.Nullable String baz) { + this.baz = baz; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ReadOnlyFirst instance itself + */ + public ReadOnlyFirst putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar", "baz")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/RequiredNullableBody.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/RequiredNullableBody.java new file mode 100644 index 000000000000..893a88a35047 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/RequiredNullableBody.java @@ -0,0 +1,662 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.client.model.NullableEnum; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RequiredNullableBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + RequiredNullableBody.JSON_PROPERTY_INTEGER_PROP, + RequiredNullableBody.JSON_PROPERTY_NUMBER_PROP, + RequiredNullableBody.JSON_PROPERTY_BOOLEAN_PROP, + RequiredNullableBody.JSON_PROPERTY_STRING_PROP, + RequiredNullableBody.JSON_PROPERTY_DATE_PROP, + RequiredNullableBody.JSON_PROPERTY_DATETIME_PROP, + RequiredNullableBody.JSON_PROPERTY_ARRAY_NULLABLE_PROP, + RequiredNullableBody.JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, + RequiredNullableBody.JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, + RequiredNullableBody.JSON_PROPERTY_OBJECT_NULLABLE_PROP, + RequiredNullableBody.JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, + RequiredNullableBody.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE, + RequiredNullableBody.JSON_PROPERTY_CUSTOM_REF_ENUM, + RequiredNullableBody.JSON_PROPERTY_CUSTOM_ENUM +}) +@JsonTypeName("RequiredNullableBody") +public class RequiredNullableBody { + public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + @javax.annotation.Nullable + private Integer integerProp; + + public static final String JSON_PROPERTY_NUMBER_PROP = "number_prop"; + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + @javax.annotation.Nullable + private BigDecimal numberProp; + + public static final String JSON_PROPERTY_BOOLEAN_PROP = "boolean_prop"; + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + @javax.annotation.Nullable + private Boolean booleanProp; + + public static final String JSON_PROPERTY_STRING_PROP = "string_prop"; + @JsonProperty(JSON_PROPERTY_STRING_PROP) + @javax.annotation.Nullable + private String stringProp; + + public static final String JSON_PROPERTY_DATE_PROP = "date_prop"; + @JsonProperty(JSON_PROPERTY_DATE_PROP) + @javax.annotation.Nullable + private LocalDate dateProp; + + public static final String JSON_PROPERTY_DATETIME_PROP = "datetime_prop"; + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + @javax.annotation.Nullable + private OffsetDateTime datetimeProp; + + public static final String JSON_PROPERTY_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + @javax.annotation.Nullable + private List arrayNullableProp; + + public static final String JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + @javax.annotation.Nullable + private List arrayAndItemsNullableProp; + + public static final String JSON_PROPERTY_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + @JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE) + @javax.annotation.Nonnull + private List arrayItemsNullable = new ArrayList<>(); + + public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + @javax.annotation.Nullable + private Map objectNullableProp; + + public static final String JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + @javax.annotation.Nullable + private Map objectAndItemsNullableProp; + + public static final String JSON_PROPERTY_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + @JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE) + @javax.annotation.Nonnull + private Map objectItemsNullable = new HashMap<>(); + + public static final String JSON_PROPERTY_CUSTOM_REF_ENUM = "custom_ref_enum"; + @JsonProperty(JSON_PROPERTY_CUSTOM_REF_ENUM) + @javax.annotation.Nullable + private NullableEnum customRefEnum; + + /** + * Gets or Sets customEnum + */ + public enum CustomEnumEnum { + CUSTOM("custom"); + + private String value; + + CustomEnumEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static CustomEnumEnum fromValue(String value) { + for (CustomEnumEnum b : CustomEnumEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + } + + public static final String JSON_PROPERTY_CUSTOM_ENUM = "custom_enum"; + @JsonProperty(JSON_PROPERTY_CUSTOM_ENUM) + @javax.annotation.Nullable + private CustomEnumEnum customEnum; + + public RequiredNullableBody() { + } + + public RequiredNullableBody integerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + return this; + } + + /** + * Get integerProp + * @return integerProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_INTEGER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getIntegerProp() { + return integerProp; + } + + @JsonProperty(value = JSON_PROPERTY_INTEGER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setIntegerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + } + + + public RequiredNullableBody numberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + return this; + } + + /** + * Get numberProp + * @return numberProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NUMBER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumberProp() { + return numberProp; + } + + @JsonProperty(value = JSON_PROPERTY_NUMBER_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNumberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + } + + + public RequiredNullableBody booleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + return this; + } + + /** + * Get booleanProp + * @return booleanProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BOOLEAN_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Boolean getBooleanProp() { + return booleanProp; + } + + @JsonProperty(value = JSON_PROPERTY_BOOLEAN_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setBooleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + } + + + public RequiredNullableBody stringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + return this; + } + + /** + * Get stringProp + * @return stringProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_STRING_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getStringProp() { + return stringProp; + } + + @JsonProperty(value = JSON_PROPERTY_STRING_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + } + + + public RequiredNullableBody dateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + return this; + } + + /** + * Get dateProp + * @return dateProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DATE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public LocalDate getDateProp() { + return dateProp; + } + + @JsonProperty(value = JSON_PROPERTY_DATE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setDateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + } + + + public RequiredNullableBody datetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DATETIME_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public OffsetDateTime getDatetimeProp() { + return datetimeProp; + } + + @JsonProperty(value = JSON_PROPERTY_DATETIME_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setDatetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + } + + + public RequiredNullableBody arrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + return this; + } + + public RequiredNullableBody addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null) { + this.arrayNullableProp = new ArrayList<>(); + } + this.arrayNullableProp.add(arrayNullablePropItem); + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ARRAY_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getArrayNullableProp() { + return arrayNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setArrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + + public RequiredNullableBody arrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + + public RequiredNullableBody addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null) { + this.arrayAndItemsNullableProp = new ArrayList<>(); + } + this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem); + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setArrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + + public RequiredNullableBody arrayItemsNullable(@javax.annotation.Nonnull List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + public RequiredNullableBody addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<>(); + } + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + /** + * Get arrayItemsNullable + * @return arrayItemsNullable + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + @JsonProperty(value = JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setArrayItemsNullable(@javax.annotation.Nonnull List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + + public RequiredNullableBody objectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + return this; + } + + public RequiredNullableBody putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null) { + this.objectNullableProp = new HashMap<>(); + } + this.objectNullableProp.put(key, objectNullablePropItem); + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OBJECT_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Map getObjectNullableProp() { + return objectNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_NULLABLE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setObjectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + + public RequiredNullableBody objectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + + public RequiredNullableBody putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null) { + this.objectAndItemsNullableProp = new HashMap<>(); + } + this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem); + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.ALWAYS) + + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.ALWAYS) + public void setObjectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + + public RequiredNullableBody objectItemsNullable(@javax.annotation.Nonnull Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + return this; + } + + public RequiredNullableBody 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.Nonnull + @JsonProperty(value = JSON_PROPERTY_OBJECT_ITEMS_NULLABLE, required = true) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.ALWAYS) + + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_ITEMS_NULLABLE, required = true) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.ALWAYS) + public void setObjectItemsNullable(@javax.annotation.Nonnull Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + + public RequiredNullableBody customRefEnum(@javax.annotation.Nullable NullableEnum customRefEnum) { + this.customRefEnum = customRefEnum; + return this; + } + + /** + * Get customRefEnum + * @return customRefEnum + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CUSTOM_REF_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public NullableEnum getCustomRefEnum() { + return customRefEnum; + } + + @JsonProperty(value = JSON_PROPERTY_CUSTOM_REF_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCustomRefEnum(@javax.annotation.Nullable NullableEnum customRefEnum) { + this.customRefEnum = customRefEnum; + } + + + public RequiredNullableBody customEnum(@javax.annotation.Nullable CustomEnumEnum customEnum) { + this.customEnum = customEnum; + return this; + } + + /** + * Get customEnum + * @return customEnum + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CUSTOM_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public CustomEnumEnum getCustomEnum() { + return customEnum; + } + + @JsonProperty(value = JSON_PROPERTY_CUSTOM_ENUM, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setCustomEnum(@javax.annotation.Nullable CustomEnumEnum customEnum) { + this.customEnum = customEnum; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RequiredNullableBody instance itself + */ + public RequiredNullableBody putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequiredNullableBody {\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(" customRefEnum: ").append(toIndentedString(customRefEnum)).append("\n"); + sb.append(" customEnum: ").append(toIndentedString(customEnum)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable", "custom_ref_enum", "custom_enum")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable", "custom_ref_enum", "custom_enum")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Scalar.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Scalar.java new file mode 100644 index 000000000000..de04a61dad37 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Scalar.java @@ -0,0 +1,343 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import java.util.UUID; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Scalar.ScalarDeserializer.class) +@JsonSerialize(using = Scalar.ScalarSerializer.class) +public class Scalar extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Scalar.class.getName()); + + + public static class ScalarSerializer extends StdSerializer { + public ScalarSerializer(Class t) { + super(t); + } + + public ScalarSerializer() { + this(null); + } + + @Override + public void serialize(Scalar value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + public static class ScalarDeserializer extends StdDeserializer { + public ScalarDeserializer() { + this(Scalar.class); + } + + public ScalarDeserializer(Class vc) { + super(vc); + } + + @Override + public Scalar deserialize(JsonParser jp, DeserializationContext ctxt) throws JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize BigDecimal + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (BigDecimal.class.equals(Integer.class) || BigDecimal.class.equals(Long.class) || BigDecimal.class.equals(Float.class) || BigDecimal.class.equals(Double.class) || BigDecimal.class.equals(Boolean.class) || BigDecimal.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((BigDecimal.class.equals(Integer.class) || BigDecimal.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((BigDecimal.class.equals(Float.class) || BigDecimal.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (BigDecimal.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (BigDecimal.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, BigDecimal.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'BigDecimal'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'BigDecimal'", e); + } + + // deserialize Boolean + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Boolean.class.equals(Integer.class) || Boolean.class.equals(Long.class) || Boolean.class.equals(Float.class) || Boolean.class.equals(Double.class) || Boolean.class.equals(Boolean.class) || Boolean.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Boolean.class.equals(Integer.class) || Boolean.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Boolean.class.equals(Float.class) || Boolean.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Boolean.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Boolean.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Boolean.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Boolean'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Boolean'", e); + } + + // deserialize String + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (String.class.equals(Integer.class) || String.class.equals(Long.class) || String.class.equals(Float.class) || String.class.equals(Double.class) || String.class.equals(Boolean.class) || String.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((String.class.equals(Integer.class) || String.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((String.class.equals(Float.class) || String.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (String.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (String.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, String.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize UUID + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (UUID.class.equals(Integer.class) || UUID.class.equals(Long.class) || UUID.class.equals(Float.class) || UUID.class.equals(Double.class) || UUID.class.equals(Boolean.class) || UUID.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((UUID.class.equals(Integer.class) || UUID.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((UUID.class.equals(Float.class) || UUID.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (UUID.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (UUID.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, UUID.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'UUID'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'UUID'", e); + } + + if (match == 1) { + Scalar ret = new Scalar(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for Scalar: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Scalar getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "Scalar cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Scalar() { + super("oneOf", Boolean.FALSE); + } + + public Scalar(BigDecimal o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Scalar(Boolean o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Scalar(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Scalar(UUID o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("BigDecimal", BigDecimal.class); + schemas.put("Boolean", Boolean.class); + schemas.put("String", String.class); + schemas.put("UUID", UUID.class); + JSON.registerDescendants(Scalar.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return Scalar.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * BigDecimal, Boolean, String, UUID + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(BigDecimal.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Boolean.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UUID.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BigDecimal, Boolean, String, UUID"); + } + + /** + * Get the actual instance, which can be the following: + * BigDecimal, Boolean, String, UUID + * + * @return The actual instance (BigDecimal, Boolean, String, UUID) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BigDecimal`. If the actual instance is not `BigDecimal`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BigDecimal` + * @throws ClassCastException if the instance is not `BigDecimal` + */ + public BigDecimal getBigDecimal() throws ClassCastException { + return (BigDecimal)super.getActualInstance(); + } + + /** + * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Boolean` + * @throws ClassCastException if the instance is not `Boolean` + */ + public Boolean getBoolean() throws ClassCastException { + return (Boolean)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + /** + * Get the actual instance of `UUID`. If the actual instance is not `UUID`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UUID` + * @throws ClassCastException if the instance is not `UUID` + */ + public UUID getUUID() throws ClassCastException { + return (UUID)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScalarAnyOf.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScalarAnyOf.java new file mode 100644 index 000000000000..6edae4af3417 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScalarAnyOf.java @@ -0,0 +1,275 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import java.util.UUID; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = ScalarAnyOf.ScalarAnyOfDeserializer.class) +@JsonSerialize(using = ScalarAnyOf.ScalarAnyOfSerializer.class) +public class ScalarAnyOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ScalarAnyOf.class.getName()); + + + public static class ScalarAnyOfSerializer extends StdSerializer { + public ScalarAnyOfSerializer(Class t) { + super(t); + } + + public ScalarAnyOfSerializer() { + this(null); + } + + @Override + public void serialize(ScalarAnyOf value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + public static class ScalarAnyOfDeserializer extends StdDeserializer { + public ScalarAnyOfDeserializer() { + this(ScalarAnyOf.class); + } + + public ScalarAnyOfDeserializer(Class vc) { + super(vc); + } + + @Override + public ScalarAnyOf deserialize(JsonParser jp, DeserializationContext ctxt) throws JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + // deserialize BigDecimal + try { + deserialized = ctxt.readTreeAsValue(tree, BigDecimal.class); + ScalarAnyOf ret = new ScalarAnyOf(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'BigDecimal'", e); + } + + // deserialize Boolean + try { + deserialized = ctxt.readTreeAsValue(tree, Boolean.class); + ScalarAnyOf ret = new ScalarAnyOf(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Boolean'", e); + } + + // deserialize String + try { + deserialized = ctxt.readTreeAsValue(tree, String.class); + ScalarAnyOf ret = new ScalarAnyOf(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize UUID + try { + deserialized = ctxt.readTreeAsValue(tree, UUID.class); + ScalarAnyOf ret = new ScalarAnyOf(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'UUID'", e); + } + + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for ScalarAnyOf: no match found")); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public ScalarAnyOf getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "ScalarAnyOf cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public ScalarAnyOf() { + super("anyOf", Boolean.FALSE); + } + + public ScalarAnyOf(BigDecimal o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarAnyOf(Boolean o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarAnyOf(String o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarAnyOf(UUID o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("BigDecimal", BigDecimal.class); + schemas.put("Boolean", Boolean.class); + schemas.put("String", String.class); + schemas.put("UUID", UUID.class); + JSON.registerDescendants(ScalarAnyOf.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return ScalarAnyOf.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * BigDecimal, Boolean, String, UUID + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(BigDecimal.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Boolean.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UUID.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BigDecimal, Boolean, String, UUID"); + } + + /** + * Get the actual instance, which can be the following: + * BigDecimal, Boolean, String, UUID + * + * @return The actual instance (BigDecimal, Boolean, String, UUID) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BigDecimal`. If the actual instance is not `BigDecimal`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BigDecimal` + * @throws ClassCastException if the instance is not `BigDecimal` + */ + public BigDecimal getBigDecimal() throws ClassCastException { + return (BigDecimal)super.getActualInstance(); + } + + /** + * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Boolean` + * @throws ClassCastException if the instance is not `Boolean` + */ + public Boolean getBoolean() throws ClassCastException { + return (Boolean)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + /** + * Get the actual instance of `UUID`. If the actual instance is not `UUID`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UUID` + * @throws ClassCastException if the instance is not `UUID` + */ + public UUID getUUID() throws ClassCastException { + return (UUID)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java new file mode 100644 index 000000000000..08c3cc3d58ed --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -0,0 +1,199 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ScaleneTriangle + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ScaleneTriangle.JSON_PROPERTY_SHAPE_TYPE, + ScaleneTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) +@JsonTypeName("ScaleneTriangle") +public class ScaleneTriangle { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @javax.annotation.Nonnull + private String triangleType; + + public ScaleneTriangle() { + } + + public ScaleneTriangle shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public ScaleneTriangle triangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTriangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ScaleneTriangle instance itself + */ + public ScaleneTriangle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Shape.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Shape.java new file mode 100644 index 000000000000..31f573929840 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Shape.java @@ -0,0 +1,277 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Shape.ShapeDeserializer.class) +@JsonSerialize(using = Shape.ShapeSerializer.class) +public class Shape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Shape.class.getName()); + + + public static class ShapeSerializer extends StdSerializer { + public ShapeSerializer(Class t) { + super(t); + } + + public ShapeSerializer() { + this(null); + } + + @Override + public void serialize(Shape value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + 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 JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + Shape newShape = new Shape(); + String discriminatorValue = tree.path("shapeType").asText(null); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "Quadrilateral": + deserialized = ctxt.readTreeAsValue(tree, Quadrilateral.class); + newShape.setActualInstance(deserialized); + return newShape; + case "Triangle": + deserialized = ctxt.readTreeAsValue(tree, Triangle.class); + newShape.setActualInstance(deserialized); + return newShape; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Shape. Possible values: Quadrilateral Triangle", discriminatorValue)); + } + } + + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize Quadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Quadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + // deserialize Triangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Triangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + if (match == 1) { + Shape ret = new Shape(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for Shape: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Shape getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "Shape cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final 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", Quadrilateral.class); + schemas.put("Triangle", Triangle.class); + JSON.registerDescendants(Shape.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Quadrilateral", Quadrilateral.class); + mappings.put("Triangle", Triangle.class); + mappings.put("Shape", Shape.class); + JSON.registerDiscriminator(Shape.class, "shapeType", mappings); + } + + @Override + public Map> getSchemas() { + return Shape.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeInterface.java new file mode 100644 index 000000000000..12671e3e37cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -0,0 +1,168 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ShapeInterface + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + ShapeInterface.JSON_PROPERTY_SHAPE_TYPE +}) +@JsonTypeName("ShapeInterface") +public class ShapeInterface { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public ShapeInterface() { + } + + public ShapeInterface shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ShapeInterface instance itself + */ + public ShapeInterface putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShapeInterface {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeOrNull.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeOrNull.java new file mode 100644 index 000000000000..d1521a0f102e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeOrNull.java @@ -0,0 +1,284 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = ShapeOrNull.ShapeOrNullDeserializer.class) +@JsonSerialize(using = ShapeOrNull.ShapeOrNullSerializer.class) +public class ShapeOrNull extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ShapeOrNull.class.getName()); + + + public static class ShapeOrNullSerializer extends StdSerializer { + public ShapeOrNullSerializer(Class t) { + super(t); + } + + public ShapeOrNullSerializer() { + this(null); + } + + @Override + public void serialize(ShapeOrNull value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + 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 JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + ShapeOrNull newShapeOrNull = new ShapeOrNull(); + String discriminatorValue = tree.path("shapeType").asText(null); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "Quadrilateral": + deserialized = ctxt.readTreeAsValue(tree, Quadrilateral.class); + newShapeOrNull.setActualInstance(deserialized); + return newShapeOrNull; + case "Triangle": + deserialized = ctxt.readTreeAsValue(tree, Triangle.class); + newShapeOrNull.setActualInstance(deserialized); + return newShapeOrNull; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for ShapeOrNull. Possible values: Quadrilateral Triangle", discriminatorValue)); + } + } + + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize Quadrilateral + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Quadrilateral.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + // deserialize Triangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Triangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + if (match == 1) { + ShapeOrNull ret = new ShapeOrNull(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for ShapeOrNull: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public ShapeOrNull getNullValue(DeserializationContext ctxt) { + return null; + } + } + + // store a list of schema names defined in oneOf + public static final 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", Quadrilateral.class); + schemas.put("Triangle", Triangle.class); + JSON.registerDescendants(ShapeOrNull.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Quadrilateral", Quadrilateral.class); + mappings.put("Triangle", Triangle.class); + mappings.put("ShapeOrNull", ShapeOrNull.class); + JSON.registerDiscriminator(ShapeOrNull.class, "shapeType", mappings); + } + + @Override + public Map> getSchemas() { + return ShapeOrNull.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java new file mode 100644 index 000000000000..c798b2e49a6f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -0,0 +1,199 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SimpleQuadrilateral + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + SimpleQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, + SimpleQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE +}) +@JsonTypeName("SimpleQuadrilateral") +public class SimpleQuadrilateral { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType"; + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @javax.annotation.Nonnull + private String quadrilateralType; + + public SimpleQuadrilateral() { + } + + public SimpleQuadrilateral shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + @JsonProperty(value = JSON_PROPERTY_SHAPE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public SimpleQuadrilateral quadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + @JsonProperty(value = JSON_PROPERTY_QUADRILATERAL_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setQuadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SimpleQuadrilateral instance itself + */ + public SimpleQuadrilateral putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SpecialModelName.java new file mode 100644 index 000000000000..52bfceee2175 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SpecialModelName + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME, + SpecialModelName.JSON_PROPERTY_SPECIAL_MODEL_NAME +}) +@JsonTypeName("_special_model.name_") +public class SpecialModelName { + public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + @JsonProperty(JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME) + @javax.annotation.Nullable + private Long $specialPropertyName; + + public static final String JSON_PROPERTY_SPECIAL_MODEL_NAME = "_special_model.name_"; + @JsonProperty(JSON_PROPERTY_SPECIAL_MODEL_NAME) + @javax.annotation.Nullable + private String specialModelName; + + public SpecialModelName() { + } + + public SpecialModelName $specialPropertyName(@javax.annotation.Nullable Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + @JsonProperty(value = JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void set$SpecialPropertyName(@javax.annotation.Nullable Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + public SpecialModelName specialModelName(@javax.annotation.Nullable String specialModelName) { + this.specialModelName = specialModelName; + return this; + } + + /** + * Get specialModelName + * @return specialModelName + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SPECIAL_MODEL_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSpecialModelName() { + return specialModelName; + } + + @JsonProperty(value = JSON_PROPERTY_SPECIAL_MODEL_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSpecialModelName(@javax.annotation.Nullable String specialModelName) { + this.specialModelName = specialModelName; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SpecialModelName instance itself + */ + public SpecialModelName putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append(" specialModelName: ").append(toIndentedString(specialModelName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("$special[property.name]", "_special_model.name_")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..b93a61a4970e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,199 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Tag + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) +@JsonTypeName("Tag") +public class Tag { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java new file mode 100644 index 000000000000..85b52d505172 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -0,0 +1,169 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TestInlineFreeformAdditionalPropertiesRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + TestInlineFreeformAdditionalPropertiesRequest.JSON_PROPERTY_SOME_PROPERTY +}) +@JsonTypeName("testInlineFreeformAdditionalProperties_request") +public class TestInlineFreeformAdditionalPropertiesRequest { + public static final String JSON_PROPERTY_SOME_PROPERTY = "someProperty"; + @JsonProperty(JSON_PROPERTY_SOME_PROPERTY) + @javax.annotation.Nullable + private String someProperty; + + public TestInlineFreeformAdditionalPropertiesRequest() { + } + + public TestInlineFreeformAdditionalPropertiesRequest someProperty(@javax.annotation.Nullable String someProperty) { + this.someProperty = someProperty; + return this; + } + + /** + * Get someProperty + * @return someProperty + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SOME_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSomeProperty() { + return someProperty; + } + + @JsonProperty(value = JSON_PROPERTY_SOME_PROPERTY, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeProperty(@javax.annotation.Nullable String someProperty) { + this.someProperty = someProperty; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TestInlineFreeformAdditionalPropertiesRequest instance itself + */ + public TestInlineFreeformAdditionalPropertiesRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); + sb.append(" someProperty: ").append(toIndentedString(someProperty)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("someProperty")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Triangle.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Triangle.java new file mode 100644 index 000000000000..e3d271244b7b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Triangle.java @@ -0,0 +1,331 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.EquilateralTriangle; +import org.openapitools.client.model.IsoscelesTriangle; +import org.openapitools.client.model.ScaleneTriangle; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Triangle.TriangleDeserializer.class) +@JsonSerialize(using = Triangle.TriangleSerializer.class) +public class Triangle extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Triangle.class.getName()); + + + public static class TriangleSerializer extends StdSerializer { + public TriangleSerializer(Class t) { + super(t); + } + + public TriangleSerializer() { + this(null); + } + + @Override + public void serialize(Triangle value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + 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 JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + Triangle newTriangle = new Triangle(); + String discriminatorValue = tree.path("triangleType").asText(null); + if (discriminatorValue != null) { + switch (discriminatorValue) { + case "EquilateralTriangle": + deserialized = ctxt.readTreeAsValue(tree, EquilateralTriangle.class); + newTriangle.setActualInstance(deserialized); + return newTriangle; + case "IsoscelesTriangle": + deserialized = ctxt.readTreeAsValue(tree, IsoscelesTriangle.class); + newTriangle.setActualInstance(deserialized); + return newTriangle; + case "ScaleneTriangle": + deserialized = ctxt.readTreeAsValue(tree, ScaleneTriangle.class); + newTriangle.setActualInstance(deserialized); + return newTriangle; + default: + log.log(Level.WARNING, String.format(java.util.Locale.ROOT, "Failed to lookup discriminator value `%s` for Triangle. Possible values: EquilateralTriangle IsoscelesTriangle ScaleneTriangle", discriminatorValue)); + } + } + + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize EquilateralTriangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (EquilateralTriangle.class.equals(Integer.class) || EquilateralTriangle.class.equals(Long.class) || EquilateralTriangle.class.equals(Float.class) || EquilateralTriangle.class.equals(Double.class) || EquilateralTriangle.class.equals(Boolean.class) || EquilateralTriangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((EquilateralTriangle.class.equals(Integer.class) || EquilateralTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((EquilateralTriangle.class.equals(Float.class) || EquilateralTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (EquilateralTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (EquilateralTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, EquilateralTriangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'EquilateralTriangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'EquilateralTriangle'", e); + } + + // deserialize IsoscelesTriangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (IsoscelesTriangle.class.equals(Integer.class) || IsoscelesTriangle.class.equals(Long.class) || IsoscelesTriangle.class.equals(Float.class) || IsoscelesTriangle.class.equals(Double.class) || IsoscelesTriangle.class.equals(Boolean.class) || IsoscelesTriangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((IsoscelesTriangle.class.equals(Integer.class) || IsoscelesTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((IsoscelesTriangle.class.equals(Float.class) || IsoscelesTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (IsoscelesTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (IsoscelesTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, IsoscelesTriangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'IsoscelesTriangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'IsoscelesTriangle'", e); + } + + // deserialize ScaleneTriangle + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ScaleneTriangle.class.equals(Integer.class) || ScaleneTriangle.class.equals(Long.class) || ScaleneTriangle.class.equals(Float.class) || ScaleneTriangle.class.equals(Double.class) || ScaleneTriangle.class.equals(Boolean.class) || ScaleneTriangle.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((ScaleneTriangle.class.equals(Integer.class) || ScaleneTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((ScaleneTriangle.class.equals(Float.class) || ScaleneTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (ScaleneTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (ScaleneTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, ScaleneTriangle.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'ScaleneTriangle'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ScaleneTriangle'", e); + } + + if (match == 1) { + Triangle ret = new Triangle(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for Triangle: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Triangle getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "Triangle cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final 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", EquilateralTriangle.class); + schemas.put("IsoscelesTriangle", IsoscelesTriangle.class); + schemas.put("ScaleneTriangle", ScaleneTriangle.class); + JSON.registerDescendants(Triangle.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("EquilateralTriangle", EquilateralTriangle.class); + mappings.put("IsoscelesTriangle", IsoscelesTriangle.class); + mappings.put("ScaleneTriangle", ScaleneTriangle.class); + mappings.put("Triangle", Triangle.class); + JSON.registerDiscriminator(Triangle.class, "triangleType", mappings); + } + + @Override + public Map> getSchemas() { + return Triangle.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(EquilateralTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(IsoscelesTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(ScaleneTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle"); + } + + /** + * Get the actual instance, which can be the following: + * EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle + * + * @return The actual instance (EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `EquilateralTriangle`. If the actual instance is not `EquilateralTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EquilateralTriangle` + * @throws ClassCastException if the instance is not `EquilateralTriangle` + */ + public EquilateralTriangle getEquilateralTriangle() throws ClassCastException { + return (EquilateralTriangle)super.getActualInstance(); + } + + /** + * Get the actual instance of `IsoscelesTriangle`. If the actual instance is not `IsoscelesTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `IsoscelesTriangle` + * @throws ClassCastException if the instance is not `IsoscelesTriangle` + */ + public IsoscelesTriangle getIsoscelesTriangle() throws ClassCastException { + return (IsoscelesTriangle)super.getActualInstance(); + } + + /** + * Get the actual instance of `ScaleneTriangle`. If the actual instance is not `ScaleneTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ScaleneTriangle` + * @throws ClassCastException if the instance is not `ScaleneTriangle` + */ + public ScaleneTriangle getScaleneTriangle() throws ClassCastException { + return (ScaleneTriangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TriangleInterface.java new file mode 100644 index 000000000000..6c38cb508ddd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -0,0 +1,168 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TriangleInterface + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + TriangleInterface.JSON_PROPERTY_TRIANGLE_TYPE +}) +@JsonTypeName("TriangleInterface") +public class TriangleInterface { + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @javax.annotation.Nonnull + private String triangleType; + + public TriangleInterface() { + } + + public TriangleInterface triangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + @JsonProperty(value = JSON_PROPERTY_TRIANGLE_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTriangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TriangleInterface instance itself + */ + public TriangleInterface putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TriangleInterface {\n"); + sb.append(" triangleType: ").append(toIndentedString(triangleType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("triangleType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..9f25b199834b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,524 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * User + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@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 +}) +@JsonTypeName("User") +public class User { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + @javax.annotation.Nullable + private Long id; + + public static final String JSON_PROPERTY_USERNAME = "username"; + @JsonProperty(JSON_PROPERTY_USERNAME) + @javax.annotation.Nullable + private String username; + + public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @javax.annotation.Nullable + private String firstName; + + public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @javax.annotation.Nullable + private String lastName; + + public static final String JSON_PROPERTY_EMAIL = "email"; + @JsonProperty(JSON_PROPERTY_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + @JsonProperty(JSON_PROPERTY_PASSWORD) + @javax.annotation.Nullable + private String password; + + public static final String JSON_PROPERTY_PHONE = "phone"; + @JsonProperty(JSON_PROPERTY_PHONE) + @javax.annotation.Nullable + private String phone; + + public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @javax.annotation.Nullable + private Integer userStatus; + + public static final String JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS = "objectWithNoDeclaredProps"; + @JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS) + @javax.annotation.Nullable + private Object objectWithNoDeclaredProps; + + public static final String JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE = "objectWithNoDeclaredPropsNullable"; + @JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE) + @javax.annotation.Nullable + private Object objectWithNoDeclaredPropsNullable; + + public static final String JSON_PROPERTY_ANY_TYPE_PROP = "anyTypeProp"; + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP) + @javax.annotation.Nullable + private Object anyTypeProp = null; + + public static final String JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE = "anyTypePropNullable"; + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE) + @javax.annotation.Nullable + private Object anyTypePropNullable = null; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_USERNAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUsername() { + return username; + } + + @JsonProperty(value = JSON_PROPERTY_USERNAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_FIRST_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getFirstName() { + return firstName; + } + + @JsonProperty(value = JSON_PROPERTY_FIRST_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_LAST_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getLastName() { + return lastName; + } + + @JsonProperty(value = JSON_PROPERTY_LAST_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_EMAIL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getEmail() { + return email; + } + + @JsonProperty(value = JSON_PROPERTY_EMAIL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PASSWORD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPassword() { + return password; + } + + @JsonProperty(value = JSON_PROPERTY_PASSWORD, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PHONE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPhone() { + return phone; + } + + @JsonProperty(value = JSON_PROPERTY_PHONE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_USER_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getUserStatus() { + return userStatus; + } + + @JsonProperty(value = JSON_PROPERTY_USER_STATUS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + + public User objectWithNoDeclaredProps(@javax.annotation.Nullable 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 + @JsonProperty(value = JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getObjectWithNoDeclaredProps() { + return objectWithNoDeclaredProps; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setObjectWithNoDeclaredProps(@javax.annotation.Nullable Object objectWithNoDeclaredProps) { + this.objectWithNoDeclaredProps = objectWithNoDeclaredProps; + } + + + public User objectWithNoDeclaredPropsNullable(@javax.annotation.Nullable Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = 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 + @JsonProperty(value = JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getObjectWithNoDeclaredPropsNullable() { + return objectWithNoDeclaredPropsNullable; + } + + @JsonProperty(value = JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setObjectWithNoDeclaredPropsNullable(@javax.annotation.Nullable Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + } + + + public User anyTypeProp(@javax.annotation.Nullable Object anyTypeProp) { + this.anyTypeProp = 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 + @JsonProperty(value = JSON_PROPERTY_ANY_TYPE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getAnyTypeProp() { + return anyTypeProp; + } + + @JsonProperty(value = JSON_PROPERTY_ANY_TYPE_PROP, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAnyTypeProp(@javax.annotation.Nullable Object anyTypeProp) { + this.anyTypeProp = anyTypeProp; + } + + + public User anyTypePropNullable(@javax.annotation.Nullable Object anyTypePropNullable) { + this.anyTypePropNullable = 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 + @JsonProperty(value = JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getAnyTypePropNullable() { + return anyTypePropNullable; + } + + @JsonProperty(value = JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAnyTypePropNullable(@javax.annotation.Nullable Object anyTypePropNullable) { + this.anyTypePropNullable = anyTypePropNullable; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus", "objectWithNoDeclaredProps", "objectWithNoDeclaredPropsNullable", "anyTypeProp", "anyTypePropNullable")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Value.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Value.java new file mode 100644 index 000000000000..1c1a14aa2f68 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Value.java @@ -0,0 +1,247 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; +import org.openapitools.client.model.Scalar; + +import tools.jackson.core.JsonGenerator; +import tools.jackson.core.JsonParser; +import tools.jackson.core.JsonToken; +import tools.jackson.core.type.TypeReference; +import tools.jackson.databind.DeserializationContext; +import tools.jackson.databind.JsonNode; +import tools.jackson.databind.MapperFeature; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; +import tools.jackson.databind.deser.std.StdDeserializer; +import tools.jackson.databind.ser.std.StdSerializer; +import tools.jackson.databind.JavaType; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.DatabindException; +import tools.jackson.databind.SerializationContext; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonDeserialize(using = Value.ValueDeserializer.class) +@JsonSerialize(using = Value.ValueSerializer.class) +public class Value extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Value.class.getName()); + + + public static class ValueSerializer extends StdSerializer { + public ValueSerializer(Class t) { + super(t); + } + + public ValueSerializer() { + this(null); + } + + @Override + public void serialize(Value value, JsonGenerator jgen, SerializationContext serializationContext) throws JacksonException { + serializationContext.writeValue(jgen, value.getActualInstance()); + } + } + + public static class ValueDeserializer extends StdDeserializer { + public ValueDeserializer() { + this(Value.class); + } + + public ValueDeserializer(Class vc) { + super(vc); + } + + @Override + public Value deserialize(JsonParser jp, DeserializationContext ctxt) throws JacksonException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = false; + int match = 0; + JsonToken token = tree.asToken(); + // deserialize List + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (List.class.equals(Integer.class) || List.class.equals(Long.class) || List.class.equals(Float.class) || List.class.equals(Double.class) || List.class.equals(Boolean.class) || List.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((List.class.equals(Integer.class) || List.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((List.class.equals(Float.class) || List.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (List.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (List.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, List.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'List'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + // deserialize Scalar + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Scalar.class.equals(Integer.class) || Scalar.class.equals(Long.class) || Scalar.class.equals(Float.class) || Scalar.class.equals(Double.class) || Scalar.class.equals(Boolean.class) || Scalar.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((Scalar.class.equals(Integer.class) || Scalar.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((Scalar.class.equals(Float.class) || Scalar.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (Scalar.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (Scalar.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = ctxt.readTreeAsValue(tree, Scalar.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'Scalar'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Scalar'", e); + } + + if (match == 1) { + Value ret = new Value(); + ret.setActualInstance(deserialized); + return ret; + } + throw DatabindException.from(jp, String.format(java.util.Locale.ROOT, "Failed deserialization for Value: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public Value getNullValue(DeserializationContext ctxt) { + throw DatabindException.from(ctxt.getParser(), "Value cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Value() { + super("oneOf", Boolean.FALSE); + } + + public Value(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Value(Scalar o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List", List.class); + schemas.put("Scalar", Scalar.class); + JSON.registerDescendants(Value.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return Value.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * List, Scalar + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Scalar.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List, Scalar"); + } + + /** + * Get the actual instance, which can be the following: + * List, Scalar + * + * @return The actual instance (List, Scalar) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Get the actual instance of `Scalar`. If the actual instance is not `Scalar`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Scalar` + * @throws ClassCastException if the instance is not `Scalar` + */ + public Scalar getScalar() throws ClassCastException { + return (Scalar)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Variable.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Variable.java new file mode 100644 index 000000000000..c13c70e5d3b5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Variable.java @@ -0,0 +1,200 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 org.openapitools.client.model.Value; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Value object + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Variable.JSON_PROPERTY_NAME, + Variable.JSON_PROPERTY_VALUE +}) +@JsonTypeName("Variable") +public class Variable { + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String JSON_PROPERTY_VALUE = "value"; + @JsonProperty(JSON_PROPERTY_VALUE) + @javax.annotation.Nonnull + private Value value; + + public Variable() { + } + + public Variable name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + @JsonProperty(value = JSON_PROPERTY_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Variable value(@javax.annotation.Nonnull Value value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Value getValue() { + return value; + } + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@javax.annotation.Nonnull Value value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Variable instance itself + */ + public Variable putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Variable {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "value")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Whale.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Whale.java new file mode 100644 index 000000000000..66a49c369e21 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Whale.java @@ -0,0 +1,231 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Whale + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Whale.JSON_PROPERTY_HAS_BALEEN, + Whale.JSON_PROPERTY_HAS_TEETH, + Whale.JSON_PROPERTY_CLASS_NAME +}) +@JsonTypeName("whale") +public class Whale { + public static final String JSON_PROPERTY_HAS_BALEEN = "hasBaleen"; + @JsonProperty(JSON_PROPERTY_HAS_BALEEN) + @javax.annotation.Nullable + private Boolean hasBaleen; + + public static final String JSON_PROPERTY_HAS_TEETH = "hasTeeth"; + @JsonProperty(JSON_PROPERTY_HAS_TEETH) + @javax.annotation.Nullable + private Boolean hasTeeth; + + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @javax.annotation.Nonnull + private String className; + + public Whale() { + } + + public Whale hasBaleen(@javax.annotation.Nullable Boolean hasBaleen) { + this.hasBaleen = hasBaleen; + return this; + } + + /** + * Get hasBaleen + * @return hasBaleen + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_HAS_BALEEN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHasBaleen() { + return hasBaleen; + } + + @JsonProperty(value = JSON_PROPERTY_HAS_BALEEN, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHasBaleen(@javax.annotation.Nullable Boolean hasBaleen) { + this.hasBaleen = hasBaleen; + } + + + public Whale hasTeeth(@javax.annotation.Nullable Boolean hasTeeth) { + this.hasTeeth = hasTeeth; + return this; + } + + /** + * Get hasTeeth + * @return hasTeeth + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_HAS_TEETH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHasTeeth() { + return hasTeeth; + } + + @JsonProperty(value = JSON_PROPERTY_HAS_TEETH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setHasTeeth(@javax.annotation.Nullable Boolean hasTeeth) { + this.hasTeeth = hasTeeth; + } + + + public Whale className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Whale instance itself + */ + public Whale putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("hasBaleen", "hasTeeth", "className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Zebra.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Zebra.java new file mode 100644 index 000000000000..46426bb614cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Zebra.java @@ -0,0 +1,238 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Zebra + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@JsonPropertyOrder({ + Zebra.JSON_PROPERTY_TYPE, + Zebra.JSON_PROPERTY_CLASS_NAME +}) +@JsonTypeName("zebra") +public class Zebra { + /** + * 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"; + @JsonProperty(JSON_PROPERTY_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @javax.annotation.Nonnull + private String className; + + public Zebra() { + } + + public Zebra type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public Zebra className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + @JsonProperty(value = JSON_PROPERTY_CLASS_NAME, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Zebra instance itself + */ + public Zebra putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Zebra {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("type", "className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java new file mode 100644 index 000000000000..face3d9b785e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -0,0 +1,73 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AnotherFakeApi + */ +@Disabled +public class AnotherFakeApiTest { + + private final AnotherFakeApi api = new AnotherFakeApi(); + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + * + * @throws ApiException if the Api call fails + */ + @Test + public void call123testSpecialTagsTest() throws ApiException { + Client client = null; + Client response = api.call123testSpecialTags(client); + // TODO: test validations + } + + /** + * parameter array number default value + * + * @throws ApiException if the Api call fails + */ + @Test + public void getParameterArrayNumberTest() throws ApiException { + List array = null; + api.getParameterArrayNumber(array); + // TODO: test validations + } + + /** + * parameter string number + * + * @throws ApiException if the Api call fails + */ + @Test + public void getParameterStringNumberTest() throws ApiException { + BigDecimal stringNumber = null; + api.getParameterStringNumber(stringNumber); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/DefaultApiTest.java new file mode 100644 index 000000000000..9dbc195b0857 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -0,0 +1,78 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.FakeAnyOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FakeOneOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FooGetDefaultResponse; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for DefaultApi + */ +@Disabled +public class DefaultApiTest { + + private final DefaultApi api = new DefaultApi(); + + /** + * Test route, this shouldn't cause a compiler error + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeAnyOfWIthSameErasureGetTest() throws ApiException { + FakeAnyOfWIthSameErasureGet200Response response = api.fakeAnyOfWIthSameErasureGet(); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fakeFreeFormQueryParametersGetTest() throws ApiException { + String fixed = null; + Object freeForm = null; + api.fakeFreeFormQueryParametersGet(fixed, freeForm); + // TODO: test validations + } + + /** + * Test route, this shouldn't cause a compiler error + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOneOfWIthSameErasureGetTest() throws ApiException { + FakeOneOfWIthSameErasureGet200Response response = api.fakeOneOfWIthSameErasureGet(); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fooGetTest() throws ApiException { + FooGetDefaultResponse response = api.fooGet(); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 000000000000..095dfdcd2304 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,395 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import org.openapitools.client.model.FakeRefParameterPetIdParameter; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.FreeFormObjectTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.NullableFieldsMapResponse; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.RequiredNullableBody; +import org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +@Disabled +public class FakeApiTest { + + private final FakeApi api = new FakeApi(); + + /** + * Get a free form object or Json string + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeGetFreeFormObjectGetTest() throws ApiException { + FreeFormObjectTestClass response = api.fakeGetFreeFormObjectGet(); + // TODO: test validations + } + + /** + * Test serialization of outer boolean types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterBooleanSerializeTest() throws ApiException { + Boolean body = null; + Boolean response = api.fakeOuterBooleanSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of object with outer number type + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterCompositeSerializeTest() throws ApiException { + OuterComposite outerComposite = null; + OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite); + // TODO: test validations + } + + /** + * Test serialization of outer number types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterNumberSerializeTest() throws ApiException { + BigDecimal body = null; + BigDecimal response = api.fakeOuterNumberSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of outer string types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterStringSerializeTest() throws ApiException { + String body = null; + String response = api.fakeOuterStringSerialize(body); + // TODO: test validations + } + + /** + * fake reference parameter + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeRefParameterTest() throws ApiException { + FakeRefParameterPetIdParameter petId = null; + api.fakeRefParameter(petId); + // TODO: test validations + } + + /** + * fields in the response body, required and nullable are both true + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeRequiredNullableBodyGetTest() throws ApiException { + RequiredNullableBody response = api.fakeRequiredNullableBodyGet(); + // TODO: test validations + } + + /** + * fake reference parameter + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeUploadRefRequestBodiesTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.fakeUploadRefRequestBodies(petId, additionalMetadata, _file); + // TODO: test validations + } + + /** + * Array of Enums + * + * @throws ApiException if the Api call fails + */ + @Test + public void getFakeArrayofenumsTest() throws ApiException { + List response = api.getFakeArrayofenums(); + // TODO: test validations + } + + /** + * Health check endpoint + * + * @throws ApiException if the Api call fails + */ + @Test + public void getFakeHealthTest() throws ApiException { + HealthCheckResult response = api.getFakeHealth(); + // TODO: test validations + } + + /** + * parameter name mapping test + * + * @throws ApiException if the Api call fails + */ + @Test + public void getParameterNameMappingTest() throws ApiException { + Long underscoreType = null; + String type = null; + String typeWithUnderscore = null; + api.getParameterNameMapping(underscoreType, type, typeWithUnderscore); + // TODO: test validations + } + + /** + * test referenced additionalProperties + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testAdditionalPropertiesReferenceTest() throws ApiException { + Map requestBody = null; + api.testAdditionalPropertiesReference(requestBody); + // TODO: test validations + } + + /** + * For this test, the body for this request much reference a schema named `File`. + * + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithFileSchemaTest() throws ApiException { + FileSchemaTestClass fileSchemaTestClass = null; + api.testBodyWithFileSchema(fileSchemaTestClass); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithQueryParamsTest() throws ApiException { + String query = null; + User user = null; + api.testBodyWithQueryParams(query, user); + // TODO: test validations + } + + /** + * To test \"client\" model + * + * To test \"client\" model + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClientModelTest() throws ApiException { + Client client = null; + Client response = api.testClientModel(client); + // TODO: test validations + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEndpointParametersTest() throws ApiException { + BigDecimal number = null; + Double _double = null; + String patternWithoutDelimiter = null; + byte[] _byte = null; + Integer integer = null; + Integer int32 = null; + Long int64 = null; + Float _float = null; + String string = null; + File binary = null; + LocalDate date = null; + OffsetDateTime dateTime = null; + String password = null; + String paramCallback = null; + api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + // TODO: test validations + } + + /** + * To test enum parameters + * + * To test enum parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEnumParametersTest() throws ApiException { + List enumHeaderStringArray = null; + String enumHeaderString = null; + List enumQueryStringArray = null; + String enumQueryString = null; + Integer enumQueryInteger = null; + Double enumQueryDouble = null; + List enumFormStringArray = null; + String enumFormString = null; + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + // TODO: test validations + } + + /** + * Fake endpoint to test group parameters (optional) + * + * Fake endpoint to test group parameters (optional) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testGroupParametersTest() throws ApiException { + Integer requiredStringGroup = null; + Boolean requiredBooleanGroup = null; + Long requiredInt64Group = null; + Integer stringGroup = null; + Boolean booleanGroup = null; + Long int64Group = null; + api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + // TODO: test validations + } + + /** + * test inline additionalProperties + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testInlineAdditionalPropertiesTest() throws ApiException { + Map requestBody = null; + api.testInlineAdditionalProperties(requestBody); + // TODO: test validations + } + + /** + * test inline free-form additionalProperties + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testInlineFreeformAdditionalPropertiesTest() throws ApiException { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = null; + api.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + // TODO: test validations + } + + /** + * test json serialization of form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testJsonFormDataTest() throws ApiException { + String param = null; + String param2 = null; + api.testJsonFormData(param, param2); + // TODO: test validations + } + + /** + * test anyOf with map of objects containing nullable required fields + * + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testNullableRequiredFieldsAnyOfTest() throws ApiException { + NullableFieldsMapResponse response = api.testNullableRequiredFieldsAnyOf(); + // TODO: test validations + } + + /** + * To test the collection format in query parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryParameterCollectionFormatTest() throws ApiException { + List pipe = null; + List ioutil = null; + List http = null; + List url = null; + List context = null; + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + // TODO: test validations + } + + /** + * test referenced string map + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testStringMapReferenceTest() throws ApiException { + Map requestBody = null; + api.testStringMapReference(requestBody); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 000000000000..aa1b824dd5a2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Client; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Disabled +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + /** + * To test class name in snake case + * + * To test class name in snake case + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + Client client = null; + Client response = api.testClassname(client); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..a1d3d6377d68 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,170 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + api.addPet(pet); + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + api.updatePet(pet); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String contentType = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.uploadFile(petId, contentType, additionalMetadata, _file); + // TODO: test validations + } + + /** + * uploads an image (required) + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileWithRequiredFileTest() throws ApiException { + Long petId = null; + File requiredFile = null; + String additionalMetadata = null; + ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..98354ba10c08 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,89 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = api.getOrderById(orderId); + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order order = null; + Order response = api.placeOrder(order); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..aa9aff49b4df --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,148 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User user = null; + api.createUser(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List user = null; + api.createUsersWithArrayInput(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List user = null; + api.createUsersWithListInput(user); + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + api.deleteUser(username); + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + api.logoutUser(); + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User user = null; + api.updateUser(username, user); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/ValuesApiTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/ValuesApiTest.java new file mode 100644 index 000000000000..89a1ad0febc4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/api/ValuesApiTest.java @@ -0,0 +1,47 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Variable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for ValuesApi + */ +@Disabled +public class ValuesApiTest { + + private final ValuesApi api = new ValuesApi(); + + /** + * Get some primitive variable values + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getSomeValuesTest() throws ApiException { + Variable response = api.getSomeValues(); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..ca205405207f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java @@ -0,0 +1,107 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesClass + */ +public class AdditionalPropertiesClassTest { + private final AdditionalPropertiesClass model = new AdditionalPropertiesClass(); + + /** + * Model tests for AdditionalPropertiesClass + */ + @Test + public void testAdditionalPropertiesClass() { + // TODO: test AdditionalPropertiesClass + } + + /** + * Test the property 'mapProperty' + */ + @Test + public void mapPropertyTest() { + // TODO: test mapProperty + } + + /** + * Test the property 'mapOfMapProperty' + */ + @Test + public void mapOfMapPropertyTest() { + // TODO: test mapOfMapProperty + } + + /** + * Test the property 'anytype1' + */ + @Test + public void anytype1Test() { + // TODO: test anytype1 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype1' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype1Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype1 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype2' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype2Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype2 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype3' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype3Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype3 + } + + /** + * Test the property 'emptyMap' + */ + @Test + public void emptyMapTest() { + // TODO: test emptyMap + } + + /** + * Test the property 'mapWithUndeclaredPropertiesString' + */ + @Test + public void mapWithUndeclaredPropertiesStringTest() { + // TODO: test mapWithUndeclaredPropertiesString + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java new file mode 100644 index 000000000000..364f9ff176f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java @@ -0,0 +1,126 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Order; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfAttributesC + */ +public class AllOfModelArrayAnyOfAllOfAttributesCTest { + private final AllOfModelArrayAnyOfAllOfAttributesC model = new AllOfModelArrayAnyOfAllOfAttributesC(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfAttributesC + */ + @Test + public void testAllOfModelArrayAnyOfAllOfAttributesC() { + // TODO: test AllOfModelArrayAnyOfAllOfAttributesC + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java new file mode 100644 index 000000000000..62ee3dde5bec --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributesC; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfAttributes + */ +public class AllOfModelArrayAnyOfAllOfAttributesTest { + private final AllOfModelArrayAnyOfAllOfAttributes model = new AllOfModelArrayAnyOfAllOfAttributes(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfAttributes + */ + @Test + public void testAllOfModelArrayAnyOfAllOfAttributes() { + // TODO: test AllOfModelArrayAnyOfAllOfAttributes + } + + /** + * Test the property 'C' + */ + @Test + public void CTest() { + // TODO: test C + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java new file mode 100644 index 000000000000..6fda96074757 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1Value; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ +public class AllOfModelArrayAnyOfAllOfLinkListColumn1Test { + private final AllOfModelArrayAnyOfAllOfLinkListColumn1 model = new AllOfModelArrayAnyOfAllOfLinkListColumn1(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ + @Test + public void testAllOfModelArrayAnyOfAllOfLinkListColumn1() { + // TODO: test AllOfModelArrayAnyOfAllOfLinkListColumn1 + } + + /** + * Test the property 'value' + */ + @Test + public void valueTest() { + // TODO: test value + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java new file mode 100644 index 000000000000..66d947344c39 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java @@ -0,0 +1,148 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Tag; +import org.openapitools.client.model.User; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1Value + */ +public class AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest { + private final AllOfModelArrayAnyOfAllOfLinkListColumn1Value model = new AllOfModelArrayAnyOfAllOfLinkListColumn1Value(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1Value + */ + @Test + public void testAllOfModelArrayAnyOfAllOfLinkListColumn1Value() { + // TODO: test AllOfModelArrayAnyOfAllOfLinkListColumn1Value + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + + /** + * Test the property 'objectWithNoDeclaredProps' + */ + @Test + public void objectWithNoDeclaredPropsTest() { + // TODO: test objectWithNoDeclaredProps + } + + /** + * Test the property 'objectWithNoDeclaredPropsNullable' + */ + @Test + public void objectWithNoDeclaredPropsNullableTest() { + // TODO: test objectWithNoDeclaredPropsNullable + } + + /** + * Test the property 'anyTypeProp' + */ + @Test + public void anyTypePropTest() { + // TODO: test anyTypeProp + } + + /** + * Test the property 'anyTypePropNullable' + */ + @Test + public void anyTypePropNullableTest() { + // TODO: test anyTypePropNullable + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java new file mode 100644 index 000000000000..dbe2ff405b74 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java @@ -0,0 +1,71 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributes; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOf + */ +public class AllOfModelArrayAnyOfTest { + private final AllOfModelArrayAnyOf model = new AllOfModelArrayAnyOf(); + + /** + * Model tests for AllOfModelArrayAnyOf + */ + @Test + public void testAllOfModelArrayAnyOf() { + // TODO: test AllOfModelArrayAnyOf + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'linkListColumn1' + */ + @Test + public void linkListColumn1Test() { + // TODO: test linkListColumn1 + } + + /** + * Test the property 'attributes' + */ + @Test + public void attributesTest() { + // TODO: test attributes + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java new file mode 100644 index 000000000000..1776abdc788b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java @@ -0,0 +1,45 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToDouble + */ +public class AllOfRefToDoubleTest { + private final AllOfRefToDouble model = new AllOfRefToDouble(); + + /** + * Model tests for AllOfRefToDouble + */ + @Test + public void testAllOfRefToDouble() { + // TODO: test AllOfRefToDouble + } + + /** + * Test the property 'height' + */ + @Test + public void heightTest() { + // TODO: test height + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java new file mode 100644 index 000000000000..24e4c07eb3b7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java @@ -0,0 +1,45 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToFloat + */ +public class AllOfRefToFloatTest { + private final AllOfRefToFloat model = new AllOfRefToFloat(); + + /** + * Model tests for AllOfRefToFloat + */ + @Test + public void testAllOfRefToFloat() { + // TODO: test AllOfRefToFloat + } + + /** + * Test the property 'weight' + */ + @Test + public void weightTest() { + // TODO: test weight + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java new file mode 100644 index 000000000000..b336960e52ca --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java @@ -0,0 +1,45 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToLong + */ +public class AllOfRefToLongTest { + private final AllOfRefToLong model = new AllOfRefToLong(); + + /** + * Model tests for AllOfRefToLong + */ + @Test + public void testAllOfRefToLong() { + // TODO: test AllOfRefToLong + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AnimalTest.java new file mode 100644 index 000000000000..4d398dc56ee2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AnimalTest.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.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Animal + */ +public class AnimalTest { + private final Animal model = new Animal(); + + /** + * Model tests for Animal + */ + @Test + public void testAnimal() { + // TODO: test Animal + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AppleReqTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AppleReqTest.java new file mode 100644 index 000000000000..2d66eff8eb3e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AppleReqTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AppleReq + */ +public class AppleReqTest { + private final AppleReq model = new AppleReq(); + + /** + * Model tests for AppleReq + */ + @Test + public void testAppleReq() { + // TODO: test AppleReq + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'mealy' + */ + @Test + public void mealyTest() { + // TODO: test mealy + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AppleTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AppleTest.java new file mode 100644 index 000000000000..4f918d2be1da --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/AppleTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Apple + */ +public class AppleTest { + private final Apple model = new Apple(); + + /** + * Model tests for Apple + */ + @Test + public void testApple() { + // TODO: test Apple + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java new file mode 100644 index 000000000000..ab635fd6b72f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java @@ -0,0 +1,34 @@ +/* + * 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.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayAnyOf + */ +public class ArrayAnyOfTest { + private final ArrayAnyOf model = new ArrayAnyOf(); + + /** + * Model tests for ArrayAnyOf + */ + @Test + public void testArrayAnyOf() { + // TODO: test ArrayAnyOf + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java new file mode 100644 index 000000000000..4e03bb7d3e75 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayDefaultTest.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.model; + +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayDefault + */ +public class ArrayDefaultTest { + private final ArrayDefault model = new ArrayDefault(); + + /** + * Model tests for ArrayDefault + */ + @Test + public void testArrayDefault() { + // TODO: test ArrayDefault + } + + /** + * Test the property 'withDefaultEmptyBracket' + */ + @Test + public void withDefaultEmptyBracketTest() { + // TODO: test withDefaultEmptyBracket + } + + /** + * Test the property 'withoutDefault' + */ + @Test + public void withoutDefaultTest() { + // TODO: test withoutDefault + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..e01a07447d91 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfArrayOfNumberOnly + */ +public class ArrayOfArrayOfNumberOnlyTest { + private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfArrayOfNumberOnly + */ + @Test + public void testArrayOfArrayOfNumberOnly() { + // TODO: test ArrayOfArrayOfNumberOnly + } + + /** + * Test the property 'arrayArrayNumber' + */ + @Test + public void arrayArrayNumberTest() { + // TODO: test arrayArrayNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java new file mode 100644 index 000000000000..e07beacf51b4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ +public class ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest { + private final ArrayOfInlineAllOfArrayAllofDogPropertyInner model = new ArrayOfInlineAllOfArrayAllofDogPropertyInner(); + + /** + * Model tests for ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ + @Test + public void testArrayOfInlineAllOfArrayAllofDogPropertyInner() { + // TODO: test ArrayOfInlineAllOfArrayAllofDogPropertyInner + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java new file mode 100644 index 000000000000..64afdcbb9eb1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ArrayOfInlineAllOfArrayAllofDogPropertyInner; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfInlineAllOf + */ +public class ArrayOfInlineAllOfTest { + private final ArrayOfInlineAllOf model = new ArrayOfInlineAllOf(); + + /** + * Model tests for ArrayOfInlineAllOf + */ + @Test + public void testArrayOfInlineAllOf() { + // TODO: test ArrayOfInlineAllOf + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'arrayAllofDogProperty' + */ + @Test + public void arrayAllofDogPropertyTest() { + // TODO: test arrayAllofDogProperty + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..8710ef2d9064 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfNumberOnly + */ +public class ArrayOfNumberOnlyTest { + private final ArrayOfNumberOnly model = new ArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfNumberOnly + */ + @Test + public void testArrayOfNumberOnly() { + // TODO: test ArrayOfNumberOnly + } + + /** + * Test the property 'arrayNumber' + */ + @Test + public void arrayNumberTest() { + // TODO: test arrayNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java new file mode 100644 index 000000000000..7f9af8d893c0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java @@ -0,0 +1,34 @@ +/* + * 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.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOneOf + */ +public class ArrayOneOfTest { + private final ArrayOneOf model = new ArrayOneOf(); + + /** + * Model tests for ArrayOneOf + */ + @Test + public void testArrayOneOf() { + // TODO: test ArrayOneOf + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayTestTest.java new file mode 100644 index 000000000000..e91d303e1c62 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ArrayTestTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayTest + */ +public class ArrayTestTest { + private final ArrayTest model = new ArrayTest(); + + /** + * Model tests for ArrayTest + */ + @Test + public void testArrayTest() { + // TODO: test ArrayTest + } + + /** + * Test the property 'arrayOfString' + */ + @Test + public void arrayOfStringTest() { + // TODO: test arrayOfString + } + + /** + * Test the property 'arrayArrayOfInteger' + */ + @Test + public void arrayArrayOfIntegerTest() { + // TODO: test arrayArrayOfInteger + } + + /** + * Test the property 'arrayArrayOfModel' + */ + @Test + public void arrayArrayOfModelTest() { + // TODO: test arrayArrayOfModel + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/BananaReqTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/BananaReqTest.java new file mode 100644 index 000000000000..47f5aa1af7a0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/BananaReqTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BananaReq + */ +public class BananaReqTest { + private final BananaReq model = new BananaReq(); + + /** + * Model tests for BananaReq + */ + @Test + public void testBananaReq() { + // TODO: test BananaReq + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + + /** + * Test the property 'sweet' + */ + @Test + public void sweetTest() { + // TODO: test sweet + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/BananaTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/BananaTest.java new file mode 100644 index 000000000000..b5159749b97e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/BananaTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Banana + */ +public class BananaTest { + private final Banana model = new Banana(); + + /** + * Model tests for Banana + */ + @Test + public void testBanana() { + // TODO: test Banana + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/BasquePigTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/BasquePigTest.java new file mode 100644 index 000000000000..66473c67aee0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/BasquePigTest.java @@ -0,0 +1,45 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BasquePig + */ +public class BasquePigTest { + private final BasquePig model = new BasquePig(); + + /** + * Model tests for BasquePig + */ + @Test + public void testBasquePig() { + // TODO: test BasquePig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/CapitalizationTest.java new file mode 100644 index 000000000000..d879d1e4f586 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/CapitalizationTest.java @@ -0,0 +1,85 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Capitalization + */ +public class CapitalizationTest { + private final Capitalization model = new Capitalization(); + + /** + * Model tests for Capitalization + */ + @Test + public void testCapitalization() { + // TODO: test Capitalization + } + + /** + * Test the property 'smallCamel' + */ + @Test + public void smallCamelTest() { + // TODO: test smallCamel + } + + /** + * Test the property 'capitalCamel' + */ + @Test + public void capitalCamelTest() { + // TODO: test capitalCamel + } + + /** + * Test the property 'smallSnake' + */ + @Test + public void smallSnakeTest() { + // TODO: test smallSnake + } + + /** + * Test the property 'capitalSnake' + */ + @Test + public void capitalSnakeTest() { + // TODO: test capitalSnake + } + + /** + * Test the property 'scAETHFlowPoints' + */ + @Test + public void scAETHFlowPointsTest() { + // TODO: test scAETHFlowPoints + } + + /** + * Test the property 'ATT_NAME' + */ + @Test + public void ATT_NAMETest() { + // TODO: test ATT_NAME + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/CatTest.java new file mode 100644 index 000000000000..4ea094145dfa --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/CatTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Map; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Cat + */ +public class CatTest { + private final Cat model = new Cat(); + + /** + * Model tests for Cat + */ + @Test + public void testCat() { + // TODO: test Cat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..04adbe360188 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,53 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ClassModelTest.java new file mode 100644 index 000000000000..f7f34022fc88 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ClassModelTest.java @@ -0,0 +1,45 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ClassModel + */ +public class ClassModelTest { + private final ClassModel model = new ClassModel(); + + /** + * Model tests for ClassModel + */ + @Test + public void testClassModel() { + // TODO: test ClassModel + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ClientTest.java new file mode 100644 index 000000000000..88ce8fc08910 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ClientTest.java @@ -0,0 +1,45 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Client + */ +public class ClientTest { + private final Client model = new Client(); + + /** + * Model tests for Client + */ + @Test + public void testClient() { + // TODO: test Client + } + + /** + * Test the property 'client' + */ + @Test + public void clientTest() { + // TODO: test client + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java new file mode 100644 index 000000000000..f6ac6f7eae01 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java @@ -0,0 +1,53 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ComplexQuadrilateral + */ +public class ComplexQuadrilateralTest { + private final ComplexQuadrilateral model = new ComplexQuadrilateral(); + + /** + * Model tests for ComplexQuadrilateral + */ + @Test + public void testComplexQuadrilateral() { + // TODO: test ComplexQuadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DanishPigTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DanishPigTest.java new file mode 100644 index 000000000000..9dbc15832965 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DanishPigTest.java @@ -0,0 +1,45 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DanishPig + */ +public class DanishPigTest { + private final DanishPig model = new DanishPig(); + + /** + * Model tests for DanishPig + */ + @Test + public void testDanishPig() { + // TODO: test DanishPig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java new file mode 100644 index 000000000000..d7dd0e573b18 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java @@ -0,0 +1,45 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DeprecatedObject + */ +public class DeprecatedObjectTest { + private final DeprecatedObject model = new DeprecatedObject(); + + /** + * Model tests for DeprecatedObject + */ + @Test + public void testDeprecatedObject() { + // TODO: test DeprecatedObject + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DogTest.java new file mode 100644 index 000000000000..f49663703e3c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DogTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Dog + */ +public class DogTest { + private final Dog model = new Dog(); + + /** + * Model tests for Dog + */ + @Test + public void testDog() { + // TODO: test Dog + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DrawingTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DrawingTest.java new file mode 100644 index 000000000000..ce21443f48fd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/DrawingTest.java @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Fruit; +import org.openapitools.client.model.NullableShape; +import org.openapitools.client.model.Shape; +import org.openapitools.client.model.ShapeOrNull; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Drawing + */ +public class DrawingTest { + private final Drawing model = new Drawing(); + + /** + * Model tests for Drawing + */ + @Test + public void testDrawing() { + // TODO: test Drawing + } + + /** + * Test the property 'mainShape' + */ + @Test + public void mainShapeTest() { + // TODO: test mainShape + } + + /** + * Test the property 'shapeOrNull' + */ + @Test + public void shapeOrNullTest() { + // TODO: test shapeOrNull + } + + /** + * Test the property 'nullableShape' + */ + @Test + public void nullableShapeTest() { + // TODO: test nullableShape + } + + /** + * Test the property 'shapes' + */ + @Test + public void shapesTest() { + // TODO: test shapes + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumArraysTest.java new file mode 100644 index 000000000000..666f0a3b58c2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumArraysTest.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.model; + +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumArrays + */ +public class EnumArraysTest { + private final EnumArrays model = new EnumArrays(); + + /** + * Model tests for EnumArrays + */ + @Test + public void testEnumArrays() { + // TODO: test EnumArrays + } + + /** + * Test the property 'justSymbol' + */ + @Test + public void justSymbolTest() { + // TODO: test justSymbol + } + + /** + * Test the property 'arrayEnum' + */ + @Test + public void arrayEnumTest() { + // TODO: test arrayEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumClassTest.java new file mode 100644 index 000000000000..6896bb0a4e90 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumClassTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumClass + */ +public class EnumClassTest { + /** + * Model tests for EnumClass + */ + @Test + public void testEnumClass() { + // TODO: test EnumClass + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java new file mode 100644 index 000000000000..e0541c9d7591 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumStringDiscriminator + */ +public class EnumStringDiscriminatorTest { + private final EnumStringDiscriminator model = new EnumStringDiscriminator(); + + /** + * Model tests for EnumStringDiscriminator + */ + @Test + public void testEnumStringDiscriminator() { + // TODO: test EnumStringDiscriminator + } + + /** + * Test the property 'enumStrType' + */ + @Test + public void enumStrTypeTest() { + // TODO: test enumStrType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumTestTest.java new file mode 100644 index 000000000000..16798e61ba6d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EnumTestTest.java @@ -0,0 +1,118 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.OuterEnumDefaultValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.openapitools.client.model.OuterEnumIntegerDefaultValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumTest + */ +public class EnumTestTest { + private final EnumTest model = new EnumTest(); + + /** + * Model tests for EnumTest + */ + @Test + public void testEnumTest() { + // TODO: test EnumTest + } + + /** + * Test the property 'enumString' + */ + @Test + public void enumStringTest() { + // TODO: test enumString + } + + /** + * Test the property 'enumStringRequired' + */ + @Test + public void enumStringRequiredTest() { + // TODO: test enumStringRequired + } + + /** + * Test the property 'enumInteger' + */ + @Test + public void enumIntegerTest() { + // TODO: test enumInteger + } + + /** + * Test the property 'enumIntegerOnly' + */ + @Test + public void enumIntegerOnlyTest() { + // TODO: test enumIntegerOnly + } + + /** + * Test the property 'enumNumber' + */ + @Test + public void enumNumberTest() { + // TODO: test enumNumber + } + + /** + * Test the property 'outerEnum' + */ + @Test + public void outerEnumTest() { + // TODO: test outerEnum + } + + /** + * Test the property 'outerEnumInteger' + */ + @Test + public void outerEnumIntegerTest() { + // TODO: test outerEnumInteger + } + + /** + * Test the property 'outerEnumDefaultValue' + */ + @Test + public void outerEnumDefaultValueTest() { + // TODO: test outerEnumDefaultValue + } + + /** + * Test the property 'outerEnumIntegerDefaultValue' + */ + @Test + public void outerEnumIntegerDefaultValueTest() { + // TODO: test outerEnumIntegerDefaultValue + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java new file mode 100644 index 000000000000..5d2068d7de17 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java @@ -0,0 +1,53 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EquilateralTriangle + */ +public class EquilateralTriangleTest { + private final EquilateralTriangle model = new EquilateralTriangle(); + + /** + * Model tests for EquilateralTriangle + */ + @Test + public void testEquilateralTriangle() { + // TODO: test EquilateralTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java new file mode 100644 index 000000000000..182663803649 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java @@ -0,0 +1,35 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeAnyOfWIthSameErasureGet200Response + */ +public class FakeAnyOfWIthSameErasureGet200ResponseTest { + private final FakeAnyOfWIthSameErasureGet200Response model = new FakeAnyOfWIthSameErasureGet200Response(); + + /** + * Model tests for FakeAnyOfWIthSameErasureGet200Response + */ + @Test + public void testFakeAnyOfWIthSameErasureGet200Response() { + // TODO: test FakeAnyOfWIthSameErasureGet200Response + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java new file mode 100644 index 000000000000..9e2b356e1c48 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java @@ -0,0 +1,35 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeOneOfWIthSameErasureGet200Response + */ +public class FakeOneOfWIthSameErasureGet200ResponseTest { + private final FakeOneOfWIthSameErasureGet200Response model = new FakeOneOfWIthSameErasureGet200Response(); + + /** + * Model tests for FakeOneOfWIthSameErasureGet200Response + */ + @Test + public void testFakeOneOfWIthSameErasureGet200Response() { + // TODO: test FakeOneOfWIthSameErasureGet200Response + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java new file mode 100644 index 000000000000..26e884015e01 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java @@ -0,0 +1,34 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeRefParameterPetIdParameter + */ +public class FakeRefParameterPetIdParameterTest { + private final FakeRefParameterPetIdParameter model = new FakeRefParameterPetIdParameter(); + + /** + * Model tests for FakeRefParameterPetIdParameter + */ + @Test + public void testFakeRefParameterPetIdParameter() { + // TODO: test FakeRefParameterPetIdParameter + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java new file mode 100644 index 000000000000..8ef8cf2198d4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FileSchemaTestClass + */ +public class FileSchemaTestClassTest { + private final FileSchemaTestClass model = new FileSchemaTestClass(); + + /** + * Model tests for FileSchemaTestClass + */ + @Test + public void testFileSchemaTestClass() { + // TODO: test FileSchemaTestClass + } + + /** + * Test the property '_file' + */ + @Test + public void _fileTest() { + // TODO: test _file + } + + /** + * Test the property 'files' + */ + @Test + public void filesTest() { + // TODO: test files + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java new file mode 100644 index 000000000000..fb1a8a54a199 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Foo; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FooGetDefaultResponse + */ +public class FooGetDefaultResponseTest { + private final FooGetDefaultResponse model = new FooGetDefaultResponse(); + + /** + * Model tests for FooGetDefaultResponse + */ + @Test + public void testFooGetDefaultResponse() { + // TODO: test FooGetDefaultResponse + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FooTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FooTest.java new file mode 100644 index 000000000000..cb5ad7efb781 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FooTest.java @@ -0,0 +1,45 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Foo + */ +public class FooTest { + private final Foo model = new Foo(); + + /** + * Model tests for Foo + */ + @Test + public void testFoo() { + // TODO: test Foo + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FormatTestTest.java new file mode 100644 index 000000000000..3d296b5869f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -0,0 +1,179 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FormatTest + */ +public class FormatTestTest { + private final FormatTest model = new FormatTest(); + + /** + * Model tests for FormatTest + */ + @Test + public void testFormatTest() { + // TODO: test FormatTest + } + + /** + * Test the property 'integer' + */ + @Test + public void integerTest() { + // TODO: test integer + } + + /** + * Test the property 'int32' + */ + @Test + public void int32Test() { + // TODO: test int32 + } + + /** + * Test the property 'int64' + */ + @Test + public void int64Test() { + // TODO: test int64 + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property '_float' + */ + @Test + public void _floatTest() { + // TODO: test _float + } + + /** + * Test the property '_double' + */ + @Test + public void _doubleTest() { + // TODO: test _double + } + + /** + * Test the property 'decimal' + */ + @Test + public void decimalTest() { + // TODO: test decimal + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + + /** + * Test the property '_byte' + */ + @Test + public void _byteTest() { + // TODO: test _byte + } + + /** + * Test the property 'binary' + */ + @Test + public void binaryTest() { + // TODO: test binary + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'uuidWithDefault' + */ + @Test + public void uuidWithDefaultTest() { + // TODO: test uuidWithDefault + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'patternWithDigits' + */ + @Test + public void patternWithDigitsTest() { + // TODO: test patternWithDigits + } + + /** + * Test the property 'patternWithDigitsAndDelimiter' + */ + @Test + public void patternWithDigitsAndDelimiterTest() { + // TODO: test patternWithDigitsAndDelimiter + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java new file mode 100644 index 000000000000..c41fd53da980 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java @@ -0,0 +1,35 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FreeFormObjectTestClassProperties + */ +public class FreeFormObjectTestClassPropertiesTest { + private final FreeFormObjectTestClassProperties model = new FreeFormObjectTestClassProperties(); + + /** + * Model tests for FreeFormObjectTestClassProperties + */ + @Test + public void testFreeFormObjectTestClassProperties() { + // TODO: test FreeFormObjectTestClassProperties + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java new file mode 100644 index 000000000000..9148e1d149b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.FreeFormObjectTestClassProperties; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FreeFormObjectTestClass + */ +public class FreeFormObjectTestClassTest { + private final FreeFormObjectTestClass model = new FreeFormObjectTestClass(); + + /** + * Model tests for FreeFormObjectTestClass + */ + @Test + public void testFreeFormObjectTestClass() { + // TODO: test FreeFormObjectTestClass + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'properties' + */ + @Test + public void propertiesTest() { + // TODO: test properties + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FruitReqTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FruitReqTest.java new file mode 100644 index 000000000000..820564e0dbd9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FruitReqTest.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FruitReq + */ +public class FruitReqTest { + private final FruitReq model = new FruitReq(); + + /** + * Model tests for FruitReq + */ + @Test + public void testFruitReq() { + // TODO: test FruitReq + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'mealy' + */ + @Test + public void mealyTest() { + // TODO: test mealy + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + + /** + * Test the property 'sweet' + */ + @Test + public void sweetTest() { + // TODO: test sweet + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FruitTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FruitTest.java new file mode 100644 index 000000000000..c693140d0b0f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/FruitTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Fruit + */ +public class FruitTest { + private final Fruit model = new Fruit(); + + /** + * Model tests for Fruit + */ + @Test + public void testFruit() { + // TODO: test Fruit + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/GmFruitTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/GmFruitTest.java new file mode 100644 index 000000000000..68613aca12af --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/GmFruitTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for GmFruit + */ +public class GmFruitTest { + private final GmFruit model = new GmFruit(); + + /** + * Model tests for GmFruit + */ + @Test + public void testGmFruit() { + // TODO: test GmFruit + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java new file mode 100644 index 000000000000..5bd32b169678 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for GrandparentAnimal + */ +public class GrandparentAnimalTest { + private final GrandparentAnimal model = new GrandparentAnimal(); + + /** + * Model tests for GrandparentAnimal + */ + @Test + public void testGrandparentAnimal() { + // TODO: test GrandparentAnimal + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java new file mode 100644 index 000000000000..45a4e19730f4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HasOnlyReadOnly + */ +public class HasOnlyReadOnlyTest { + private final HasOnlyReadOnly model = new HasOnlyReadOnly(); + + /** + * Model tests for HasOnlyReadOnly + */ + @Test + public void testHasOnlyReadOnly() { + // TODO: test HasOnlyReadOnly + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'foo' + */ + @Test + public void fooTest() { + // TODO: test foo + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java new file mode 100644 index 000000000000..82daa2ee86fb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HealthCheckResult + */ +public class HealthCheckResultTest { + private final HealthCheckResult model = new HealthCheckResult(); + + /** + * Model tests for HealthCheckResult + */ + @Test + public void testHealthCheckResult() { + // TODO: test HealthCheckResult + } + + /** + * Test the property 'nullableMessage' + */ + @Test + public void nullableMessageTest() { + // TODO: test nullableMessage + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java new file mode 100644 index 000000000000..0bf70fc3ae06 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java @@ -0,0 +1,53 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for IsoscelesTriangle + */ +public class IsoscelesTriangleTest { + private final IsoscelesTriangle model = new IsoscelesTriangle(); + + /** + * Model tests for IsoscelesTriangle + */ + @Test + public void testIsoscelesTriangle() { + // TODO: test IsoscelesTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MammalAnyofTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MammalAnyofTest.java new file mode 100644 index 000000000000..5ab2eb90bbd1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MammalAnyofTest.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MammalAnyof + */ +public class MammalAnyofTest { + private final MammalAnyof model = new MammalAnyof(); + + /** + * Model tests for MammalAnyof + */ + @Test + public void testMammalAnyof() { + // TODO: test MammalAnyof + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MammalTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MammalTest.java new file mode 100644 index 000000000000..1cb4d066f7f6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MammalTest.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Mammal + */ +public class MammalTest { + private final Mammal model = new Mammal(); + + /** + * Model tests for Mammal + */ + @Test + public void testMammal() { + // TODO: test Mammal + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MapTestTest.java new file mode 100644 index 000000000000..b96ec7c03715 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MapTestTest.java @@ -0,0 +1,71 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MapTest + */ +public class MapTestTest { + private final MapTest model = new MapTest(); + + /** + * Model tests for MapTest + */ + @Test + public void testMapTest() { + // TODO: test MapTest + } + + /** + * Test the property 'mapMapOfString' + */ + @Test + public void mapMapOfStringTest() { + // TODO: test mapMapOfString + } + + /** + * Test the property 'mapOfEnumString' + */ + @Test + public void mapOfEnumStringTest() { + // TODO: test mapOfEnumString + } + + /** + * Test the property 'directMap' + */ + @Test + public void directMapTest() { + // TODO: test directMap + } + + /** + * Test the property 'indirectMap' + */ + @Test + public void indirectMapTest() { + // TODO: test indirectMap + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..2c27f9ea61bc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ +public class MixedPropertiesAndAdditionalPropertiesClassTest { + private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass(); + + /** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ + @Test + public void testMixedPropertiesAndAdditionalPropertiesClass() { + // TODO: test MixedPropertiesAndAdditionalPropertiesClass + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'map' + */ + @Test + public void mapTest() { + // TODO: test map + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/Model200ResponseTest.java new file mode 100644 index 000000000000..00ba2d5752d6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/Model200ResponseTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Model200Response + */ +public class Model200ResponseTest { + private final Model200Response model = new Model200Response(); + + /** + * Model tests for Model200Response + */ + @Test + public void testModel200Response() { + // TODO: test Model200Response + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..229bfff03a75 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelApiResponseTest.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.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelFileTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelFileTest.java new file mode 100644 index 000000000000..cd302c0d9bd3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelFileTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelFile + */ +public class ModelFileTest { + private final ModelFile model = new ModelFile(); + + /** + * Model tests for ModelFile + */ + @Test + public void testModelFile() { + // TODO: test ModelFile + } + + /** + * Test the property 'sourceURI' + */ + @Test + public void sourceURITest() { + // TODO: test sourceURI + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelListTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelListTest.java new file mode 100644 index 000000000000..4f57b59fb5e4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelListTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelList + */ +public class ModelListTest { + private final ModelList model = new ModelList(); + + /** + * Model tests for ModelList + */ + @Test + public void testModelList() { + // TODO: test ModelList + } + + /** + * Test the property '_123list' + */ + @Test + public void _123listTest() { + // TODO: test _123list + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelReturnTest.java new file mode 100644 index 000000000000..db85d17e73f8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelReturnTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelReturn + */ +public class ModelReturnTest { + private final ModelReturn model = new ModelReturn(); + + /** + * Model tests for ModelReturn + */ + @Test + public void testModelReturn() { + // TODO: test ModelReturn + } + + /** + * Test the property '_return' + */ + @Test + public void _returnTest() { + // TODO: test _return + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java new file mode 100644 index 000000000000..48a9faccb91f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.ArrayAnyOf; +import org.openapitools.client.model.ArrayOneOf; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelWithOneOfAnyOfProperties + */ +public class ModelWithOneOfAnyOfPropertiesTest { + private final ModelWithOneOfAnyOfProperties model = new ModelWithOneOfAnyOfProperties(); + + /** + * Model tests for ModelWithOneOfAnyOfProperties + */ + @Test + public void testModelWithOneOfAnyOfProperties() { + // TODO: test ModelWithOneOfAnyOfProperties + } + + /** + * Test the property 'oneofProp' + */ + @Test + public void oneofPropTest() { + // TODO: test oneofProp + } + + /** + * Test the property 'anyofProp' + */ + @Test + public void anyofPropTest() { + // TODO: test anyofProp + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NameTest.java new file mode 100644 index 000000000000..91e62ac2d4ee --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NameTest.java @@ -0,0 +1,69 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Name + */ +public class NameTest { + private final Name model = new Name(); + + /** + * Model tests for Name + */ + @Test + public void testName() { + // TODO: test Name + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'snakeCase' + */ + @Test + public void snakeCaseTest() { + // TODO: test snakeCase + } + + /** + * Test the property 'property' + */ + @Test + public void propertyTest() { + // TODO: test property + } + + /** + * Test the property '_123number' + */ + @Test + public void _123numberTest() { + // TODO: test _123number + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java new file mode 100644 index 000000000000..e98e27dba076 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NestedArrayWithDefaultValues + */ +public class NestedArrayWithDefaultValuesTest { + private final NestedArrayWithDefaultValues model = new NestedArrayWithDefaultValues(); + + /** + * Model tests for NestedArrayWithDefaultValues + */ + @Test + public void testNestedArrayWithDefaultValues() { + // TODO: test NestedArrayWithDefaultValues + } + + /** + * Test the property 'nestedArray' + */ + @Test + public void nestedArrayTest() { + // TODO: test nestedArray + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java new file mode 100644 index 000000000000..cf2c4be62b66 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NewPetCategoryInlineAllofAllOfCategoryTag + */ +public class NewPetCategoryInlineAllofAllOfCategoryTagTest { + private final NewPetCategoryInlineAllofAllOfCategoryTag model = new NewPetCategoryInlineAllofAllOfCategoryTag(); + + /** + * Model tests for NewPetCategoryInlineAllofAllOfCategoryTag + */ + @Test + public void testNewPetCategoryInlineAllofAllOfCategoryTag() { + // TODO: test NewPetCategoryInlineAllofAllOfCategoryTag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java new file mode 100644 index 000000000000..a396cfad5a0d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.NewPetCategoryInlineAllofAllOfCategoryTag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NewPetCategoryInlineAllof + */ +public class NewPetCategoryInlineAllofTest { + private final NewPetCategoryInlineAllof model = new NewPetCategoryInlineAllof(); + + /** + * Model tests for NewPetCategoryInlineAllof + */ + @Test + public void testNewPetCategoryInlineAllof() { + // TODO: test NewPetCategoryInlineAllof + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'categoryTag' + */ + @Test + public void categoryTagTest() { + // TODO: test categoryTag + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NewPetTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NewPetTest.java new file mode 100644 index 000000000000..b265795d10b1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NewPetTest.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 com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.NewPetCategoryInlineAllof; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NewPet + */ +public class NewPetTest { + private final NewPet model = new NewPet(); + + /** + * Model tests for NewPet + */ + @Test + public void testNewPet() { + // TODO: test NewPet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'categoryInlineAllof' + */ + @Test + public void categoryInlineAllofTest() { + // TODO: test categoryInlineAllof + } + + /** + * Test the property 'categoryAllOfRef' + */ + @Test + public void categoryAllOfRefTest() { + // TODO: test categoryAllOfRef + } + + /** + * Test the property 'categoryAllOfRefDescription' + */ + @Test + public void categoryAllOfRefDescriptionTest() { + // TODO: test categoryAllOfRefDescription + } + + /** + * Test the property 'categoryAllOfRefDescriptionReadonly' + */ + @Test + public void categoryAllOfRefDescriptionReadonlyTest() { + // TODO: test categoryAllOfRefDescriptionReadonly + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableClassTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableClassTest.java new file mode 100644 index 000000000000..5fe965f0f93c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableClassTest.java @@ -0,0 +1,145 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableClass + */ +public class NullableClassTest { + private final NullableClass model = new NullableClass(); + + /** + * Model tests for NullableClass + */ + @Test + public void testNullableClass() { + // TODO: test NullableClass + } + + /** + * Test the property 'integerProp' + */ + @Test + public void integerPropTest() { + // TODO: test integerProp + } + + /** + * Test the property 'numberProp' + */ + @Test + public void numberPropTest() { + // TODO: test numberProp + } + + /** + * Test the property 'booleanProp' + */ + @Test + public void booleanPropTest() { + // TODO: test booleanProp + } + + /** + * Test the property 'stringProp' + */ + @Test + public void stringPropTest() { + // TODO: test stringProp + } + + /** + * Test the property 'dateProp' + */ + @Test + public void datePropTest() { + // TODO: test dateProp + } + + /** + * Test the property 'datetimeProp' + */ + @Test + public void datetimePropTest() { + // TODO: test datetimeProp + } + + /** + * Test the property 'arrayNullableProp' + */ + @Test + public void arrayNullablePropTest() { + // TODO: test arrayNullableProp + } + + /** + * Test the property 'arrayAndItemsNullableProp' + */ + @Test + public void arrayAndItemsNullablePropTest() { + // TODO: test arrayAndItemsNullableProp + } + + /** + * Test the property 'arrayItemsNullable' + */ + @Test + public void arrayItemsNullableTest() { + // TODO: test arrayItemsNullable + } + + /** + * Test the property 'objectNullableProp' + */ + @Test + public void objectNullablePropTest() { + // TODO: test objectNullableProp + } + + /** + * Test the property 'objectAndItemsNullableProp' + */ + @Test + public void objectAndItemsNullablePropTest() { + // TODO: test objectAndItemsNullableProp + } + + /** + * Test the property 'objectItemsNullable' + */ + @Test + public void objectItemsNullableTest() { + // TODO: test objectItemsNullable + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableEnumTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableEnumTest.java new file mode 100644 index 000000000000..13f44d4a4e2c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableEnumTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableEnum + */ +public class NullableEnumTest { + /** + * Model tests for NullableEnum + */ + @Test + public void testNullableEnum() { + // TODO: test NullableEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java new file mode 100644 index 000000000000..44e791c6b12b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java @@ -0,0 +1,53 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsMapError + */ +public class NullableFieldsMapErrorTest { + private final NullableFieldsMapError model = new NullableFieldsMapError(); + + /** + * Model tests for NullableFieldsMapError + */ + @Test + public void testNullableFieldsMapError() { + // TODO: test NullableFieldsMapError + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'reason' + */ + @Test + public void reasonTest() { + // TODO: test reason + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java new file mode 100644 index 000000000000..f03a5a90bd0c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsMapError; +import org.openapitools.client.model.NullableFieldsMapSuccess; +import org.openapitools.client.model.NullableFieldsValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsMapResponse + */ +public class NullableFieldsMapResponseTest { + private final NullableFieldsMapResponse model = new NullableFieldsMapResponse(); + + /** + * Model tests for NullableFieldsMapResponse + */ + @Test + public void testNullableFieldsMapResponse() { + // TODO: test NullableFieldsMapResponse + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'positions' + */ + @Test + public void positionsTest() { + // TODO: test positions + } + + /** + * Test the property 'reason' + */ + @Test + public void reasonTest() { + // TODO: test reason + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java new file mode 100644 index 000000000000..1a7da93c1d02 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.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.model; + +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 java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsMapSuccess + */ +public class NullableFieldsMapSuccessTest { + private final NullableFieldsMapSuccess model = new NullableFieldsMapSuccess(); + + /** + * Model tests for NullableFieldsMapSuccess + */ + @Test + public void testNullableFieldsMapSuccess() { + // TODO: test NullableFieldsMapSuccess + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'positions' + */ + @Test + public void positionsTest() { + // TODO: test positions + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java new file mode 100644 index 000000000000..660d87943907 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java @@ -0,0 +1,53 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsValue + */ +public class NullableFieldsValueTest { + private final NullableFieldsValue model = new NullableFieldsValue(); + + /** + * Model tests for NullableFieldsValue + */ + @Test + public void testNullableFieldsValue() { + // TODO: test NullableFieldsValue + } + + /** + * Test the property 'before' + */ + @Test + public void beforeTest() { + // TODO: test before + } + + /** + * Test the property 'after' + */ + @Test + public void afterTest() { + // TODO: test after + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableShapeTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableShapeTest.java new file mode 100644 index 000000000000..efe6b60b8d37 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NullableShapeTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableShape + */ +public class NullableShapeTest { + private final NullableShape model = new NullableShape(); + + /** + * Model tests for NullableShape + */ + @Test + public void testNullableShape() { + // TODO: test NullableShape + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NumberOnlyTest.java new file mode 100644 index 000000000000..c795fb91bcb6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/NumberOnlyTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NumberOnly + */ +public class NumberOnlyTest { + private final NumberOnly model = new NumberOnly(); + + /** + * Model tests for NumberOnly + */ + @Test + public void testNumberOnly() { + // TODO: test NumberOnly + } + + /** + * Test the property 'justNumber' + */ + @Test + public void justNumberTest() { + // TODO: test justNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java new file mode 100644 index 000000000000..bb87d7cce319 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.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.model; + +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 java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.DeprecatedObject; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ObjectWithDeprecatedFields + */ +public class ObjectWithDeprecatedFieldsTest { + private final ObjectWithDeprecatedFields model = new ObjectWithDeprecatedFields(); + + /** + * Model tests for ObjectWithDeprecatedFields + */ + @Test + public void testObjectWithDeprecatedFields() { + // TODO: test ObjectWithDeprecatedFields + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'deprecatedRef' + */ + @Test + public void deprecatedRefTest() { + // TODO: test deprecatedRef + } + + /** + * Test the property 'bars' + */ + @Test + public void barsTest() { + // TODO: test bars + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..f5d833787960 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,86 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterCompositeTest.java new file mode 100644 index 000000000000..74fd6fb8ddd4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterCompositeTest.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.model; + +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 java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterComposite + */ +public class OuterCompositeTest { + private final OuterComposite model = new OuterComposite(); + + /** + * Model tests for OuterComposite + */ + @Test + public void testOuterComposite() { + // TODO: test OuterComposite + } + + /** + * Test the property 'myNumber' + */ + @Test + public void myNumberTest() { + // TODO: test myNumber + } + + /** + * Test the property 'myString' + */ + @Test + public void myStringTest() { + // TODO: test myString + } + + /** + * Test the property 'myBoolean' + */ + @Test + public void myBooleanTest() { + // TODO: test myBoolean + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java new file mode 100644 index 000000000000..26eb0d06704e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumDefaultValue + */ +public class OuterEnumDefaultValueTest { + /** + * Model tests for OuterEnumDefaultValue + */ + @Test + public void testOuterEnumDefaultValue() { + // TODO: test OuterEnumDefaultValue + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java new file mode 100644 index 000000000000..27eb226577fa --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumIntegerDefaultValue + */ +public class OuterEnumIntegerDefaultValueTest { + /** + * Model tests for OuterEnumIntegerDefaultValue + */ + @Test + public void testOuterEnumIntegerDefaultValue() { + // TODO: test OuterEnumIntegerDefaultValue + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java new file mode 100644 index 000000000000..fe8515c7b371 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumInteger + */ +public class OuterEnumIntegerTest { + /** + * Model tests for OuterEnumInteger + */ + @Test + public void testOuterEnumInteger() { + // TODO: test OuterEnumInteger + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumTest.java new file mode 100644 index 000000000000..3c94c00a1137 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/OuterEnumTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnum + */ +public class OuterEnumTest { + /** + * Model tests for OuterEnum + */ + @Test + public void testOuterEnum() { + // TODO: test OuterEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ParentPetTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ParentPetTest.java new file mode 100644 index 000000000000..b6b684bb6e7a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ParentPetTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.GrandparentAnimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ParentPet + */ +public class ParentPetTest { + private final ParentPet model = new ParentPet(); + + /** + * Model tests for ParentPet + */ + @Test + public void testParentPet() { + // TODO: test ParentPet + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetCompositionTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetCompositionTest.java new file mode 100644 index 000000000000..10560b2de121 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetCompositionTest.java @@ -0,0 +1,90 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetComposition + */ +public class PetCompositionTest { + private final PetComposition model = new PetComposition(); + + /** + * Model tests for PetComposition + */ + @Test + public void testPetComposition() { + // TODO: test PetComposition + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetRefTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetRefTest.java new file mode 100644 index 000000000000..d4901e70c568 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetRefTest.java @@ -0,0 +1,90 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetRef + */ +public class PetRefTest { + private final PetRef model = new PetRef(); + + /** + * Model tests for PetRef + */ + @Test + public void testPetRef() { + // TODO: test PetRef + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..2d5926b2800c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,90 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java new file mode 100644 index 000000000000..c69284645b08 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java @@ -0,0 +1,90 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetUsingAllOf + */ +public class PetUsingAllOfTest { + private final PetUsingAllOf model = new PetUsingAllOf(); + + /** + * Model tests for PetUsingAllOf + */ + @Test + public void testPetUsingAllOf() { + // TODO: test PetUsingAllOf + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java new file mode 100644 index 000000000000..ff7445466221 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java @@ -0,0 +1,90 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetWithRequiredTags + */ +public class PetWithRequiredTagsTest { + private final PetWithRequiredTags model = new PetWithRequiredTags(); + + /** + * Model tests for PetWithRequiredTags + */ + @Test + public void testPetWithRequiredTags() { + // TODO: test PetWithRequiredTags + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PigTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PigTest.java new file mode 100644 index 000000000000..7d5f6b89618f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PigTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.DanishPig; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pig + */ +public class PigTest { + private final Pig model = new Pig(); + + /** + * Model tests for Pig + */ + @Test + public void testPig() { + // TODO: test Pig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java new file mode 100644 index 000000000000..99665b3ce596 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.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.model; + +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 org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PropertyNameCollision + */ +public class PropertyNameCollisionTest { + private final PropertyNameCollision model = new PropertyNameCollision(); + + /** + * Model tests for PropertyNameCollision + */ + @Test + public void testPropertyNameCollision() { + // TODO: test PropertyNameCollision + } + + /** + * Test the property 'underscoreType' + */ + @Test + public void underscoreTypeTest() { + // TODO: test underscoreType + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'typeWithUnderscore' + */ + @Test + public void typeWithUnderscoreTest() { + // TODO: test typeWithUnderscore + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java new file mode 100644 index 000000000000..8d84f36f726a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java @@ -0,0 +1,45 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for QuadrilateralInterface + */ +public class QuadrilateralInterfaceTest { + private final QuadrilateralInterface model = new QuadrilateralInterface(); + + /** + * Model tests for QuadrilateralInterface + */ + @Test + public void testQuadrilateralInterface() { + // TODO: test QuadrilateralInterface + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/QuadrilateralTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/QuadrilateralTest.java new file mode 100644 index 000000000000..638be47144b1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/QuadrilateralTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Quadrilateral + */ +public class QuadrilateralTest { + private final Quadrilateral model = new Quadrilateral(); + + /** + * Model tests for Quadrilateral + */ + @Test + public void testQuadrilateral() { + // TODO: test Quadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java new file mode 100644 index 000000000000..5494893b547b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java @@ -0,0 +1,53 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadOnlyFirst + */ +public class ReadOnlyFirstTest { + private final ReadOnlyFirst model = new ReadOnlyFirst(); + + /** + * Model tests for ReadOnlyFirst + */ + @Test + public void testReadOnlyFirst() { + // TODO: test ReadOnlyFirst + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'baz' + */ + @Test + public void bazTest() { + // TODO: test baz + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java new file mode 100644 index 000000000000..233dd01f1327 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java @@ -0,0 +1,158 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.client.model.NullableEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for RequiredNullableBody + */ +public class RequiredNullableBodyTest { + private final RequiredNullableBody model = new RequiredNullableBody(); + + /** + * Model tests for RequiredNullableBody + */ + @Test + public void testRequiredNullableBody() { + // TODO: test RequiredNullableBody + } + + /** + * Test the property 'integerProp' + */ + @Test + public void integerPropTest() { + // TODO: test integerProp + } + + /** + * Test the property 'numberProp' + */ + @Test + public void numberPropTest() { + // TODO: test numberProp + } + + /** + * Test the property 'booleanProp' + */ + @Test + public void booleanPropTest() { + // TODO: test booleanProp + } + + /** + * Test the property 'stringProp' + */ + @Test + public void stringPropTest() { + // TODO: test stringProp + } + + /** + * Test the property 'dateProp' + */ + @Test + public void datePropTest() { + // TODO: test dateProp + } + + /** + * Test the property 'datetimeProp' + */ + @Test + public void datetimePropTest() { + // TODO: test datetimeProp + } + + /** + * Test the property 'arrayNullableProp' + */ + @Test + public void arrayNullablePropTest() { + // TODO: test arrayNullableProp + } + + /** + * Test the property 'arrayAndItemsNullableProp' + */ + @Test + public void arrayAndItemsNullablePropTest() { + // TODO: test arrayAndItemsNullableProp + } + + /** + * Test the property 'arrayItemsNullable' + */ + @Test + public void arrayItemsNullableTest() { + // TODO: test arrayItemsNullable + } + + /** + * Test the property 'objectNullableProp' + */ + @Test + public void objectNullablePropTest() { + // TODO: test objectNullableProp + } + + /** + * Test the property 'objectAndItemsNullableProp' + */ + @Test + public void objectAndItemsNullablePropTest() { + // TODO: test objectAndItemsNullableProp + } + + /** + * Test the property 'objectItemsNullable' + */ + @Test + public void objectItemsNullableTest() { + // TODO: test objectItemsNullable + } + + /** + * Test the property 'customRefEnum' + */ + @Test + public void customRefEnumTest() { + // TODO: test customRefEnum + } + + /** + * Test the property 'customEnum' + */ + @Test + public void customEnumTest() { + // TODO: test customEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java new file mode 100644 index 000000000000..bf1d99112e63 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java @@ -0,0 +1,35 @@ +/* + * 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.math.BigDecimal; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ScalarAnyOf + */ +public class ScalarAnyOfTest { + private final ScalarAnyOf model = new ScalarAnyOf(); + + /** + * Model tests for ScalarAnyOf + */ + @Test + public void testScalarAnyOf() { + // TODO: test ScalarAnyOf + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ScalarTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ScalarTest.java new file mode 100644 index 000000000000..e0c971eac8dc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ScalarTest.java @@ -0,0 +1,35 @@ +/* + * 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.math.BigDecimal; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Scalar + */ +public class ScalarTest { + private final Scalar model = new Scalar(); + + /** + * Model tests for Scalar + */ + @Test + public void testScalar() { + // TODO: test Scalar + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java new file mode 100644 index 000000000000..5be4b0b424fb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java @@ -0,0 +1,53 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ScaleneTriangle + */ +public class ScaleneTriangleTest { + private final ScaleneTriangle model = new ScaleneTriangle(); + + /** + * Model tests for ScaleneTriangle + */ + @Test + public void testScaleneTriangle() { + // TODO: test ScaleneTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java new file mode 100644 index 000000000000..4ca8e4e79afc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java @@ -0,0 +1,45 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ShapeInterface + */ +public class ShapeInterfaceTest { + private final ShapeInterface model = new ShapeInterface(); + + /** + * Model tests for ShapeInterface + */ + @Test + public void testShapeInterface() { + // TODO: test ShapeInterface + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java new file mode 100644 index 000000000000..26ef40a13d6e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ShapeOrNull + */ +public class ShapeOrNullTest { + private final ShapeOrNull model = new ShapeOrNull(); + + /** + * Model tests for ShapeOrNull + */ + @Test + public void testShapeOrNull() { + // TODO: test ShapeOrNull + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ShapeTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ShapeTest.java new file mode 100644 index 000000000000..508009e86ccc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ShapeTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Shape + */ +public class ShapeTest { + private final Shape model = new Shape(); + + /** + * Model tests for Shape + */ + @Test + public void testShape() { + // TODO: test Shape + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java new file mode 100644 index 000000000000..4bbb9eeb84e3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java @@ -0,0 +1,53 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SimpleQuadrilateral + */ +public class SimpleQuadrilateralTest { + private final SimpleQuadrilateral model = new SimpleQuadrilateral(); + + /** + * Model tests for SimpleQuadrilateral + */ + @Test + public void testSimpleQuadrilateral() { + // TODO: test SimpleQuadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java new file mode 100644 index 000000000000..15c800ecea0e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SpecialModelName + */ +public class SpecialModelNameTest { + private final SpecialModelName model = new SpecialModelName(); + + /** + * Model tests for SpecialModelName + */ + @Test + public void testSpecialModelName() { + // TODO: test SpecialModelName + } + + /** + * Test the property '$specialPropertyName' + */ + @Test + public void $specialPropertyNameTest() { + // TODO: test $specialPropertyName + } + + /** + * Test the property 'specialModelName' + */ + @Test + public void specialModelNameTest() { + // TODO: test specialModelName + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..afeb24639070 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,53 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java new file mode 100644 index 000000000000..f4a448494316 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TestInlineFreeformAdditionalPropertiesRequest + */ +public class TestInlineFreeformAdditionalPropertiesRequestTest { + private final TestInlineFreeformAdditionalPropertiesRequest model = new TestInlineFreeformAdditionalPropertiesRequest(); + + /** + * Model tests for TestInlineFreeformAdditionalPropertiesRequest + */ + @Test + public void testTestInlineFreeformAdditionalPropertiesRequest() { + // TODO: test TestInlineFreeformAdditionalPropertiesRequest + } + + /** + * Test the property 'someProperty' + */ + @Test + public void somePropertyTest() { + // TODO: test someProperty + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java new file mode 100644 index 000000000000..dd61fbce2007 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java @@ -0,0 +1,45 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TriangleInterface + */ +public class TriangleInterfaceTest { + private final TriangleInterface model = new TriangleInterface(); + + /** + * Model tests for TriangleInterface + */ + @Test + public void testTriangleInterface() { + // TODO: test TriangleInterface + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TriangleTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TriangleTest.java new file mode 100644 index 000000000000..bcb61f7c2b63 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/TriangleTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.EquilateralTriangle; +import org.openapitools.client.model.IsoscelesTriangle; +import org.openapitools.client.model.ScaleneTriangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Triangle + */ +public class TriangleTest { + private final Triangle model = new Triangle(); + + /** + * Model tests for Triangle + */ + @Test + public void testTriangle() { + // TODO: test Triangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..f7b3420f1823 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,137 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.jackson.nullable.JsonNullable; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + + /** + * Test the property 'objectWithNoDeclaredProps' + */ + @Test + public void objectWithNoDeclaredPropsTest() { + // TODO: test objectWithNoDeclaredProps + } + + /** + * Test the property 'objectWithNoDeclaredPropsNullable' + */ + @Test + public void objectWithNoDeclaredPropsNullableTest() { + // TODO: test objectWithNoDeclaredPropsNullable + } + + /** + * Test the property 'anyTypeProp' + */ + @Test + public void anyTypePropTest() { + // TODO: test anyTypeProp + } + + /** + * Test the property 'anyTypePropNullable' + */ + @Test + public void anyTypePropNullableTest() { + // TODO: test anyTypePropNullable + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ValueTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ValueTest.java new file mode 100644 index 000000000000..69a85d2116cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ValueTest.java @@ -0,0 +1,35 @@ +/* + * 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.List; +import org.openapitools.client.model.Scalar; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Value + */ +public class ValueTest { + private final Value model = new Value(); + + /** + * Model tests for Value + */ + @Test + public void testValue() { + // TODO: test Value + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/VariableTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/VariableTest.java new file mode 100644 index 000000000000..569078acad76 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/VariableTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import org.openapitools.client.model.Value; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Variable + */ +public class VariableTest { + private final Variable model = new Variable(); + + /** + * Model tests for Variable + */ + @Test + public void testVariable() { + // TODO: test Variable + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'value' + */ + @Test + public void valueTest() { + // TODO: test value + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/WhaleTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/WhaleTest.java new file mode 100644 index 000000000000..52cd0d63bb72 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/WhaleTest.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.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Whale + */ +public class WhaleTest { + private final Whale model = new Whale(); + + /** + * Model tests for Whale + */ + @Test + public void testWhale() { + // TODO: test Whale + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ZebraTest.java b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ZebraTest.java new file mode 100644 index 000000000000..4af2598a2f78 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jackson3/src/test/java/org/openapitools/client/model/ZebraTest.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Zebra + */ +public class ZebraTest { + private final Zebra model = new Zebra(); + + /** + * Model tests for Zebra + */ + @Test + public void testZebra() { + // TODO: test Zebra + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp-jsonb/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp-jsonb/.gitignore b/samples/client/petstore/java/okhttp-jsonb/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/.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/client/petstore/java/okhttp-jsonb/.openapi-generator-ignore b/samples/client/petstore/java/okhttp-jsonb/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/.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/client/petstore/java/okhttp-jsonb/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-jsonb/.openapi-generator/FILES new file mode 100644 index 000000000000..b42e6848a138 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/.openapi-generator/FILES @@ -0,0 +1,401 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/AdditionalPropertiesClass.md +docs/AllOfModelArrayAnyOf.md +docs/AllOfModelArrayAnyOfAllOfAttributes.md +docs/AllOfModelArrayAnyOfAllOfAttributesC.md +docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md +docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md +docs/AllOfRefToDouble.md +docs/AllOfRefToFloat.md +docs/AllOfRefToLong.md +docs/Animal.md +docs/AnotherFakeApi.md +docs/Apple.md +docs/AppleReq.md +docs/ArrayAnyOf.md +docs/ArrayDefault.md +docs/ArrayOfArrayOfNumberOnly.md +docs/ArrayOfInlineAllOf.md +docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md +docs/ArrayOfNumberOnly.md +docs/ArrayOneOf.md +docs/ArrayTest.md +docs/Banana.md +docs/BananaReq.md +docs/BasquePig.md +docs/Capitalization.md +docs/Cat.md +docs/Category.md +docs/ClassModel.md +docs/Client.md +docs/ComplexQuadrilateral.md +docs/DanishPig.md +docs/DefaultApi.md +docs/DeprecatedObject.md +docs/Dog.md +docs/Drawing.md +docs/EnumArrays.md +docs/EnumClass.md +docs/EnumStringDiscriminator.md +docs/EnumTest.md +docs/EquilateralTriangle.md +docs/FakeAnyOfWIthSameErasureGet200Response.md +docs/FakeApi.md +docs/FakeClassnameTags123Api.md +docs/FakeOneOfWIthSameErasureGet200Response.md +docs/FakeRefParameterPetIdParameter.md +docs/FileSchemaTestClass.md +docs/Foo.md +docs/FooGetDefaultResponse.md +docs/FormatTest.md +docs/FreeFormObjectTestClass.md +docs/FreeFormObjectTestClassProperties.md +docs/Fruit.md +docs/FruitReq.md +docs/GmFruit.md +docs/GrandparentAnimal.md +docs/HasOnlyReadOnly.md +docs/HealthCheckResult.md +docs/IsoscelesTriangle.md +docs/Mammal.md +docs/MammalAnyof.md +docs/MapTest.md +docs/MixedPropertiesAndAdditionalPropertiesClass.md +docs/Model200Response.md +docs/ModelApiResponse.md +docs/ModelFile.md +docs/ModelList.md +docs/ModelReturn.md +docs/ModelWithOneOfAnyOfProperties.md +docs/Name.md +docs/NestedArrayWithDefaultValues.md +docs/NewPet.md +docs/NewPetCategoryInlineAllof.md +docs/NewPetCategoryInlineAllofAllOfCategoryTag.md +docs/NullableClass.md +docs/NullableEnum.md +docs/NullableFieldsMapError.md +docs/NullableFieldsMapResponse.md +docs/NullableFieldsMapSuccess.md +docs/NullableFieldsValue.md +docs/NullableShape.md +docs/NumberOnly.md +docs/ObjectWithDeprecatedFields.md +docs/Order.md +docs/OuterComposite.md +docs/OuterEnum.md +docs/OuterEnumDefaultValue.md +docs/OuterEnumInteger.md +docs/OuterEnumIntegerDefaultValue.md +docs/ParentPet.md +docs/Pet.md +docs/PetApi.md +docs/PetComposition.md +docs/PetRef.md +docs/PetUsingAllOf.md +docs/PetWithRequiredTags.md +docs/Pig.md +docs/PropertyNameCollision.md +docs/Quadrilateral.md +docs/QuadrilateralInterface.md +docs/ReadOnlyFirst.md +docs/RequiredNullableBody.md +docs/Scalar.md +docs/ScalarAnyOf.md +docs/ScaleneTriangle.md +docs/Shape.md +docs/ShapeInterface.md +docs/ShapeOrNull.md +docs/SimpleQuadrilateral.md +docs/SpecialModelName.md +docs/StoreApi.md +docs/Tag.md +docs/TestInlineFreeformAdditionalPropertiesRequest.md +docs/Triangle.md +docs/TriangleInterface.md +docs/User.md +docs/UserApi.md +docs/Value.md +docs/ValuesApi.md +docs/Variable.md +docs/Whale.md +docs/Zebra.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/AnotherFakeApi.java +src/main/java/org/openapitools/client/api/DefaultApi.java +src/main/java/org/openapitools/client/api/FakeApi.java +src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/api/ValuesApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java +src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +src/main/java/org/openapitools/client/model/AllOfRefToLong.java +src/main/java/org/openapitools/client/model/Animal.java +src/main/java/org/openapitools/client/model/Apple.java +src/main/java/org/openapitools/client/model/AppleReq.java +src/main/java/org/openapitools/client/model/ArrayAnyOf.java +src/main/java/org/openapitools/client/model/ArrayDefault.java +src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java +src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java +src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayOneOf.java +src/main/java/org/openapitools/client/model/ArrayTest.java +src/main/java/org/openapitools/client/model/Banana.java +src/main/java/org/openapitools/client/model/BananaReq.java +src/main/java/org/openapitools/client/model/BasquePig.java +src/main/java/org/openapitools/client/model/Capitalization.java +src/main/java/org/openapitools/client/model/Cat.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ClassModel.java +src/main/java/org/openapitools/client/model/Client.java +src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +src/main/java/org/openapitools/client/model/DanishPig.java +src/main/java/org/openapitools/client/model/DeprecatedObject.java +src/main/java/org/openapitools/client/model/Dog.java +src/main/java/org/openapitools/client/model/Drawing.java +src/main/java/org/openapitools/client/model/EnumArrays.java +src/main/java/org/openapitools/client/model/EnumClass.java +src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java +src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/EquilateralTriangle.java +src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java +src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java +src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java +src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +src/main/java/org/openapitools/client/model/FormatTest.java +src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java +src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java +src/main/java/org/openapitools/client/model/Fruit.java +src/main/java/org/openapitools/client/model/FruitReq.java +src/main/java/org/openapitools/client/model/GmFruit.java +src/main/java/org/openapitools/client/model/GrandparentAnimal.java +src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +src/main/java/org/openapitools/client/model/HealthCheckResult.java +src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +src/main/java/org/openapitools/client/model/Mammal.java +src/main/java/org/openapitools/client/model/MammalAnyof.java +src/main/java/org/openapitools/client/model/MapTest.java +src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/Model200Response.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/ModelFile.java +src/main/java/org/openapitools/client/model/ModelList.java +src/main/java/org/openapitools/client/model/ModelReturn.java +src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java +src/main/java/org/openapitools/client/model/Name.java +src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java +src/main/java/org/openapitools/client/model/NewPet.java +src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java +src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java +src/main/java/org/openapitools/client/model/NullableClass.java +src/main/java/org/openapitools/client/model/NullableEnum.java +src/main/java/org/openapitools/client/model/NullableFieldsMapError.java +src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java +src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java +src/main/java/org/openapitools/client/model/NullableFieldsValue.java +src/main/java/org/openapitools/client/model/NullableShape.java +src/main/java/org/openapitools/client/model/NumberOnly.java +src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/OuterComposite.java +src/main/java/org/openapitools/client/model/OuterEnum.java +src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java +src/main/java/org/openapitools/client/model/OuterEnumInteger.java +src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java +src/main/java/org/openapitools/client/model/ParentPet.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/PetComposition.java +src/main/java/org/openapitools/client/model/PetRef.java +src/main/java/org/openapitools/client/model/PetUsingAllOf.java +src/main/java/org/openapitools/client/model/PetWithRequiredTags.java +src/main/java/org/openapitools/client/model/Pig.java +src/main/java/org/openapitools/client/model/PropertyNameCollision.java +src/main/java/org/openapitools/client/model/Quadrilateral.java +src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +src/main/java/org/openapitools/client/model/RequiredNullableBody.java +src/main/java/org/openapitools/client/model/Scalar.java +src/main/java/org/openapitools/client/model/ScalarAnyOf.java +src/main/java/org/openapitools/client/model/ScaleneTriangle.java +src/main/java/org/openapitools/client/model/Shape.java +src/main/java/org/openapitools/client/model/ShapeInterface.java +src/main/java/org/openapitools/client/model/ShapeOrNull.java +src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +src/main/java/org/openapitools/client/model/SpecialModelName.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +src/main/java/org/openapitools/client/model/Triangle.java +src/main/java/org/openapitools/client/model/TriangleInterface.java +src/main/java/org/openapitools/client/model/User.java +src/main/java/org/openapitools/client/model/Value.java +src/main/java/org/openapitools/client/model/Variable.java +src/main/java/org/openapitools/client/model/Whale.java +src/main/java/org/openapitools/client/model/Zebra.java +src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java +src/test/java/org/openapitools/client/api/DefaultApiTest.java +src/test/java/org/openapitools/client/api/FakeApiTest.java +src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/api/ValuesApiTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java +src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java +src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java +src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java +src/test/java/org/openapitools/client/model/AnimalTest.java +src/test/java/org/openapitools/client/model/AppleReqTest.java +src/test/java/org/openapitools/client/model/AppleTest.java +src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java +src/test/java/org/openapitools/client/model/ArrayDefaultTest.java +src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java +src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java +src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayOneOfTest.java +src/test/java/org/openapitools/client/model/ArrayTestTest.java +src/test/java/org/openapitools/client/model/BananaReqTest.java +src/test/java/org/openapitools/client/model/BananaTest.java +src/test/java/org/openapitools/client/model/BasquePigTest.java +src/test/java/org/openapitools/client/model/CapitalizationTest.java +src/test/java/org/openapitools/client/model/CatTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ClassModelTest.java +src/test/java/org/openapitools/client/model/ClientTest.java +src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java +src/test/java/org/openapitools/client/model/DanishPigTest.java +src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java +src/test/java/org/openapitools/client/model/DogTest.java +src/test/java/org/openapitools/client/model/DrawingTest.java +src/test/java/org/openapitools/client/model/EnumArraysTest.java +src/test/java/org/openapitools/client/model/EnumClassTest.java +src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java +src/test/java/org/openapitools/client/model/EnumTestTest.java +src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java +src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java +src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java +src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java +src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java +src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java +src/test/java/org/openapitools/client/model/FooTest.java +src/test/java/org/openapitools/client/model/FormatTestTest.java +src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java +src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java +src/test/java/org/openapitools/client/model/FruitReqTest.java +src/test/java/org/openapitools/client/model/FruitTest.java +src/test/java/org/openapitools/client/model/GmFruitTest.java +src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java +src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java +src/test/java/org/openapitools/client/model/HealthCheckResultTest.java +src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java +src/test/java/org/openapitools/client/model/MammalAnyofTest.java +src/test/java/org/openapitools/client/model/MammalTest.java +src/test/java/org/openapitools/client/model/MapTestTest.java +src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java +src/test/java/org/openapitools/client/model/Model200ResponseTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/ModelFileTest.java +src/test/java/org/openapitools/client/model/ModelListTest.java +src/test/java/org/openapitools/client/model/ModelReturnTest.java +src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java +src/test/java/org/openapitools/client/model/NameTest.java +src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java +src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java +src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java +src/test/java/org/openapitools/client/model/NewPetTest.java +src/test/java/org/openapitools/client/model/NullableClassTest.java +src/test/java/org/openapitools/client/model/NullableEnumTest.java +src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java +src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java +src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java +src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java +src/test/java/org/openapitools/client/model/NullableShapeTest.java +src/test/java/org/openapitools/client/model/NumberOnlyTest.java +src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/OuterCompositeTest.java +src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java +src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java +src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java +src/test/java/org/openapitools/client/model/OuterEnumTest.java +src/test/java/org/openapitools/client/model/ParentPetTest.java +src/test/java/org/openapitools/client/model/PetCompositionTest.java +src/test/java/org/openapitools/client/model/PetRefTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java +src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java +src/test/java/org/openapitools/client/model/PigTest.java +src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java +src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java +src/test/java/org/openapitools/client/model/QuadrilateralTest.java +src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java +src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java +src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java +src/test/java/org/openapitools/client/model/ScalarTest.java +src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java +src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java +src/test/java/org/openapitools/client/model/ShapeOrNullTest.java +src/test/java/org/openapitools/client/model/ShapeTest.java +src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java +src/test/java/org/openapitools/client/model/SpecialModelNameTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java +src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java +src/test/java/org/openapitools/client/model/TriangleTest.java +src/test/java/org/openapitools/client/model/UserTest.java +src/test/java/org/openapitools/client/model/ValueTest.java +src/test/java/org/openapitools/client/model/VariableTest.java +src/test/java/org/openapitools/client/model/WhaleTest.java +src/test/java/org/openapitools/client/model/ZebraTest.java diff --git a/samples/client/petstore/java/okhttp-jsonb/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-jsonb/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-jsonb/.travis.yml b/samples/client/petstore/java/okhttp-jsonb/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/.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/client/petstore/java/okhttp-jsonb/README.md b/samples/client/petstore/java/okhttp-jsonb/README.md new file mode 100644 index 000000000000..faa11e4781f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/README.md @@ -0,0 +1,337 @@ +# petstore-okhttp-jsonb + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-okhttp-jsonb + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-okhttp-jsonb' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp-jsonb' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp-jsonb:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/petstore-okhttp-jsonb-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**getParameterArrayNumber**](docs/AnotherFakeApi.md#getParameterArrayNumber) | **GET** /fake/parameter-array-number | parameter array number default value +*AnotherFakeApi* | [**getParameterStringNumber**](docs/AnotherFakeApi.md#getParameterStringNumber) | **GET** /fake/parameter-string-number | parameter string number +*DefaultApi* | [**fakeAnyOfWIthSameErasureGet**](docs/DefaultApi.md#fakeAnyOfWIthSameErasureGet) | **GET** /fake/anyOfWIthSameErasure | +*DefaultApi* | [**fakeFreeFormQueryParametersGet**](docs/DefaultApi.md#fakeFreeFormQueryParametersGet) | **GET** /fake/free-form-query-parameters | +*DefaultApi* | [**fakeOneOfWIthSameErasureGet**](docs/DefaultApi.md#fakeOneOfWIthSameErasureGet) | **GET** /fake/oneOfWIthSameErasure | +*DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo | +*FakeApi* | [**fakeGetFreeFormObjectGet**](docs/FakeApi.md#fakeGetFreeFormObjectGet) | **GET** /fake/get-free-form-object | +*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +*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* | [**fakeRefParameter**](docs/FakeApi.md#fakeRefParameter) | **POST** /fake/pet/{petId}/reference/parameter | fake reference parameter +*FakeApi* | [**fakeRequiredNullableBodyGet**](docs/FakeApi.md#fakeRequiredNullableBodyGet) | **GET** /fake/required-nullable-body | fields in the response body, required and nullable are both true +*FakeApi* | [**fakeUploadRefRequestBodies**](docs/FakeApi.md#fakeUploadRefRequestBodies) | **POST** /fake/pet/{petId}/uploadImage | fake reference parameter +*FakeApi* | [**getFakeArrayofenums**](docs/FakeApi.md#getFakeArrayofenums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**getFakeHealth**](docs/FakeApi.md#getFakeHealth) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**getParameterNameMapping**](docs/FakeApi.md#getParameterNameMapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test +*FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +*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 +*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testInlineFreeformAdditionalProperties**](docs/FakeApi.md#testInlineFreeformAdditionalProperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testNullableRequiredFieldsAnyOf**](docs/FakeApi.md#testNullableRequiredFieldsAnyOf) | **GET** /fake/nullable-required-fields-anyof | test anyOf with map of objects containing nullable required fields +*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | +*FakeApi* | [**testStringMapReference**](docs/FakeApi.md#testStringMapReference) | **POST** /fake/stringMap-reference | test referenced string map +*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user +*ValuesApi* | [**getSomeValues**](docs/ValuesApi.md#getSomeValues) | **GET** /values | Get some primitive variable values + + +## Documentation for Models + + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AllOfModelArrayAnyOf](docs/AllOfModelArrayAnyOf.md) + - [AllOfModelArrayAnyOfAllOfAttributes](docs/AllOfModelArrayAnyOfAllOfAttributes.md) + - [AllOfModelArrayAnyOfAllOfAttributesC](docs/AllOfModelArrayAnyOfAllOfAttributesC.md) + - [AllOfModelArrayAnyOfAllOfLinkListColumn1](docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md) + - [AllOfModelArrayAnyOfAllOfLinkListColumn1Value](docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md) + - [AllOfRefToDouble](docs/AllOfRefToDouble.md) + - [AllOfRefToFloat](docs/AllOfRefToFloat.md) + - [AllOfRefToLong](docs/AllOfRefToLong.md) + - [Animal](docs/Animal.md) + - [Apple](docs/Apple.md) + - [AppleReq](docs/AppleReq.md) + - [ArrayAnyOf](docs/ArrayAnyOf.md) + - [ArrayDefault](docs/ArrayDefault.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfInlineAllOf](docs/ArrayOfInlineAllOf.md) + - [ArrayOfInlineAllOfArrayAllofDogPropertyInner](docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayOneOf](docs/ArrayOneOf.md) + - [ArrayTest](docs/ArrayTest.md) + - [Banana](docs/Banana.md) + - [BananaReq](docs/BananaReq.md) + - [BasquePig](docs/BasquePig.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [Category](docs/Category.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [ComplexQuadrilateral](docs/ComplexQuadrilateral.md) + - [DanishPig](docs/DanishPig.md) + - [DeprecatedObject](docs/DeprecatedObject.md) + - [Dog](docs/Dog.md) + - [Drawing](docs/Drawing.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumStringDiscriminator](docs/EnumStringDiscriminator.md) + - [EnumTest](docs/EnumTest.md) + - [EquilateralTriangle](docs/EquilateralTriangle.md) + - [FakeAnyOfWIthSameErasureGet200Response](docs/FakeAnyOfWIthSameErasureGet200Response.md) + - [FakeOneOfWIthSameErasureGet200Response](docs/FakeOneOfWIthSameErasureGet200Response.md) + - [FakeRefParameterPetIdParameter](docs/FakeRefParameterPetIdParameter.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) + - [FormatTest](docs/FormatTest.md) + - [FreeFormObjectTestClass](docs/FreeFormObjectTestClass.md) + - [FreeFormObjectTestClassProperties](docs/FreeFormObjectTestClassProperties.md) + - [Fruit](docs/Fruit.md) + - [FruitReq](docs/FruitReq.md) + - [GmFruit](docs/GmFruit.md) + - [GrandparentAnimal](docs/GrandparentAnimal.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [HealthCheckResult](docs/HealthCheckResult.md) + - [IsoscelesTriangle](docs/IsoscelesTriangle.md) + - [Mammal](docs/Mammal.md) + - [MammalAnyof](docs/MammalAnyof.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [ModelFile](docs/ModelFile.md) + - [ModelList](docs/ModelList.md) + - [ModelReturn](docs/ModelReturn.md) + - [ModelWithOneOfAnyOfProperties](docs/ModelWithOneOfAnyOfProperties.md) + - [Name](docs/Name.md) + - [NestedArrayWithDefaultValues](docs/NestedArrayWithDefaultValues.md) + - [NewPet](docs/NewPet.md) + - [NewPetCategoryInlineAllof](docs/NewPetCategoryInlineAllof.md) + - [NewPetCategoryInlineAllofAllOfCategoryTag](docs/NewPetCategoryInlineAllofAllOfCategoryTag.md) + - [NullableClass](docs/NullableClass.md) + - [NullableEnum](docs/NullableEnum.md) + - [NullableFieldsMapError](docs/NullableFieldsMapError.md) + - [NullableFieldsMapResponse](docs/NullableFieldsMapResponse.md) + - [NullableFieldsMapSuccess](docs/NullableFieldsMapSuccess.md) + - [NullableFieldsValue](docs/NullableFieldsValue.md) + - [NullableShape](docs/NullableShape.md) + - [NumberOnly](docs/NumberOnly.md) + - [ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md) + - [OuterEnumInteger](docs/OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) + - [ParentPet](docs/ParentPet.md) + - [Pet](docs/Pet.md) + - [PetComposition](docs/PetComposition.md) + - [PetRef](docs/PetRef.md) + - [PetUsingAllOf](docs/PetUsingAllOf.md) + - [PetWithRequiredTags](docs/PetWithRequiredTags.md) + - [Pig](docs/Pig.md) + - [PropertyNameCollision](docs/PropertyNameCollision.md) + - [Quadrilateral](docs/Quadrilateral.md) + - [QuadrilateralInterface](docs/QuadrilateralInterface.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [RequiredNullableBody](docs/RequiredNullableBody.md) + - [Scalar](docs/Scalar.md) + - [ScalarAnyOf](docs/ScalarAnyOf.md) + - [ScaleneTriangle](docs/ScaleneTriangle.md) + - [Shape](docs/Shape.md) + - [ShapeInterface](docs/ShapeInterface.md) + - [ShapeOrNull](docs/ShapeOrNull.md) + - [SimpleQuadrilateral](docs/SimpleQuadrilateral.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) + - [Triangle](docs/Triangle.md) + - [TriangleInterface](docs/TriangleInterface.md) + - [User](docs/User.md) + - [Value](docs/Value.md) + - [Variable](docs/Variable.md) + - [Whale](docs/Whale.md) + - [Zebra](docs/Zebra.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +### bearer_test + +- **Type**: HTTP Bearer Token authentication (JWT) + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/api/openapi.yaml b/samples/client/petstore/java/okhttp-jsonb/api/openapi.yaml new file mode 100644 index 000000000000..ec6b0d631c06 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/api/openapi.yaml @@ -0,0 +1,3332 @@ +openapi: 3.0.0 +info: + description: "This spec is mainly for testing Petstore server and contains fake\ + \ endpoints, models. Please do not use this for any other purpose. Special characters:\ + \ \" \\" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- description: petstore server + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: "https://localhost:8080/{version}" + variables: + version: + default: v2 + enum: + - v1 + - v2 +- description: The local server without variables + url: https://127.0.0.1/no_variable +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/_foo_get_default_response" + description: response + x-accepts: + - application/json + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + put: + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + servers: + - url: http://petstore.swagger.io/v2 + - url: http://path-server-test.petstore.local/v2 + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + default: [] + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + default: [] + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + - description: Content type header parameter + explode: false + in: header + name: Content-Type + required: false + schema: + type: string + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + default: [] + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-content-type: application/json + x-accepts: + - application/json + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + explode: true + in: query + name: required_string_group + required: true + schema: + type: integer + style: form + - description: Required Boolean in group parameters + explode: false + in: header + name: required_boolean_group + required: true + schema: + type: boolean + style: simple + - description: Required Integer in group parameters + explode: true + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + style: form + - description: String in group parameters + explode: true + in: query + name: string_group + required: false + schema: + type: integer + style: form + - description: Boolean in group parameters + explode: false + in: header + name: boolean_group + required: false + schema: + type: boolean + style: simple + - description: Integer in group parameters + explode: true + in: query + name: int64_group + required: false + schema: + format: int64 + type: integer + style: form + responses: + "400": + description: Something wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + x-accepts: + - application/json + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + required: false + schema: + default: [] + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + default: [] + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_integer + required: false + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_double + required: false + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + style: form + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEnumParameters_request" + responses: + "400": + description: Invalid request + "404": + description: Not found + summary: To test enum parameters + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test "client" model + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEndpointParameters_request" + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterNumber" + description: Input number as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterNumber" + description: Output number + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterString" + description: Input string as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterString" + description: Output string + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Input boolean as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Output boolean + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterComposite" + description: Input composite as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterComposite" + description: Output composite + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/jsonFormData: + get: + description: "" + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testJsonFormData_request" + responses: + "200": + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/additionalProperties-reference: + post: + description: "" + operationId: testAdditionalPropertiesReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FreeFormObject" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/oneOfWIthSameErasure: + get: + description: "Test route, this shouldn't cause a compiler error" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/_fake_oneOfWIthSameErasure_get_200_response" + description: successful response + x-accepts: + - application/json + /fake/nullable-required-fields-anyof: + get: + description: "Tests that anyOf deserialization works when object values contain\ + \ required fields that are nullable (e.g. Record)" + operationId: testNullableRequiredFieldsAnyOf + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/NullableFieldsMapResponse" + description: successful operation + summary: test anyOf with map of objects containing nullable required fields + tags: + - fake + x-accepts: + - application/json + /fake/anyOfWIthSameErasure: + get: + description: "Test route, this shouldn't cause a compiler error" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/_fake_anyOfWIthSameErasure_get_200_response" + description: successful response + x-accepts: + - application/json + /fake/stringMap-reference: + post: + description: "" + operationId: testStringMapReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/MapOfString" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced string map + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/inline-additionalProperties: + post: + description: "" + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + default: [] + type: object + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/inline-freeform-additionalProperties: + post: + description: "" + operationId: testInlineFreeformAdditionalProperties + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/testInlineFreeformAdditionalProperties_request" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline free-form additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - explode: true + in: query + name: query + required: true + schema: + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-file-schema: + put: + description: "For this test, the body for this request much reference a schema\ + \ named `File`." + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FileSchemaTestClass" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/get-free-form-object: + get: + description: Get a free form object or Json string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FreeFormObjectTestClass" + description: Success + tags: + - fake + x-accepts: + - application/json + /fake/free-form-query-parameters: + get: + parameters: + - explode: true + in: query + name: fixed + required: false + schema: + type: string + style: form + - explode: true + in: query + name: free-form + required: false + schema: + type: object + style: form + responses: + "200": + description: OK + x-accepts: + - application/json + /fake/test-query-parameters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: true + in: query + name: pipe + required: true + schema: + default: [] + items: + type: string + type: array + style: form + - explode: false + in: query + name: ioutil + required: true + schema: + default: [] + items: + type: string + type: array + style: form + - explode: false + in: query + name: http + required: true + schema: + default: [] + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + default: [] + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + default: [] + items: + type: string + type: array + style: form + responses: + "200": + description: Success + tags: + - fake + x-accepts: + - application/json + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: "" + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFileWithRequiredFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/HealthCheckResult" + description: The instance started successfully + summary: Health check endpoint + 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 + /fake/parameter-name-mapping: + get: + operationId: getParameterNameMapping + parameters: + - description: _type + explode: false + in: header + name: _type + required: true + schema: + format: int64 + type: integer + style: simple + - description: type + explode: true + in: query + name: type + required: true + schema: + type: string + style: form + - description: type_ + explode: false + in: header + name: type_ + required: true + schema: + type: string + style: simple + responses: + "200": + description: OK + summary: parameter name mapping test + tags: + - fake + x-accepts: + - application/json + /fake/parameter-string-number: + get: + operationId: getParameterStringNumber + parameters: + - description: string number + explode: false + in: header + name: string_number + required: true + schema: + format: number + type: string + style: simple + responses: + "200": + description: OK + summary: parameter string number + tags: + - another_fake + x-accepts: + - application/json + /fake/parameter-array-number: + get: + operationId: getParameterArrayNumber + parameters: + - description: array integer + explode: false + in: header + name: array + required: true + schema: + default: + - 1 + items: + type: integer + type: array + style: simple + responses: + "200": + description: OK + summary: parameter array number default value + tags: + - another_fake + x-accepts: + - application/json + /fake/pet/{petId}/uploadImage: + post: + description: "" + operationId: fake-upload-ref-request-bodies + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: "#/components/requestBodies/upload_body" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: fake reference parameter + tags: + - fake + x-content-type: multipart/form-data + x-accepts: + - application/json + /fake/pet/{petId}/reference/parameter: + post: + description: "" + operationId: fake-ref-parameter + parameters: + - description: to test oneOf in parameter $ref + explode: false + in: path + name: petId + required: true + schema: + $ref: "#/components/schemas/fake_ref_parameter_petId_parameter" + style: simple + responses: + "200": + description: successful operation + summary: fake reference parameter + tags: + - fake + x-accepts: + - application/json + /values: + get: + description: "" + operationId: getSomeValues + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Variable" + description: successful operation + "400": + description: Invalid Value + summary: Get some primitive variable values + tags: + - values + x-accepts: + - application/json + /internal/only: + get: + description: "" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Variable" + description: successful operation + "400": + description: Invalid Value + summary: internal only + tags: + - values + x-internal: true + x-accepts: + - application/json + /fake/required-nullable-body: + get: + description: "" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredNullableBody" + description: success + summary: "fields in the response body, required and nullable are both true" + tags: + - fake + x-accepts: + - application/json +components: + parameters: + pet_id: + description: to test oneOf in parameter $ref + explode: false + in: path + name: petId + required: true + schema: + $ref: "#/components/schemas/fake_ref_parameter_petId_parameter" + style: simple + requestBodies: + upload_body: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + UserArray: + content: + application/json: + examples: + simple-list: + description: Should not get into code examples + summary: Simple list example + value: + - username: foo + - username: bar + schema: + default: [] + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + Pet: + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string + Order: + example: + id: 0 + petId: 6 + quantity: 1 + shipDate: 2020-02-02T20:20:20.000222Z + status: placed + complete: false + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + example: 2020-02-02T20:20:20.000222Z + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + id: 6 + name: default-name + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + id: 0 + username: username + firstName: firstName + lastName: lastName + email: email + password: password + phone: phone + userStatus: 6 + objectWithNoDeclaredProps: "{}" + objectWithNoDeclaredPropsNullable: "{}" + anyTypeProp: "" + anyTypePropNullable: "" + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + objectWithNoDeclaredProps: + description: test code generation for objects Value must be a map of strings + to values. It cannot be the 'null' value. + type: object + objectWithNoDeclaredPropsNullable: + description: test code generation for nullable objects. Value must be a + map of strings to values or the 'null' value. + nullable: true + type: object + anyTypeProp: + description: "test code generation for any type Here the 'type' attribute\ + \ is not specified, which means the value can be anything, including the\ + \ null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389" + anyTypePropNullable: + description: "test code generation for any type Here the 'type' attribute\ + \ is not specified, which means the value can be anything, including the\ + \ null value, string, number, boolean, array or object. The 'nullable'\ + \ attribute does not change the allowed values." + nullable: true + type: object + xml: + name: User + Tag: + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + id: 0 + category: + id: 6 + name: default-name + name: doggie + photoUrls: + - photoUrls + - photoUrls + tags: + - id: 1 + name: name + - id: 1 + name: name + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + "123Number": + readOnly: true + type: integer + required: + - name + xml: + name: Name + "200_response": + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: "#/components/schemas/Animal" + - $ref: "#/components/schemas/Address" + - properties: + declawed: + type: boolean + type: object + Address: + additionalProperties: + type: integer + default: [] + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: "#/components/schemas/Animal" + type: array + format_test: + properties: + integer: + maximum: 100 + minimum: 10 + multipleOf: 2 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + multipleOf: 32.5 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + decimal: + format: number + type: string + string: + pattern: "/[a-z]/i" + type: string + byte: + format: byte + type: string + binary: + 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: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + uuid_with_default: + default: 11111111-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: "^\\d{10}$" + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. + pattern: "/^image_\\d{1,3}$/i" + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_integer_only: + enum: + - 2 + - -2 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: "#/components/schemas/OuterEnum" + outerEnumInteger: + $ref: "#/components/schemas/OuterEnumInteger" + outerEnumDefaultValue: + $ref: "#/components/schemas/OuterEnumDefaultValue" + outerEnumIntegerDefaultValue: + $ref: "#/components/schemas/OuterEnumIntegerDefaultValue" + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + default: [] + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + default: [] + type: object + default: [] + type: object + anytype_1: {} + map_with_undeclared_properties_anytype_1: + type: object + map_with_undeclared_properties_anytype_2: + properties: {} + type: object + map_with_undeclared_properties_anytype_3: + additionalProperties: true + default: [] + type: object + empty_map: + additionalProperties: false + description: "an object with no declared properties and no undeclared properties,\ + \ hence it's an empty map." + type: object + map_with_undeclared_properties_string: + additionalProperties: + type: string + default: [] + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: "#/components/schemas/Animal" + default: [] + type: object + type: object + List: + properties: + "123-list": + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + default: [] + type: object + default: [] + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + default: [] + type: object + direct_map: + additionalProperties: + type: boolean + default: [] + type: object + indirect_map: + additionalProperties: + type: boolean + default: [] + type: object + type: object + ArrayTest: + properties: + array_of_string: + default: [] + items: + type: string + type: array + array_array_of_integer: + default: [] + items: + default: [] + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + default: [] + items: + default: [] + items: + $ref: "#/components/schemas/ReadOnlyFirst" + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + default: [] + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + default: [] + items: + default: [] + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + default: [] + items: + enum: + - fish + - crab + type: string + type: array + type: object + FreeFormObject: + additionalProperties: true + default: [] + description: A schema consisting only of additional properties + type: object + MapOfString: + additionalProperties: + type: string + default: [] + description: A schema consisting only of additional properties of type string + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + - s + - S + nullable: true + type: string + OuterEnumInteger: + deprecated: true + enum: + - 0 + - 1 + - 2 + type: integer + OuterEnumDefaultValue: + default: placed + enum: + - placed + - approved + - delivered + type: string + OuterEnumIntegerDefaultValue: + default: 0 + enum: + - 0 + - 1 + - 2 + type: integer + OuterComposite: + example: + my_number: 0.8008281904610115 + my_string: my_string + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + default: [] + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: "#/components/schemas/File" + files: + default: [] + items: + $ref: "#/components/schemas/File" + type: array + type: object + FreeFormObjectTestClass: + example: + name: name + properties: FreeFormObjectTestClass_properties + properties: + name: + type: string + properties: + $ref: "#/components/schemas/FreeFormObjectTestClass_properties" + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + _special_model.name_: + type: string + xml: + name: "$special[model.name]" + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable + in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage + properties: + NullableMessage: + nullable: true + type: string + type: object + NullableClass: + additionalProperties: + nullable: true + type: object + properties: + integer_prop: + nullable: true + type: integer + number_prop: + nullable: true + type: number + boolean_prop: + nullable: true + type: boolean + string_prop: + nullable: true + type: string + date_prop: + format: date + nullable: true + type: string + datetime_prop: + format: date-time + nullable: true + type: string + array_nullable_prop: + items: + type: object + nullable: true + type: array + array_and_items_nullable_prop: + items: + nullable: true + type: object + nullable: true + type: array + array_items_nullable: + default: [] + items: + nullable: true + type: object + type: array + object_nullable_prop: + additionalProperties: + type: object + nullable: true + type: object + object_and_items_nullable_prop: + additionalProperties: + nullable: true + type: object + nullable: true + type: object + object_items_nullable: + additionalProperties: + nullable: true + type: object + default: [] + type: object + type: object + fruit: + additionalProperties: false + oneOf: + - $ref: "#/components/schemas/apple" + - $ref: "#/components/schemas/banana" + properties: + color: + type: string + apple: + nullable: true + properties: + cultivar: + pattern: "^[a-zA-Z\\s]*$" + type: string + origin: + pattern: "/^[A-Z\\s]*$/i" + type: string + type: object + banana: + properties: + lengthCm: + type: number + type: object + mammal: + discriminator: + propertyName: className + oneOf: + - $ref: "#/components/schemas/whale" + - $ref: "#/components/schemas/zebra" + - $ref: "#/components/schemas/Pig" + mammal_anyof: + anyOf: + - $ref: "#/components/schemas/whale" + - $ref: "#/components/schemas/zebra" + - $ref: "#/components/schemas/Pig" + discriminator: + propertyName: className + whale: + properties: + hasBaleen: + type: boolean + hasTeeth: + type: boolean + className: + type: string + required: + - className + type: object + zebra: + additionalProperties: true + properties: + type: + enum: + - plains + - mountain + - grevys + type: string + className: + type: string + required: + - className + type: object + Pig: + discriminator: + propertyName: className + oneOf: + - $ref: "#/components/schemas/BasquePig" + - $ref: "#/components/schemas/DanishPig" + BasquePig: + properties: + className: + type: string + required: + - className + type: object + DanishPig: + properties: + className: + type: string + required: + - className + type: object + gmFruit: + additionalProperties: false + anyOf: + - $ref: "#/components/schemas/apple" + - $ref: "#/components/schemas/banana" + properties: + color: + type: string + fruitReq: + additionalProperties: false + nullable: true + oneOf: + - $ref: "#/components/schemas/appleReq" + - $ref: "#/components/schemas/bananaReq" + appleReq: + additionalProperties: false + properties: + cultivar: + type: string + mealy: + type: boolean + required: + - cultivar + type: object + bananaReq: + additionalProperties: false + properties: + lengthCm: + type: number + sweet: + type: boolean + required: + - lengthCm + type: object + Drawing: + additionalProperties: + $ref: "#/components/schemas/fruit" + properties: + mainShape: + $ref: "#/components/schemas/Shape" + shapeOrNull: + $ref: "#/components/schemas/ShapeOrNull" + nullableShape: + $ref: "#/components/schemas/NullableShape" + shapes: + default: [] + items: + $ref: "#/components/schemas/Shape" + type: array + type: object + Shape: + discriminator: + propertyName: shapeType + oneOf: + - $ref: "#/components/schemas/Triangle" + - $ref: "#/components/schemas/Quadrilateral" + ShapeOrNull: + description: The value may be a shape or the 'null' value. This is introduced + in OAS schema >= 3.1. + discriminator: + propertyName: shapeType + nullable: true + oneOf: + - $ref: "#/components/schemas/Triangle" + - $ref: "#/components/schemas/Quadrilateral" + NullableShape: + description: The value may be a shape or the 'null' value. The 'nullable' attribute + was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema + >= 3.1. + discriminator: + propertyName: shapeType + nullable: true + oneOf: + - $ref: "#/components/schemas/Triangle" + - $ref: "#/components/schemas/Quadrilateral" + ShapeInterface: + properties: + shapeType: + type: string + required: + - shapeType + TriangleInterface: + properties: + triangleType: + type: string + required: + - triangleType + Triangle: + discriminator: + propertyName: triangleType + oneOf: + - $ref: "#/components/schemas/EquilateralTriangle" + - $ref: "#/components/schemas/IsoscelesTriangle" + - $ref: "#/components/schemas/ScaleneTriangle" + EquilateralTriangle: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/TriangleInterface" + IsoscelesTriangle: + additionalProperties: false + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/TriangleInterface" + ScaleneTriangle: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/TriangleInterface" + QuadrilateralInterface: + properties: + quadrilateralType: + type: string + required: + - quadrilateralType + Quadrilateral: + discriminator: + propertyName: quadrilateralType + oneOf: + - $ref: "#/components/schemas/SimpleQuadrilateral" + - $ref: "#/components/schemas/ComplexQuadrilateral" + SimpleQuadrilateral: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/QuadrilateralInterface" + ComplexQuadrilateral: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/QuadrilateralInterface" + GrandparentAnimal: + discriminator: + propertyName: pet_type + properties: + pet_type: + type: string + required: + - pet_type + type: object + ParentPet: + allOf: + - $ref: "#/components/schemas/GrandparentAnimal" + type: object + ArrayOfEnums: + default: [] + items: + $ref: "#/components/schemas/OuterEnum" + type: array + DateTimeTest: + default: 2010-01-01T10:10:10.000111+01:00 + example: 2010-01-01T10:10:10.000111+01:00 + format: date-time + type: string + DeprecatedObject: + deprecated: true + properties: + name: + type: string + type: object + ObjectWithDeprecatedFields: + properties: + uuid: + type: string + id: + deprecated: true + type: number + deprecatedRef: + $ref: "#/components/schemas/DeprecatedObject" + bars: + default: [] + deprecated: true + items: + $ref: "#/components/schemas/Bar" + type: array + type: object + PetWithRequiredTags: + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + - tags + type: object + xml: + name: Pet + ArrayOfInlineAllOf: + properties: + id: + format: int64 + type: integer + name: + example: doggie + type: string + array_allof_dog_property: + default: [] + items: + $ref: "#/components/schemas/ArrayOfInlineAllOf_array_allof_dog_property_inner" + type: array + required: + - name + type: object + EnumStringDiscriminator: + description: An object to test discriminator of enum string + discriminator: + propertyName: enum_str_type + properties: + enum_str_type: + description: enum string type + enum: + - type_a + - type_b + type: string + required: + - enum_str_type + type: object + ArrayDefault: + properties: + WithDefaultEmptyBracket: + default: [] + items: + type: string + type: array + WithoutDefault: + default: [] + items: + type: string + type: array + Variable: + description: Value object + example: + name: variable_1 + value: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + properties: + name: + example: variable_1 + type: string + value: + $ref: "#/components/schemas/Value" + required: + - name + - value + Value: + oneOf: + - $ref: "#/components/schemas/Scalar" + - $ref: "#/components/schemas/Array" + Scalar: + description: Values of scalar type + oneOf: + - format: uuid + type: string + - maxLength: 1089 + type: string + - type: number + - type: boolean + ScalarAnyOf: + anyOf: + - format: uuid + type: string + - maxLength: 1089 + type: string + - type: number + - type: boolean + description: Values of scalar type using anyOf + Array: + default: [] + description: Values of array type + items: + $ref: "#/components/schemas/Scalar" + minItems: 1 + type: array + NewPet: + properties: + id: + format: int64 + type: integer + x-is-unique: true + category_inline_allof: + $ref: "#/components/schemas/NewPet_category_inline_allof" + category_allOf_ref: + allOf: + - $ref: "#/components/schemas/Category" + category_allOf_ref_description: + allOf: + - $ref: "#/components/schemas/Category" + description: | + Adding description to property using allOf + category_allOf_ref_description_readonly: + allOf: + - $ref: "#/components/schemas/Category" + description: | + Adding description to readonly property using allOf + readOnly: true + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + allOf: + - $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + PropertyNameCollision: + properties: + _type: + type: string + type: + type: string + type_: + type: string + type: object + x-internal: false + InteralOnly: + properties: + type: + type: string + type: object + x-internal: true + AllOfModelArrayAnyOf: + allOf: + - $ref: "#/components/schemas/Category" + - properties: + linkListColumn1: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_linkListColumn1" + attributes: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_attributes" + type: object + PetUsingAllOf: + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + allOf: + - $ref: "#/components/schemas/Category" + description: | + multi line description + 2nd line + last line + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + allOf: + - $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + PetComposition: + allOf: + - $ref: "#/components/schemas/Pet" + PetRef: + properties: + id: + $ref: "#/components/schemas/Pet/properties/id" + category: + $ref: "#/components/schemas/Pet/properties/category" + name: + $ref: "#/components/schemas/Pet/properties/name" + photoUrls: + $ref: "#/components/schemas/Pet/properties/photoUrls" + tags: + $ref: "#/components/schemas/Pet/properties/tags" + status: + $ref: "#/components/schemas/Pet/properties/status" + required: + - name + - photoUrls + type: object + xml: + name: Pet + ArrayOneOf: + oneOf: + - type: integer + - default: [] + items: + type: string + type: array + ArrayAnyOf: + anyOf: + - type: integer + - default: [] + items: + type: string + type: array + ModelWithOneOfAnyOfProperties: + properties: + oneof_prop: + $ref: "#/components/schemas/ArrayOneOf" + anyof_prop: + $ref: "#/components/schemas/ArrayAnyOf" + type: object + NullableEnum: + enum: + - custom + nullable: true + type: string + RequiredNullableBody: + allOf: + - $ref: "#/components/schemas/NullableClass" + - properties: + custom_ref_enum: + $ref: "#/components/schemas/NullableEnum" + custom_enum: + enum: + - custom + nullable: true + type: string + required: + - array_and_items_nullable_prop + - array_items_nullable + - array_nullable_prop + - boolean_prop + - custom_enum + - custom_ref_enum + - date_prop + - datetime_prop + - integer_prop + - number_prop + - object_and_items_nullable_prop + - object_items_nullable + - object_nullable_prop + - string_prop + type: object + example: + integer_prop: 0 + number_prop: 6.027456183070403 + boolean_prop: true + string_prop: string_prop + date_prop: 2000-01-23 + datetime_prop: 2000-01-23T04:56:07.000+00:00 + array_nullable_prop: + - "{}" + - "{}" + array_and_items_nullable_prop: + - "{}" + - "{}" + array_items_nullable: + - "{}" + - "{}" + object_nullable_prop: + key: "{}" + object_and_items_nullable_prop: + key: "{}" + object_items_nullable: + key: "{}" + custom_ref_enum: custom + custom_enum: custom + NestedArrayWithDefaultValues: + properties: + nestedArray: + default: + - - h1 + - Header 1 + - - h2 + - Header 2 + - - h3 + - Header 3 + - - h4 + - Header 4 + items: + default: + - value1 + - value2 + items: + type: string + type: array + type: array + type: object + LongId: + description: Id as long + format: int64 + type: integer + Weight: + description: Weight as float + format: float + type: number + Height: + description: Height as double + format: double + type: number + AllOfRefToLong: + description: Object with allOf ref to long + properties: + id: + allOf: + - $ref: "#/components/schemas/LongId" + default: 10 + type: object + AllOfRefToFloat: + description: Object with allOf ref to float + properties: + weight: + allOf: + - $ref: "#/components/schemas/Weight" + default: 7.89 + type: object + AllOfRefToDouble: + description: Object with allOf ref to double + properties: + height: + allOf: + - $ref: "#/components/schemas/Height" + default: 32.1 + type: object + NullableFieldsValue: + description: Object with required but nullable string fields + example: + before: before + after: after + properties: + before: + nullable: true + type: string + after: + nullable: true + type: string + required: + - after + - before + type: object + NullableFieldsMapSuccess: + additionalProperties: false + description: Success response containing a map of objects with nullable fields + example: + status: status + positions: + key: + before: before + after: after + properties: + status: + type: string + positions: + additionalProperties: + $ref: "#/components/schemas/NullableFieldsValue" + type: object + required: + - positions + - status + type: object + NullableFieldsMapError: + additionalProperties: false + description: Error response + properties: + status: + type: string + reason: + type: string + required: + - reason + - status + type: object + NullableFieldsMapResponse: + anyOf: + - $ref: "#/components/schemas/NullableFieldsMapSuccess" + - $ref: "#/components/schemas/NullableFieldsMapError" + _foo_get_default_response: + example: + string: + bar: bar + properties: + string: + $ref: "#/components/schemas/Foo" + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request: + properties: + enum_form_string_array: + default: [] + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + testEndpointParameters_request: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: "/[a-z]/i" + type: string + pattern_without_delimiter: + description: None + pattern: "^[A-Z].*" + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + 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: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + _fake_oneOfWIthSameErasure_get_200_response: + oneOf: + - default: [] + items: + type: string + type: array + - default: [] + items: + type: integer + type: array + _fake_anyOfWIthSameErasure_get_200_response: + anyOf: + - default: [] + items: + type: string + type: array + - default: [] + items: + type: integer + type: array + testInlineFreeformAdditionalProperties_request: + additionalProperties: true + properties: + someProperty: + type: string + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + fake_ref_parameter_petId_parameter: + oneOf: + - type: string + - type: integer + FreeFormObjectTestClass_properties: + oneOf: + - type: string + - additionalProperties: true + default: [] + type: object + ArrayOfInlineAllOf_array_allof_dog_property_inner: + allOf: + - properties: + breed: + type: string + type: object + - properties: + color: + type: string + type: object + NewPet_category_inline_allof_allOf_category_tag: + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + NewPet_category_inline_allof: + allOf: + - properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + category_tag: + $ref: "#/components/schemas/NewPet_category_inline_allof_allOf_category_tag" + required: + - name + type: object + AllOfModelArrayAnyOf_allOf_linkListColumn1_value: + anyOf: + - $ref: "#/components/schemas/User" + - $ref: "#/components/schemas/Tag" + AllOfModelArrayAnyOf_allOf_linkListColumn1: + properties: + value: + default: [] + items: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_linkListColumn1_value" + type: array + required: + - value + type: object + AllOfModelArrayAnyOf_allOf_attributes_C: + oneOf: + - $ref: "#/components/schemas/Pet" + - $ref: "#/components/schemas/Order" + AllOfModelArrayAnyOf_allOf_attributes: + properties: + C: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_attributes_C" + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http + diff --git a/samples/client/petstore/java/okhttp-jsonb/build.gradle b/samples/client/petstore/java/okhttp-jsonb/build.gradle new file mode 100644 index 000000000000..b1efba74b4a0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/build.gradle @@ -0,0 +1,67 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-okhttp-jsonb' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "2.1.1" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'jakarta.json.bind:jakarta.json.bind-api:3.0.1' + implementation 'org.eclipse:yasson:3.0.4' + implementation 'jakarta.json:jakarta.json-api:2.1.3' + implementation 'org.eclipse.parsson:parsson:1.1.7' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.18.0' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/build.sbt b/samples/client/petstore/java/okhttp-jsonb/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-jsonb/docs/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..83051d9be44b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/AdditionalPropertiesClass.md @@ -0,0 +1,20 @@ + + +# AdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapProperty** | **Map<String, String>** | | [optional] | +|**mapOfMapProperty** | **Map<String, Map<String, String>>** | | [optional] | +|**anytype1** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype3** | **Map<String, Object>** | | [optional] | +|**emptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] | +|**mapWithUndeclaredPropertiesString** | **Map<String, String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOf.md b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOf.md new file mode 100644 index 000000000000..96dc5a34d089 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOf.md @@ -0,0 +1,16 @@ + + +# AllOfModelArrayAnyOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | +|**linkListColumn1** | [**AllOfModelArrayAnyOfAllOfLinkListColumn1**](AllOfModelArrayAnyOfAllOfLinkListColumn1.md) | | [optional] | +|**attributes** | [**AllOfModelArrayAnyOfAllOfAttributes**](AllOfModelArrayAnyOfAllOfAttributes.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfAttributes.md b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfAttributes.md new file mode 100644 index 000000000000..c9096e515367 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfAttributes.md @@ -0,0 +1,13 @@ + + +# AllOfModelArrayAnyOfAllOfAttributes + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**C** | [**AllOfModelArrayAnyOfAllOfAttributesC**](AllOfModelArrayAnyOfAllOfAttributesC.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfAttributesC.md b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfAttributesC.md new file mode 100644 index 000000000000..5229de89b299 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfAttributesC.md @@ -0,0 +1,32 @@ + + +# AllOfModelArrayAnyOfAllOfAttributesC + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md new file mode 100644 index 000000000000..43fa9b696377 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md @@ -0,0 +1,13 @@ + + +# AllOfModelArrayAnyOfAllOfLinkListColumn1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**value** | [**List<AllOfModelArrayAnyOfAllOfLinkListColumn1Value>**](AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md) | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md new file mode 100644 index 000000000000..6379cac28b02 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md @@ -0,0 +1,25 @@ + + +# AllOfModelArrayAnyOfAllOfLinkListColumn1Value + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | +|**objectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] | +|**objectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] | +|**anyTypeProp** | **Object** | 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 | [optional] | +|**anyTypePropNullable** | **Object** | 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. | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/AllOfRefToDouble.md b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfRefToDouble.md new file mode 100644 index 000000000000..516584f74348 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfRefToDouble.md @@ -0,0 +1,14 @@ + + +# AllOfRefToDouble + +Object with allOf ref to double + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**height** | **Double** | Height as double | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/AllOfRefToFloat.md b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfRefToFloat.md new file mode 100644 index 000000000000..9a60af8a2ea4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfRefToFloat.md @@ -0,0 +1,14 @@ + + +# AllOfRefToFloat + +Object with allOf ref to float + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**weight** | **Float** | Weight as float | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/AllOfRefToLong.md b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfRefToLong.md new file mode 100644 index 000000000000..0f32d49b0857 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/AllOfRefToLong.md @@ -0,0 +1,14 @@ + + +# AllOfRefToLong + +Object with allOf ref to long + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | Id as long | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Animal.md b/samples/client/petstore/java/okhttp-jsonb/docs/Animal.md new file mode 100644 index 000000000000..d9b32f14c88a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Animal.md @@ -0,0 +1,14 @@ + + +# Animal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | +|**color** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/AnotherFakeApi.md b/samples/client/petstore/java/okhttp-jsonb/docs/AnotherFakeApi.md new file mode 100644 index 000000000000..6cca209c72b1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/AnotherFakeApi.md @@ -0,0 +1,191 @@ +# AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags | +| [**getParameterArrayNumber**](AnotherFakeApi.md#getParameterArrayNumber) | **GET** /fake/parameter-array-number | parameter array number default value | +| [**getParameterStringNumber**](AnotherFakeApi.md#getParameterStringNumber) | **GET** /fake/parameter-string-number | parameter string number | + + + +# **call123testSpecialTags** +> Client call123testSpecialTags(client) + +To test special tags + +To test special tags and operation ID starting with number + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getParameterArrayNumber** +> getParameterArrayNumber(array) + +parameter array number default value + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + List array = Arrays.asList(); // List | array integer + try { + apiInstance.getParameterArrayNumber(array); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#getParameterArrayNumber"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **array** | [**List<Integer>**](Integer.md)| array integer | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +# **getParameterStringNumber** +> getParameterStringNumber(stringNumber) + +parameter string number + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + BigDecimal stringNumber = new BigDecimal(78); // BigDecimal | string number + try { + apiInstance.getParameterStringNumber(stringNumber); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#getParameterStringNumber"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **stringNumber** | **BigDecimal**| string number | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Apple.md b/samples/client/petstore/java/okhttp-jsonb/docs/Apple.md new file mode 100644 index 000000000000..0ef7a92c74d6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Apple.md @@ -0,0 +1,14 @@ + + +# Apple + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | [optional] | +|**origin** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/AppleReq.md b/samples/client/petstore/java/okhttp-jsonb/docs/AppleReq.md new file mode 100644 index 000000000000..989e1cfedd1e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/AppleReq.md @@ -0,0 +1,14 @@ + + +# AppleReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | | +|**mealy** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ArrayAnyOf.md b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayAnyOf.md new file mode 100644 index 000000000000..86bb944833ac --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayAnyOf.md @@ -0,0 +1,12 @@ + + +# ArrayAnyOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ArrayDefault.md b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayDefault.md new file mode 100644 index 000000000000..b539cb294d74 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayDefault.md @@ -0,0 +1,14 @@ + + +# ArrayDefault + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**withDefaultEmptyBracket** | **List<String>** | | [optional] | +|**withoutDefault** | **List<String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..0188db3eb131 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayArrayNumber** | **List<List<BigDecimal>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfInlineAllOf.md b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfInlineAllOf.md new file mode 100644 index 000000000000..3efa4933a3b9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfInlineAllOf.md @@ -0,0 +1,15 @@ + + +# ArrayOfInlineAllOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | +|**arrayAllofDogProperty** | [**List<ArrayOfInlineAllOfArrayAllofDogPropertyInner>**](ArrayOfInlineAllOfArrayAllofDogPropertyInner.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md new file mode 100644 index 000000000000..35f349597734 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md @@ -0,0 +1,14 @@ + + +# ArrayOfInlineAllOfArrayAllofDogPropertyInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | +|**color** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..a5753530aada --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayNumber** | **List<BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOneOf.md b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOneOf.md new file mode 100644 index 000000000000..34727d5f7301 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayOneOf.md @@ -0,0 +1,12 @@ + + +# ArrayOneOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ArrayTest.md b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayTest.md new file mode 100644 index 000000000000..36077c9df300 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ArrayTest.md @@ -0,0 +1,15 @@ + + +# ArrayTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayOfString** | **List<String>** | | [optional] | +|**arrayArrayOfInteger** | **List<List<Long>>** | | [optional] | +|**arrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Banana.md b/samples/client/petstore/java/okhttp-jsonb/docs/Banana.md new file mode 100644 index 000000000000..5356d17ee700 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Banana.md @@ -0,0 +1,13 @@ + + +# Banana + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**lengthCm** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/BananaReq.md b/samples/client/petstore/java/okhttp-jsonb/docs/BananaReq.md new file mode 100644 index 000000000000..22ebe1a7105f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/BananaReq.md @@ -0,0 +1,14 @@ + + +# BananaReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**lengthCm** | **BigDecimal** | | | +|**sweet** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/BasquePig.md b/samples/client/petstore/java/okhttp-jsonb/docs/BasquePig.md new file mode 100644 index 000000000000..160cb71c321f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/BasquePig.md @@ -0,0 +1,13 @@ + + +# BasquePig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Capitalization.md b/samples/client/petstore/java/okhttp-jsonb/docs/Capitalization.md new file mode 100644 index 000000000000..82a812711de2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Capitalization.md @@ -0,0 +1,18 @@ + + +# Capitalization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**smallCamel** | **String** | | [optional] | +|**capitalCamel** | **String** | | [optional] | +|**smallSnake** | **String** | | [optional] | +|**capitalSnake** | **String** | | [optional] | +|**scAETHFlowPoints** | **String** | | [optional] | +|**ATT_NAME** | **String** | Name of the pet | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Cat.md b/samples/client/petstore/java/okhttp-jsonb/docs/Cat.md new file mode 100644 index 000000000000..390dd519c8ce --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Cat.md @@ -0,0 +1,13 @@ + + +# Cat + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**declawed** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Category.md b/samples/client/petstore/java/okhttp-jsonb/docs/Category.md new file mode 100644 index 000000000000..ab6d1ec334dc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Category.md @@ -0,0 +1,14 @@ + + +# Category + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ClassModel.md b/samples/client/petstore/java/okhttp-jsonb/docs/ClassModel.md new file mode 100644 index 000000000000..af46dea1f6c8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ClassModel.md @@ -0,0 +1,14 @@ + + +# ClassModel + +Model for testing model with \"_class\" property + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Client.md b/samples/client/petstore/java/okhttp-jsonb/docs/Client.md new file mode 100644 index 000000000000..ef07b4ab8b9d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Client.md @@ -0,0 +1,13 @@ + + +# Client + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**client** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ComplexQuadrilateral.md b/samples/client/petstore/java/okhttp-jsonb/docs/ComplexQuadrilateral.md new file mode 100644 index 000000000000..d0a4b1a0a758 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ComplexQuadrilateral.md @@ -0,0 +1,14 @@ + + +# ComplexQuadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/DanishPig.md b/samples/client/petstore/java/okhttp-jsonb/docs/DanishPig.md new file mode 100644 index 000000000000..0b366d3cf2ff --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/DanishPig.md @@ -0,0 +1,13 @@ + + +# DanishPig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/DefaultApi.md b/samples/client/petstore/java/okhttp-jsonb/docs/DefaultApi.md new file mode 100644 index 000000000000..b0835fc23cf1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/DefaultApi.md @@ -0,0 +1,245 @@ +# DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fakeAnyOfWIthSameErasureGet**](DefaultApi.md#fakeAnyOfWIthSameErasureGet) | **GET** /fake/anyOfWIthSameErasure | | +| [**fakeFreeFormQueryParametersGet**](DefaultApi.md#fakeFreeFormQueryParametersGet) | **GET** /fake/free-form-query-parameters | | +| [**fakeOneOfWIthSameErasureGet**](DefaultApi.md#fakeOneOfWIthSameErasureGet) | **GET** /fake/oneOfWIthSameErasure | | +| [**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | | + + + +# **fakeAnyOfWIthSameErasureGet** +> FakeAnyOfWIthSameErasureGet200Response fakeAnyOfWIthSameErasureGet() + + + +Test route, this shouldn't cause a compiler error + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + FakeAnyOfWIthSameErasureGet200Response result = apiInstance.fakeAnyOfWIthSameErasureGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fakeAnyOfWIthSameErasureGet"); + 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 + +[**FakeAnyOfWIthSameErasureGet200Response**](FakeAnyOfWIthSameErasureGet200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful response | - | + + +# **fakeFreeFormQueryParametersGet** +> fakeFreeFormQueryParametersGet(fixed, freeForm) + + + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + String fixed = "fixed_example"; // String | + Object freeForm = null; // Object | + try { + apiInstance.fakeFreeFormQueryParametersGet(fixed, freeForm); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fakeFreeFormQueryParametersGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **fixed** | **String**| | [optional] | +| **freeForm** | [**Object**](.md)| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +# **fakeOneOfWIthSameErasureGet** +> FakeOneOfWIthSameErasureGet200Response fakeOneOfWIthSameErasureGet() + + + +Test route, this shouldn't cause a compiler error + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + FakeOneOfWIthSameErasureGet200Response result = apiInstance.fakeOneOfWIthSameErasureGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fakeOneOfWIthSameErasureGet"); + 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 + +[**FakeOneOfWIthSameErasureGet200Response**](FakeOneOfWIthSameErasureGet200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful response | - | + + +# **fooGet** +> FooGetDefaultResponse fooGet() + + + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + FooGetDefaultResponse result = apiInstance.fooGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fooGet"); + 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 + +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/DeprecatedObject.md b/samples/client/petstore/java/okhttp-jsonb/docs/DeprecatedObject.md new file mode 100644 index 000000000000..48de1d624425 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/DeprecatedObject.md @@ -0,0 +1,13 @@ + + +# DeprecatedObject + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Dog.md b/samples/client/petstore/java/okhttp-jsonb/docs/Dog.md new file mode 100644 index 000000000000..972c981c0d05 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Dog.md @@ -0,0 +1,13 @@ + + +# Dog + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Drawing.md b/samples/client/petstore/java/okhttp-jsonb/docs/Drawing.md new file mode 100644 index 000000000000..6b815fc4131b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Drawing.md @@ -0,0 +1,16 @@ + + +# Drawing + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mainShape** | [**Shape**](Shape.md) | | [optional] | +|**shapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] | +|**nullableShape** | [**NullableShape**](NullableShape.md) | | [optional] | +|**shapes** | [**List<Shape>**](Shape.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/EnumArrays.md b/samples/client/petstore/java/okhttp-jsonb/docs/EnumArrays.md new file mode 100644 index 000000000000..b2222d5beb25 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/EnumArrays.md @@ -0,0 +1,32 @@ + + +# EnumArrays + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] | +|**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] | + + + +## Enum: JustSymbolEnum + +| Name | Value | +|---- | -----| +| GREATER_THAN_OR_EQUAL_TO | ">=" | +| DOLLAR | "$" | + + + +## Enum: List<ArrayEnumEnum> + +| Name | Value | +|---- | -----| +| FISH | "fish" | +| CRAB | "crab" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/EnumClass.md b/samples/client/petstore/java/okhttp-jsonb/docs/EnumClass.md new file mode 100644 index 000000000000..b314590a7591 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/EnumClass.md @@ -0,0 +1,15 @@ + + +# EnumClass + +## Enum + + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/EnumStringDiscriminator.md b/samples/client/petstore/java/okhttp-jsonb/docs/EnumStringDiscriminator.md new file mode 100644 index 000000000000..83aebcdb4226 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/EnumStringDiscriminator.md @@ -0,0 +1,23 @@ + + +# EnumStringDiscriminator + +An object to test discriminator of enum string + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**enumStrType** | [**EnumStrTypeEnum**](#EnumStrTypeEnum) | enum string type | | + + + +## Enum: EnumStrTypeEnum + +| Name | Value | +|---- | -----| +| A | "type_a" | +| B | "type_b" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/EnumTest.md b/samples/client/petstore/java/okhttp-jsonb/docs/EnumTest.md new file mode 100644 index 000000000000..3e226e18b50b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/EnumTest.md @@ -0,0 +1,68 @@ + + +# EnumTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] | +|**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | | +|**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] | +|**enumIntegerOnly** | [**EnumIntegerOnlyEnum**](#EnumIntegerOnlyEnum) | | [optional] | +|**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] | +|**outerEnum** | **OuterEnum** | | [optional] | +|**outerEnumInteger** | **OuterEnumInteger** | | [optional] | +|**outerEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] | +|**outerEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] | + + + +## Enum: EnumStringEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumStringRequiredEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumIntegerEnum + +| Name | Value | +|---- | -----| +| NUMBER_1 | 1 | +| NUMBER_MINUS_1 | -1 | + + + +## Enum: EnumIntegerOnlyEnum + +| Name | Value | +|---- | -----| +| NUMBER_2 | 2 | +| NUMBER_MINUS_2 | -2 | + + + +## Enum: EnumNumberEnum + +| Name | Value | +|---- | -----| +| NUMBER_1_DOT_1 | 1.1 | +| NUMBER_MINUS_1_DOT_2 | -1.2 | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/EquilateralTriangle.md b/samples/client/petstore/java/okhttp-jsonb/docs/EquilateralTriangle.md new file mode 100644 index 000000000000..eade817feb3e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/EquilateralTriangle.md @@ -0,0 +1,14 @@ + + +# EquilateralTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/FakeAnyOfWIthSameErasureGet200Response.md b/samples/client/petstore/java/okhttp-jsonb/docs/FakeAnyOfWIthSameErasureGet200Response.md new file mode 100644 index 000000000000..c224eb3d572f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/FakeAnyOfWIthSameErasureGet200Response.md @@ -0,0 +1,12 @@ + + +# FakeAnyOfWIthSameErasureGet200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/FakeApi.md b/samples/client/petstore/java/okhttp-jsonb/docs/FakeApi.md new file mode 100644 index 000000000000..00d888ebe6e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/FakeApi.md @@ -0,0 +1,1571 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fakeGetFreeFormObjectGet**](FakeApi.md#fakeGetFreeFormObjectGet) | **GET** /fake/get-free-form-object | | +| [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | +| [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | | +| [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | | +| [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | | +| [**fakeRefParameter**](FakeApi.md#fakeRefParameter) | **POST** /fake/pet/{petId}/reference/parameter | fake reference parameter | +| [**fakeRequiredNullableBodyGet**](FakeApi.md#fakeRequiredNullableBodyGet) | **GET** /fake/required-nullable-body | fields in the response body, required and nullable are both true | +| [**fakeUploadRefRequestBodies**](FakeApi.md#fakeUploadRefRequestBodies) | **POST** /fake/pet/{petId}/uploadImage | fake reference parameter | +| [**getFakeArrayofenums**](FakeApi.md#getFakeArrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**getFakeHealth**](FakeApi.md#getFakeHealth) | **GET** /fake/health | Health check endpoint | +| [**getParameterNameMapping**](FakeApi.md#getParameterNameMapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test | +| [**testAdditionalPropertiesReference**](FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | +| [**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 | +| [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 | +| [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters | +| [**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) | +| [**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties | +| [**testInlineFreeformAdditionalProperties**](FakeApi.md#testInlineFreeformAdditionalProperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties | +| [**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data | +| [**testNullableRequiredFieldsAnyOf**](FakeApi.md#testNullableRequiredFieldsAnyOf) | **GET** /fake/nullable-required-fields-anyof | test anyOf with map of objects containing nullable required fields | +| [**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | | +| [**testStringMapReference**](FakeApi.md#testStringMapReference) | **POST** /fake/stringMap-reference | test referenced string map | + + + +# **fakeGetFreeFormObjectGet** +> FreeFormObjectTestClass fakeGetFreeFormObjectGet() + + + +Get a free form object or Json string + +### 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 { + FreeFormObjectTestClass result = apiInstance.fakeGetFreeFormObjectGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeGetFreeFormObjectGet"); + 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 + +[**FreeFormObjectTestClass**](FreeFormObjectTestClass.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### 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); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **Boolean**| Input boolean as post body | [optional] | + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(outerComposite) + + + +Test serialization of object with outer number type + +### 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); + OuterComposite outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(outerComposite); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] | + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### 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); + BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **BigDecimal**| Input number as post body | [optional] | + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### 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); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **String**| Input string as post body | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + + +# **fakeRefParameter** +> fakeRefParameter(petId) + +fake reference parameter + + + +### 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); + FakeRefParameterPetIdParameter petId = new FakeRefParameterPetIdParameter(); // FakeRefParameterPetIdParameter | to test oneOf in parameter $ref + try { + apiInstance.fakeRefParameter(petId); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeRefParameter"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | [**FakeRefParameterPetIdParameter**](.md)| to test oneOf in parameter $ref | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **fakeRequiredNullableBodyGet** +> RequiredNullableBody fakeRequiredNullableBodyGet() + +fields in the response body, required and nullable are both true + + + +### 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 { + RequiredNullableBody result = apiInstance.fakeRequiredNullableBodyGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeRequiredNullableBodyGet"); + 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 + +[**RequiredNullableBody**](RequiredNullableBody.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | success | - | + + +# **fakeUploadRefRequestBodies** +> ModelApiResponse fakeUploadRefRequestBodies(petId, additionalMetadata, _file) + +fake reference parameter + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.fakeUploadRefRequestBodies(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeUploadRefRequestBodies"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getFakeArrayofenums** +> List<OuterEnum> getFakeArrayofenums() + +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.getFakeArrayofenums(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getFakeArrayofenums"); + 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 | - | + + +# **getFakeHealth** +> HealthCheckResult getFakeHealth() + +Health check endpoint + +### 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 { + HealthCheckResult result = apiInstance.getFakeHealth(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getFakeHealth"); + 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 + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | The instance started successfully | - | + + +# **getParameterNameMapping** +> getParameterNameMapping(underscoreType, type, typeWithUnderscore) + +parameter name mapping test + +### 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); + Long underscoreType = 56L; // Long | _type + String type = "type_example"; // String | type + String typeWithUnderscore = "typeWithUnderscore_example"; // String | type_ + try { + apiInstance.getParameterNameMapping(underscoreType, type, typeWithUnderscore); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getParameterNameMapping"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **underscoreType** | **Long**| _type | | +| **type** | **String**| type | | +| **typeWithUnderscore** | **String**| type_ | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +# **testAdditionalPropertiesReference** +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### 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); + Map requestBody = null; // Map | request body + try { + apiInstance.testAdditionalPropertiesReference(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testAdditionalPropertiesReference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, Object>**](Object.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +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); + FileSchemaTestClass fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(fileSchemaTestClass); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(query, user) + + + +### 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); + String query = "query_example"; // String | + User user = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, user); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **query** | **String**| | | +| **user** | [**User**](User.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testClientModel** +> Client testClientModel(client) + +To test \"client\" model + +To test \"client\" model + +### 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); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testEndpointParameters** +> testEndpointParameters(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 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(78); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = LocalDate.now(); // LocalDate | None + OffsetDateTime dateTime = OffsetDateTime.parse("2010-02-01T10:20:10.111110+01:00"); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **number** | **BigDecimal**| None | | +| **_double** | **Double**| None | | +| **patternWithoutDelimiter** | **String**| None | | +| **_byte** | **byte[]**| None | | +| **integer** | **Integer**| None | [optional] | +| **int32** | **Integer**| None | [optional] | +| **int64** | **Long**| None | [optional] | +| **_float** | **Float**| None | [optional] | +| **string** | **String**| None | [optional] | +| **binary** | **File**| None | [optional] | +| **date** | **LocalDate**| None | [optional] | +| **dateTime** | **OffsetDateTime**| None | [optional] [default to 2010-02-01T10:20:10.111110+01:00] | +| **password** | **String**| None | [optional] | +| **paramCallback** | **String**| None | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **testEnumParameters** +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### 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); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "_abc"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "_abc"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 1; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 1.1D; // Double | Query parameter enum test (double) + List enumFormStringArray = Arrays.asList("$"); // List | Form parameter enum test (string array) + String enumFormString = "_abc"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] | +| **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] | +| **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] | +| **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] | +| **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] | +| **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + + +# **testGroupParameters** +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group).stringGroup(stringGroup).booleanGroup(booleanGroup).int64Group(int64Group).execute(); + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP bearer authorization: bearer_test + HttpBearerAuth bearer_test = (HttpBearerAuth) defaultClient.getAuthentication("bearer_test"); + bearer_test.setBearerToken("BEARER TOKEN"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requiredStringGroup** | **Integer**| Required String in group parameters | | +| **requiredBooleanGroup** | **Boolean**| Required Boolean in group parameters | | +| **requiredInt64Group** | **Long**| Required Integer in group parameters | | +| **stringGroup** | **Integer**| String in group parameters | [optional] | +| **booleanGroup** | **Boolean**| Boolean in group parameters | [optional] | +| **int64Group** | **Long**| Integer in group parameters | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Something wrong | - | + + +# **testInlineAdditionalProperties** +> testInlineAdditionalProperties(requestBody) + +test inline additionalProperties + + + +### 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); + Map requestBody = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, String>**](String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testInlineFreeformAdditionalProperties** +> testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + + + +### 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); + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = new TestInlineFreeformAdditionalPropertiesRequest(); // TestInlineFreeformAdditionalPropertiesRequest | request body + try { + apiInstance.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineFreeformAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + + + +### 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); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **param** | **String**| field1 | | +| **param2** | **String**| field2 | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testNullableRequiredFieldsAnyOf** +> NullableFieldsMapResponse testNullableRequiredFieldsAnyOf() + +test anyOf with map of objects containing nullable required fields + +Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + +### 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 { + NullableFieldsMapResponse result = apiInstance.testNullableRequiredFieldsAnyOf(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testNullableRequiredFieldsAnyOf"); + 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 + +[**NullableFieldsMapResponse**](NullableFieldsMapResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + + +To test the collection format in query parameters + +### 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); + List pipe = Arrays.asList(); // List | + List ioutil = Arrays.asList(); // List | + List http = Arrays.asList(); // List | + List url = Arrays.asList(); // List | + List context = Arrays.asList(); // List | + try { + apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pipe** | [**List<String>**](String.md)| | | +| **ioutil** | [**List<String>**](String.md)| | | +| **http** | [**List<String>**](String.md)| | | +| **url** | [**List<String>**](String.md)| | | +| **context** | [**List<String>**](String.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testStringMapReference** +> testStringMapReference(requestBody) + +test referenced string map + + + +### 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); + Map requestBody = new HashMap(); // Map | request body + try { + apiInstance.testStringMapReference(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testStringMapReference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, String>**](String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/okhttp-jsonb/docs/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..95a8c171fc34 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/FakeClassnameTags123Api.md @@ -0,0 +1,78 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case | + + + +# **testClassname** +> Client testClassname(client) + +To test class name in snake case + +To test class name in snake case + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); + + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/FakeOneOfWIthSameErasureGet200Response.md b/samples/client/petstore/java/okhttp-jsonb/docs/FakeOneOfWIthSameErasureGet200Response.md new file mode 100644 index 000000000000..0a3fbf6f8fca --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/FakeOneOfWIthSameErasureGet200Response.md @@ -0,0 +1,12 @@ + + +# FakeOneOfWIthSameErasureGet200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/FakeRefParameterPetIdParameter.md b/samples/client/petstore/java/okhttp-jsonb/docs/FakeRefParameterPetIdParameter.md new file mode 100644 index 000000000000..1328d3c125c4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/FakeRefParameterPetIdParameter.md @@ -0,0 +1,12 @@ + + +# FakeRefParameterPetIdParameter + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/FileSchemaTestClass.md b/samples/client/petstore/java/okhttp-jsonb/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..85d1a0636694 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/FileSchemaTestClass.md @@ -0,0 +1,14 @@ + + +# FileSchemaTestClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_file** | [**ModelFile**](ModelFile.md) | | [optional] | +|**files** | [**List<ModelFile>**](ModelFile.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Foo.md b/samples/client/petstore/java/okhttp-jsonb/docs/Foo.md new file mode 100644 index 000000000000..6b3f0556528a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Foo.md @@ -0,0 +1,13 @@ + + +# Foo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/FooGetDefaultResponse.md b/samples/client/petstore/java/okhttp-jsonb/docs/FooGetDefaultResponse.md new file mode 100644 index 000000000000..ff3d7a3a56c3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/FooGetDefaultResponse.md @@ -0,0 +1,13 @@ + + +# FooGetDefaultResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**string** | [**Foo**](Foo.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/FormatTest.md b/samples/client/petstore/java/okhttp-jsonb/docs/FormatTest.md new file mode 100644 index 000000000000..71790022c16d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/FormatTest.md @@ -0,0 +1,29 @@ + + +# FormatTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integer** | **Integer** | | [optional] | +|**int32** | **Integer** | | [optional] | +|**int64** | **Long** | | [optional] | +|**number** | **BigDecimal** | | | +|**_float** | **Float** | | [optional] | +|**_double** | **Double** | | [optional] | +|**decimal** | **BigDecimal** | | [optional] | +|**string** | **String** | | [optional] | +|**_byte** | **byte[]** | | | +|**binary** | **File** | | [optional] | +|**date** | **LocalDate** | | | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**uuid** | **UUID** | | [optional] | +|**uuidWithDefault** | **UUID** | | [optional] | +|**password** | **String** | | | +|**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] | +|**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/FreeFormObjectTestClass.md b/samples/client/petstore/java/okhttp-jsonb/docs/FreeFormObjectTestClass.md new file mode 100644 index 000000000000..3bb6144bc90b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/FreeFormObjectTestClass.md @@ -0,0 +1,14 @@ + + +# FreeFormObjectTestClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**properties** | [**FreeFormObjectTestClassProperties**](FreeFormObjectTestClassProperties.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/FreeFormObjectTestClassProperties.md b/samples/client/petstore/java/okhttp-jsonb/docs/FreeFormObjectTestClassProperties.md new file mode 100644 index 000000000000..8a7c9d2838a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/FreeFormObjectTestClassProperties.md @@ -0,0 +1,12 @@ + + +# FreeFormObjectTestClassProperties + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Fruit.md b/samples/client/petstore/java/okhttp-jsonb/docs/Fruit.md new file mode 100644 index 000000000000..f1915ef9b5b6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Fruit.md @@ -0,0 +1,16 @@ + + +# Fruit + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**color** | **String** | | [optional] | +|**cultivar** | **String** | | [optional] | +|**origin** | **String** | | [optional] | +|**lengthCm** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/FruitReq.md b/samples/client/petstore/java/okhttp-jsonb/docs/FruitReq.md new file mode 100644 index 000000000000..859a881b53ec --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/FruitReq.md @@ -0,0 +1,16 @@ + + +# FruitReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | | +|**mealy** | **Boolean** | | [optional] | +|**lengthCm** | **BigDecimal** | | | +|**sweet** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/GmFruit.md b/samples/client/petstore/java/okhttp-jsonb/docs/GmFruit.md new file mode 100644 index 000000000000..1a301bf9600a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/GmFruit.md @@ -0,0 +1,16 @@ + + +# GmFruit + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**color** | **String** | | [optional] | +|**cultivar** | **String** | | [optional] | +|**origin** | **String** | | [optional] | +|**lengthCm** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/GrandparentAnimal.md b/samples/client/petstore/java/okhttp-jsonb/docs/GrandparentAnimal.md new file mode 100644 index 000000000000..9737408f2724 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/GrandparentAnimal.md @@ -0,0 +1,13 @@ + + +# GrandparentAnimal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**petType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/okhttp-jsonb/docs/HasOnlyReadOnly.md new file mode 100644 index 000000000000..29da5205dbba --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/HasOnlyReadOnly.md @@ -0,0 +1,14 @@ + + +# HasOnlyReadOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**foo** | **String** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/HealthCheckResult.md b/samples/client/petstore/java/okhttp-jsonb/docs/HealthCheckResult.md new file mode 100644 index 000000000000..4885e6f1cada --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/HealthCheckResult.md @@ -0,0 +1,14 @@ + + +# HealthCheckResult + +Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**nullableMessage** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/IsoscelesTriangle.md b/samples/client/petstore/java/okhttp-jsonb/docs/IsoscelesTriangle.md new file mode 100644 index 000000000000..0bd5045bc68f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/IsoscelesTriangle.md @@ -0,0 +1,14 @@ + + +# IsoscelesTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Mammal.md b/samples/client/petstore/java/okhttp-jsonb/docs/Mammal.md new file mode 100644 index 000000000000..71f0fce48839 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Mammal.md @@ -0,0 +1,26 @@ + + +# Mammal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasBaleen** | **Boolean** | | [optional] | +|**hasTeeth** | **Boolean** | | [optional] | +|**className** | **String** | | | +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| PLAINS | "plains" | +| MOUNTAIN | "mountain" | +| GREVYS | "grevys" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/MammalAnyof.md b/samples/client/petstore/java/okhttp-jsonb/docs/MammalAnyof.md new file mode 100644 index 000000000000..7a366e10da49 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/MammalAnyof.md @@ -0,0 +1,26 @@ + + +# MammalAnyof + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasBaleen** | **Boolean** | | [optional] | +|**hasTeeth** | **Boolean** | | [optional] | +|**className** | **String** | | | +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| PLAINS | "plains" | +| MOUNTAIN | "mountain" | +| GREVYS | "grevys" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/MapTest.md b/samples/client/petstore/java/okhttp-jsonb/docs/MapTest.md new file mode 100644 index 000000000000..54380188e1d6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/MapTest.md @@ -0,0 +1,25 @@ + + +# MapTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapMapOfString** | **Map<String, Map<String, String>>** | | [optional] | +|**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] | +|**directMap** | **Map<String, Boolean>** | | [optional] | +|**indirectMap** | **Map<String, Boolean>** | | [optional] | + + + +## Enum: Map<String, InnerEnum> + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-jsonb/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..a5ddf0faa6a9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,15 @@ + + +# MixedPropertiesAndAdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **UUID** | | [optional] | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**map** | [**Map<String, Animal>**](Animal.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Model200Response.md b/samples/client/petstore/java/okhttp-jsonb/docs/Model200Response.md new file mode 100644 index 000000000000..109411580c62 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Model200Response.md @@ -0,0 +1,15 @@ + + +# Model200Response + +Model for testing model name starting with number + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | [optional] | +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-jsonb/docs/ModelApiResponse.md new file mode 100644 index 000000000000..e374c2dd2dec --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ModelApiResponse.md @@ -0,0 +1,15 @@ + + +# ModelApiResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ModelFile.md b/samples/client/petstore/java/okhttp-jsonb/docs/ModelFile.md new file mode 100644 index 000000000000..adcde984f527 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ModelFile.md @@ -0,0 +1,14 @@ + + +# ModelFile + +Must be named `File` for test. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**sourceURI** | **String** | Test capitalization | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ModelList.md b/samples/client/petstore/java/okhttp-jsonb/docs/ModelList.md new file mode 100644 index 000000000000..f93ab7dde8d4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ModelList.md @@ -0,0 +1,13 @@ + + +# ModelList + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_123list** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ModelReturn.md b/samples/client/petstore/java/okhttp-jsonb/docs/ModelReturn.md new file mode 100644 index 000000000000..0bd356861eb7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ModelReturn.md @@ -0,0 +1,14 @@ + + +# ModelReturn + +Model for testing reserved words + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_return** | **Integer** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ModelWithOneOfAnyOfProperties.md b/samples/client/petstore/java/okhttp-jsonb/docs/ModelWithOneOfAnyOfProperties.md new file mode 100644 index 000000000000..64c1206365fd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ModelWithOneOfAnyOfProperties.md @@ -0,0 +1,14 @@ + + +# ModelWithOneOfAnyOfProperties + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**oneofProp** | [**ArrayOneOf**](ArrayOneOf.md) | | [optional] | +|**anyofProp** | [**ArrayAnyOf**](ArrayAnyOf.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Name.md b/samples/client/petstore/java/okhttp-jsonb/docs/Name.md new file mode 100644 index 000000000000..c901d9435309 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Name.md @@ -0,0 +1,17 @@ + + +# Name + +Model for testing model name same as property name + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | | +|**snakeCase** | **Integer** | | [optional] [readonly] | +|**property** | **String** | | [optional] | +|**_123number** | **Integer** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/NestedArrayWithDefaultValues.md b/samples/client/petstore/java/okhttp-jsonb/docs/NestedArrayWithDefaultValues.md new file mode 100644 index 000000000000..c5f272f1cb30 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/NestedArrayWithDefaultValues.md @@ -0,0 +1,13 @@ + + +# NestedArrayWithDefaultValues + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**nestedArray** | **List<List<String>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/NewPet.md b/samples/client/petstore/java/okhttp-jsonb/docs/NewPet.md new file mode 100644 index 000000000000..3cfa8c0076fe --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/NewPet.md @@ -0,0 +1,31 @@ + + +# NewPet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**categoryInlineAllof** | [**NewPetCategoryInlineAllof**](NewPetCategoryInlineAllof.md) | | [optional] | +|**categoryAllOfRef** | [**Category**](Category.md) | | [optional] | +|**categoryAllOfRefDescription** | [**Category**](Category.md) | Adding description to property using allOf | [optional] | +|**categoryAllOfRefDescriptionReadonly** | [**Category**](Category.md) | Adding description to readonly property using allOf | [optional] [readonly] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/NewPetCategoryInlineAllof.md b/samples/client/petstore/java/okhttp-jsonb/docs/NewPetCategoryInlineAllof.md new file mode 100644 index 000000000000..7e8872f8132d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/NewPetCategoryInlineAllof.md @@ -0,0 +1,15 @@ + + +# NewPetCategoryInlineAllof + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | +|**categoryTag** | [**NewPetCategoryInlineAllofAllOfCategoryTag**](NewPetCategoryInlineAllofAllOfCategoryTag.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md b/samples/client/petstore/java/okhttp-jsonb/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md new file mode 100644 index 000000000000..d685440279e9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md @@ -0,0 +1,14 @@ + + +# NewPetCategoryInlineAllofAllOfCategoryTag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/NullableClass.md b/samples/client/petstore/java/okhttp-jsonb/docs/NullableClass.md new file mode 100644 index 000000000000..fa98c5c6d984 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/NullableClass.md @@ -0,0 +1,24 @@ + + +# NullableClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integerProp** | **Integer** | | [optional] | +|**numberProp** | **BigDecimal** | | [optional] | +|**booleanProp** | **Boolean** | | [optional] | +|**stringProp** | **String** | | [optional] | +|**dateProp** | **LocalDate** | | [optional] | +|**datetimeProp** | **OffsetDateTime** | | [optional] | +|**arrayNullableProp** | **List<Object>** | | [optional] | +|**arrayAndItemsNullableProp** | **List<Object>** | | [optional] | +|**arrayItemsNullable** | **List<Object>** | | [optional] | +|**objectNullableProp** | **Map<String, Object>** | | [optional] | +|**objectAndItemsNullableProp** | **Map<String, Object>** | | [optional] | +|**objectItemsNullable** | **Map<String, Object>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/NullableEnum.md b/samples/client/petstore/java/okhttp-jsonb/docs/NullableEnum.md new file mode 100644 index 000000000000..774c8d6b1d70 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/NullableEnum.md @@ -0,0 +1,11 @@ + + +# NullableEnum + +## Enum + + +* `CUSTOM` (value: `"custom"`) + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsMapError.md b/samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsMapError.md new file mode 100644 index 000000000000..c129f355904a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsMapError.md @@ -0,0 +1,15 @@ + + +# NullableFieldsMapError + +Error response + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | | +|**reason** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsMapResponse.md b/samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsMapResponse.md new file mode 100644 index 000000000000..de7b03be5807 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsMapResponse.md @@ -0,0 +1,15 @@ + + +# NullableFieldsMapResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | | +|**positions** | [**Map<String, NullableFieldsValue>**](NullableFieldsValue.md) | | | +|**reason** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsMapSuccess.md b/samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsMapSuccess.md new file mode 100644 index 000000000000..0ce60cd148f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsMapSuccess.md @@ -0,0 +1,15 @@ + + +# NullableFieldsMapSuccess + +Success response containing a map of objects with nullable fields + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | | +|**positions** | [**Map<String, NullableFieldsValue>**](NullableFieldsValue.md) | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsValue.md b/samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsValue.md new file mode 100644 index 000000000000..397f73f74007 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/NullableFieldsValue.md @@ -0,0 +1,15 @@ + + +# NullableFieldsValue + +Object with required but nullable string fields + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**before** | **String** | | | +|**after** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/NullableShape.md b/samples/client/petstore/java/okhttp-jsonb/docs/NullableShape.md new file mode 100644 index 000000000000..9d40680fd2c2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/NullableShape.md @@ -0,0 +1,16 @@ + + +# NullableShape + +The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/NumberOnly.md b/samples/client/petstore/java/okhttp-jsonb/docs/NumberOnly.md new file mode 100644 index 000000000000..b8ed1a4cfae1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/NumberOnly.md @@ -0,0 +1,13 @@ + + +# NumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justNumber** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ObjectWithDeprecatedFields.md b/samples/client/petstore/java/okhttp-jsonb/docs/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..f1cf571f4c09 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ObjectWithDeprecatedFields.md @@ -0,0 +1,16 @@ + + +# ObjectWithDeprecatedFields + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **String** | | [optional] | +|**id** | **BigDecimal** | | [optional] | +|**deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] | +|**bars** | **List<String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Order.md b/samples/client/petstore/java/okhttp-jsonb/docs/Order.md new file mode 100644 index 000000000000..27af32855c5c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Order.md @@ -0,0 +1,28 @@ + + +# Order + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/OuterComposite.md b/samples/client/petstore/java/okhttp-jsonb/docs/OuterComposite.md new file mode 100644 index 000000000000..98b56e0763ff --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/OuterComposite.md @@ -0,0 +1,15 @@ + + +# OuterComposite + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**myNumber** | **BigDecimal** | | [optional] | +|**myString** | **String** | | [optional] | +|**myBoolean** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/OuterEnum.md b/samples/client/petstore/java/okhttp-jsonb/docs/OuterEnum.md new file mode 100644 index 000000000000..e9228f060d25 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/OuterEnum.md @@ -0,0 +1,19 @@ + + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + +* `LOWER_CASE_S` (value: `"s"`) + +* `UPPER_CASE_S` (value: `"S"`) + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/OuterEnumDefaultValue.md b/samples/client/petstore/java/okhttp-jsonb/docs/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..cbc7f4ba54d2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/OuterEnumDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumDefaultValue + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/OuterEnumInteger.md b/samples/client/petstore/java/okhttp-jsonb/docs/OuterEnumInteger.md new file mode 100644 index 000000000000..f71dea30ad00 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/OuterEnumInteger.md @@ -0,0 +1,15 @@ + + +# OuterEnumInteger + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/java/okhttp-jsonb/docs/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..99e6389f4278 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumIntegerDefaultValue + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ParentPet.md b/samples/client/petstore/java/okhttp-jsonb/docs/ParentPet.md new file mode 100644 index 000000000000..4992b88a6710 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ParentPet.md @@ -0,0 +1,12 @@ + + +# ParentPet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Pet.md b/samples/client/petstore/java/okhttp-jsonb/docs/Pet.md new file mode 100644 index 000000000000..08dfd8623602 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Pet.md @@ -0,0 +1,28 @@ + + +# Pet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/PetApi.md b/samples/client/petstore/java/okhttp-jsonb/docs/PetApi.md new file mode 100644 index 000000000000..c7fa83cbbb77 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/PetApi.md @@ -0,0 +1,640 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | +| [**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) | + + + +# **addPet** +> addPet(pet) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(pet); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +# **updatePet** +> updatePet(pet) + +Update an existing pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(pet); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, contentType, additionalMetadata, _file) + +uploads an image + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String contentType = "contentType_example"; // String | Content type header parameter + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, contentType, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **contentType** | **String**| Content type header parameter | [optional] | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **uploadFileWithRequiredFile** +> ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **requiredFile** | **File**| file to upload | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/PetComposition.md b/samples/client/petstore/java/okhttp-jsonb/docs/PetComposition.md new file mode 100644 index 000000000000..3f93a8972ddc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/PetComposition.md @@ -0,0 +1,28 @@ + + +# PetComposition + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/PetRef.md b/samples/client/petstore/java/okhttp-jsonb/docs/PetRef.md new file mode 100644 index 000000000000..256faf704c49 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/PetRef.md @@ -0,0 +1,28 @@ + + +# PetRef + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/PetUsingAllOf.md b/samples/client/petstore/java/okhttp-jsonb/docs/PetUsingAllOf.md new file mode 100644 index 000000000000..379da2dc359f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/PetUsingAllOf.md @@ -0,0 +1,28 @@ + + +# PetUsingAllOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | multi line description 2nd line last line | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/PetWithRequiredTags.md b/samples/client/petstore/java/okhttp-jsonb/docs/PetWithRequiredTags.md new file mode 100644 index 000000000000..2f528f536e99 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/PetWithRequiredTags.md @@ -0,0 +1,28 @@ + + +# PetWithRequiredTags + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Pig.md b/samples/client/petstore/java/okhttp-jsonb/docs/Pig.md new file mode 100644 index 000000000000..61079c61c498 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Pig.md @@ -0,0 +1,13 @@ + + +# Pig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/PropertyNameCollision.md b/samples/client/petstore/java/okhttp-jsonb/docs/PropertyNameCollision.md new file mode 100644 index 000000000000..28775f9b7481 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/PropertyNameCollision.md @@ -0,0 +1,15 @@ + + +# PropertyNameCollision + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**underscoreType** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**typeWithUnderscore** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Quadrilateral.md b/samples/client/petstore/java/okhttp-jsonb/docs/Quadrilateral.md new file mode 100644 index 000000000000..af9f89a6f710 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Quadrilateral.md @@ -0,0 +1,14 @@ + + +# Quadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/QuadrilateralInterface.md b/samples/client/petstore/java/okhttp-jsonb/docs/QuadrilateralInterface.md new file mode 100644 index 000000000000..99451f3bd020 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/QuadrilateralInterface.md @@ -0,0 +1,13 @@ + + +# QuadrilateralInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ReadOnlyFirst.md b/samples/client/petstore/java/okhttp-jsonb/docs/ReadOnlyFirst.md new file mode 100644 index 000000000000..ad6af7ee155f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ReadOnlyFirst.md @@ -0,0 +1,14 @@ + + +# ReadOnlyFirst + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**baz** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/RequiredNullableBody.md b/samples/client/petstore/java/okhttp-jsonb/docs/RequiredNullableBody.md new file mode 100644 index 000000000000..b732ff05be76 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/RequiredNullableBody.md @@ -0,0 +1,34 @@ + + +# RequiredNullableBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integerProp** | **Integer** | | | +|**numberProp** | **BigDecimal** | | | +|**booleanProp** | **Boolean** | | | +|**stringProp** | **String** | | | +|**dateProp** | **LocalDate** | | | +|**datetimeProp** | **OffsetDateTime** | | | +|**arrayNullableProp** | **List<Object>** | | | +|**arrayAndItemsNullableProp** | **List<Object>** | | | +|**arrayItemsNullable** | **List<Object>** | | | +|**objectNullableProp** | **Map<String, Object>** | | | +|**objectAndItemsNullableProp** | **Map<String, Object>** | | | +|**objectItemsNullable** | **Map<String, Object>** | | | +|**customRefEnum** | **NullableEnum** | | | +|**customEnum** | [**CustomEnumEnum**](#CustomEnumEnum) | | | + + + +## Enum: CustomEnumEnum + +| Name | Value | +|---- | -----| +| CUSTOM | "custom" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Scalar.md b/samples/client/petstore/java/okhttp-jsonb/docs/Scalar.md new file mode 100644 index 000000000000..45dbf799e91f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Scalar.md @@ -0,0 +1,13 @@ + + +# Scalar + +Values of scalar type + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ScalarAnyOf.md b/samples/client/petstore/java/okhttp-jsonb/docs/ScalarAnyOf.md new file mode 100644 index 000000000000..767e9196023d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ScalarAnyOf.md @@ -0,0 +1,13 @@ + + +# ScalarAnyOf + +Values of scalar type using anyOf + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ScaleneTriangle.md b/samples/client/petstore/java/okhttp-jsonb/docs/ScaleneTriangle.md new file mode 100644 index 000000000000..c578f6cbfaab --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ScaleneTriangle.md @@ -0,0 +1,14 @@ + + +# ScaleneTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Shape.md b/samples/client/petstore/java/okhttp-jsonb/docs/Shape.md new file mode 100644 index 000000000000..51549d7b67f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Shape.md @@ -0,0 +1,15 @@ + + +# Shape + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ShapeInterface.md b/samples/client/petstore/java/okhttp-jsonb/docs/ShapeInterface.md new file mode 100644 index 000000000000..b4f981e3b566 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ShapeInterface.md @@ -0,0 +1,13 @@ + + +# ShapeInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ShapeOrNull.md b/samples/client/petstore/java/okhttp-jsonb/docs/ShapeOrNull.md new file mode 100644 index 000000000000..c4ae8f1b6720 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ShapeOrNull.md @@ -0,0 +1,16 @@ + + +# ShapeOrNull + +The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/SimpleQuadrilateral.md b/samples/client/petstore/java/okhttp-jsonb/docs/SimpleQuadrilateral.md new file mode 100644 index 000000000000..52fb7d1a6a49 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/SimpleQuadrilateral.md @@ -0,0 +1,14 @@ + + +# SimpleQuadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/SpecialModelName.md b/samples/client/petstore/java/okhttp-jsonb/docs/SpecialModelName.md new file mode 100644 index 000000000000..e17d0d797b7f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/SpecialModelName.md @@ -0,0 +1,14 @@ + + +# SpecialModelName + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**$specialPropertyName** | **Long** | | [optional] | +|**specialModelName** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/StoreApi.md b/samples/client/petstore/java/okhttp-jsonb/docs/StoreApi.md new file mode 100644 index 000000000000..719f9df42478 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/StoreApi.md @@ -0,0 +1,266 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + 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 + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + + + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Tag.md b/samples/client/petstore/java/okhttp-jsonb/docs/Tag.md new file mode 100644 index 000000000000..5088b2dd1c31 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Tag.md @@ -0,0 +1,14 @@ + + +# Tag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/client/petstore/java/okhttp-jsonb/docs/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..dc066e6c7dac --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,13 @@ + + +# TestInlineFreeformAdditionalPropertiesRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someProperty** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Triangle.md b/samples/client/petstore/java/okhttp-jsonb/docs/Triangle.md new file mode 100644 index 000000000000..71de2174f744 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Triangle.md @@ -0,0 +1,14 @@ + + +# Triangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/TriangleInterface.md b/samples/client/petstore/java/okhttp-jsonb/docs/TriangleInterface.md new file mode 100644 index 000000000000..ef5fc7575f34 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/TriangleInterface.md @@ -0,0 +1,13 @@ + + +# TriangleInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/User.md b/samples/client/petstore/java/okhttp-jsonb/docs/User.md new file mode 100644 index 000000000000..9e97dc35485f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/User.md @@ -0,0 +1,24 @@ + + +# User + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | +|**objectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] | +|**objectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] | +|**anyTypeProp** | **Object** | 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 | [optional] | +|**anyTypePropNullable** | **Object** | 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. | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/UserApi.md b/samples/client/petstore/java/okhttp-jsonb/docs/UserApi.md new file mode 100644 index 000000000000..2c5974674074 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/UserApi.md @@ -0,0 +1,511 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | + + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### 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 | - | + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + 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 + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Value.md b/samples/client/petstore/java/okhttp-jsonb/docs/Value.md new file mode 100644 index 000000000000..54c8fc245e72 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Value.md @@ -0,0 +1,12 @@ + + +# Value + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/ValuesApi.md b/samples/client/petstore/java/okhttp-jsonb/docs/ValuesApi.md new file mode 100644 index 000000000000..4210bff03ec9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/ValuesApi.md @@ -0,0 +1,68 @@ +# ValuesApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getSomeValues**](ValuesApi.md#getSomeValues) | **GET** /values | Get some primitive variable values | + + + +# **getSomeValues** +> Variable getSomeValues() + +Get some primitive variable values + + + +### 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.ValuesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + ValuesApi apiInstance = new ValuesApi(defaultClient); + try { + Variable result = apiInstance.getSomeValues(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ValuesApi#getSomeValues"); + 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 + +[**Variable**](Variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Value | - | + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Variable.md b/samples/client/petstore/java/okhttp-jsonb/docs/Variable.md new file mode 100644 index 000000000000..d179fb1775cf --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Variable.md @@ -0,0 +1,15 @@ + + +# Variable + +Value object + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | | +|**value** | [**Value**](Value.md) | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Whale.md b/samples/client/petstore/java/okhttp-jsonb/docs/Whale.md new file mode 100644 index 000000000000..30ce4bb82151 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Whale.md @@ -0,0 +1,15 @@ + + +# Whale + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasBaleen** | **Boolean** | | [optional] | +|**hasTeeth** | **Boolean** | | [optional] | +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/docs/Zebra.md b/samples/client/petstore/java/okhttp-jsonb/docs/Zebra.md new file mode 100644 index 000000000000..f7c4389b6456 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/docs/Zebra.md @@ -0,0 +1,24 @@ + + +# Zebra + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | +|**className** | **String** | | | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| PLAINS | "plains" | +| MOUNTAIN | "mountain" | +| GREVYS | "grevys" | + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/git_push.sh b/samples/client/petstore/java/okhttp-jsonb/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp-jsonb/gradle.properties b/samples/client/petstore/java/okhttp-jsonb/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-jsonb/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-jsonb/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-jsonb/gradlew.bat b/samples/client/petstore/java/okhttp-jsonb/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp-jsonb/pom.xml b/samples/client/petstore/java/okhttp-jsonb/pom.xml new file mode 100644 index 000000000000..4817fded06cd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/pom.xml @@ -0,0 +1,301 @@ + + 4.0.0 + org.openapitools + petstore-okhttp-jsonb + jar + petstore-okhttp-jsonb + 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-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + jakarta.json.bind + jakarta.json.bind-api + ${jsonb-api-version} + + + org.eclipse + yasson + ${yasson-version} + + + jakarta.json + jakarta.json-api + 2.1.3 + + + org.eclipse.parsson + parsson + 1.1.7 + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + org.apache.commons + commons-lang3 + ${commons-lang3-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 3.0.1 + 3.0.4 + 3.18.0 + 2.1.1 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp-jsonb/settings.gradle b/samples/client/petstore/java/okhttp-jsonb/settings.gradle new file mode 100644 index 000000000000..084f595506cb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-okhttp-jsonb" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-jsonb/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..e9ab7a8d7a60 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiCallback.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; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..86f742d40253 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1801 @@ +/* + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://petstore.swagger.io:80/v2"; + 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" + ) + ) + )); + }} + ), + new ServerConfiguration( + "https://127.0.0.1/no_variable", + "The local server without variables", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = ""; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io:80/v2) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 access token for the first Bearer authentication. + * @param bearerToken Bearer token + */ + public void setBearerToken(String bearerToken) { + setBearerToken(() -> bearerToken); + } + + /** + * Helper method to set the supplier of access tokens for Bearer authentication. + * + * @param tokenSupplier The supplier of bearer tokens + */ + public void setBearerToken(Supplier tokenSupplier) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(tokenSupplier); + return; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..2068c528745f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..fb13945bd775 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..668203bd35fc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..7a2082158b59 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,181 @@ +/* + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import jakarta.json.bind.Jsonb; +import jakarta.json.bind.JsonbBuilder; +import jakarta.json.bind.JsonbConfig; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Jsonb jsonb; + + public JSON() { + if (jsonb == null) { + JsonbConfig config = new JsonbConfig(); + jsonb = JsonbBuilder.create(config); + } + } + + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return jsonb; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.jsonb = (Jsonb) serializer; + } + + /** + * Helper class to get the Type of a generic class. + */ + public static class GenericType { + private final Type type; + + protected GenericType() { + Type superclass = getClass().getGenericSuperclass(); + this.type = ((ParameterizedType) superclass).getActualTypeArguments()[0]; + } + + public Type getType() { + return type; + } + } + + + public static Jsonb getJsonb() { + return jsonb; + } + + public static void setJsonb(Jsonb jsonb) { + JSON.jsonb = jsonb; + } + + public static void setDateFormat(DateFormat dateFormat) { + // TODO: implement for JSON-B + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + // TODO: implement for JSON-B + } + + public static void setLenientOnJson(boolean lenientOnJson) { + // TODO: implement for JSON-B + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + // TODO: implement for JSON-B + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + // TODO: implement for JSON-B + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return jsonb.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + return jsonb.fromJson(body, returnType); + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + return jsonb.fromJson(inputStream, returnType); + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..31957380cc4e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * 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; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..924dd8668973 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..eee56669a4a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..d779bc444980 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * 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; + +/** + * Representing a Server configuration. + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..ff4eab3cc4d3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..c0fd50b06b44 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/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; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/AnotherFakeApi.java new file mode 100644 index 000000000000..4c0890d5eb31 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -0,0 +1,457 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + + +import java.io.IOException; + + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AnotherFakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AnotherFakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public AnotherFakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for call123testSpecialTags + * @param client client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsCall(@jakarta.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = client; + + // create path and map variables + String localVarPath = "/another-fake/dummy"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call call123testSpecialTagsValidateBeforeCall(@jakarta.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException("Missing the required parameter 'client' when calling call123testSpecialTags(Async)"); + } + + return call123testSpecialTagsCall(client, _callback); + + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client call123testSpecialTags(@jakarta.annotation.Nonnull Client client) throws ApiException { + ApiResponse localVarResp = call123testSpecialTagsWithHttpInfo(client); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse call123testSpecialTagsWithHttpInfo(@jakarta.annotation.Nonnull Client client) throws ApiException { + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(client, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test special tags (asynchronously) + * To test special tags and operation ID starting with number + * @param client client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsAsync(@jakarta.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(client, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getParameterArrayNumber + * @param array array integer (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterArrayNumberCall(@jakarta.annotation.Nonnull List array, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/parameter-array-number"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (array != null) { + localVarHeaderParams.put("array", localVarApiClient.parameterToString(array)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getParameterArrayNumberValidateBeforeCall(@jakarta.annotation.Nonnull List array, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'array' is set + if (array == null) { + throw new ApiException("Missing the required parameter 'array' when calling getParameterArrayNumber(Async)"); + } + + return getParameterArrayNumberCall(array, _callback); + + } + + /** + * parameter array number default value + * + * @param array array integer (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getParameterArrayNumber(@jakarta.annotation.Nonnull List array) throws ApiException { + getParameterArrayNumberWithHttpInfo(array); + } + + /** + * parameter array number default value + * + * @param array array integer (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getParameterArrayNumberWithHttpInfo(@jakarta.annotation.Nonnull List array) throws ApiException { + okhttp3.Call localVarCall = getParameterArrayNumberValidateBeforeCall(array, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * parameter array number default value (asynchronously) + * + * @param array array integer (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterArrayNumberAsync(@jakarta.annotation.Nonnull List array, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getParameterArrayNumberValidateBeforeCall(array, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getParameterStringNumber + * @param stringNumber string number (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterStringNumberCall(@jakarta.annotation.Nonnull BigDecimal stringNumber, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/parameter-string-number"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (stringNumber != null) { + localVarHeaderParams.put("string_number", localVarApiClient.parameterToString(stringNumber)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getParameterStringNumberValidateBeforeCall(@jakarta.annotation.Nonnull BigDecimal stringNumber, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'stringNumber' is set + if (stringNumber == null) { + throw new ApiException("Missing the required parameter 'stringNumber' when calling getParameterStringNumber(Async)"); + } + + return getParameterStringNumberCall(stringNumber, _callback); + + } + + /** + * parameter string number + * + * @param stringNumber string number (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getParameterStringNumber(@jakarta.annotation.Nonnull BigDecimal stringNumber) throws ApiException { + getParameterStringNumberWithHttpInfo(stringNumber); + } + + /** + * parameter string number + * + * @param stringNumber string number (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getParameterStringNumberWithHttpInfo(@jakarta.annotation.Nonnull BigDecimal stringNumber) throws ApiException { + okhttp3.Call localVarCall = getParameterStringNumberValidateBeforeCall(stringNumber, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * parameter string number (asynchronously) + * + * @param stringNumber string number (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterStringNumberAsync(@jakarta.annotation.Nonnull BigDecimal stringNumber, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getParameterStringNumberValidateBeforeCall(stringNumber, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..b620c9dc8e74 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,562 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + + +import java.io.IOException; + + +import org.openapitools.client.model.FakeAnyOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FakeOneOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FooGetDefaultResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DefaultApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for fakeAnyOfWIthSameErasureGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeAnyOfWIthSameErasureGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/anyOfWIthSameErasure"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeAnyOfWIthSameErasureGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeAnyOfWIthSameErasureGetCall(_callback); + + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return FakeAnyOfWIthSameErasureGet200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public FakeAnyOfWIthSameErasureGet200Response fakeAnyOfWIthSameErasureGet() throws ApiException { + ApiResponse localVarResp = fakeAnyOfWIthSameErasureGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return ApiResponse<FakeAnyOfWIthSameErasureGet200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public ApiResponse fakeAnyOfWIthSameErasureGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeAnyOfWIthSameErasureGetValidateBeforeCall(null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test route, this shouldn't cause a compiler error + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeAnyOfWIthSameErasureGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeAnyOfWIthSameErasureGetValidateBeforeCall(_callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeFreeFormQueryParametersGet + * @param fixed (optional) + * @param freeForm (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call fakeFreeFormQueryParametersGetCall(@jakarta.annotation.Nullable String fixed, @jakarta.annotation.Nullable Object freeForm, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/free-form-query-parameters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (fixed != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fixed", fixed)); + } + + if (freeForm != null) { + localVarQueryParams.addAll(localVarApiClient.freeFormParameterToPairs(freeForm)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeFreeFormQueryParametersGetValidateBeforeCall(@jakarta.annotation.Nullable String fixed, @jakarta.annotation.Nullable Object freeForm, final ApiCallback _callback) throws ApiException { + return fakeFreeFormQueryParametersGetCall(fixed, freeForm, _callback); + + } + + /** + * + * + * @param fixed (optional) + * @param freeForm (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void fakeFreeFormQueryParametersGet(@jakarta.annotation.Nullable String fixed, @jakarta.annotation.Nullable Object freeForm) throws ApiException { + fakeFreeFormQueryParametersGetWithHttpInfo(fixed, freeForm); + } + + /** + * + * + * @param fixed (optional) + * @param freeForm (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse fakeFreeFormQueryParametersGetWithHttpInfo(@jakarta.annotation.Nullable String fixed, @jakarta.annotation.Nullable Object freeForm) throws ApiException { + okhttp3.Call localVarCall = fakeFreeFormQueryParametersGetValidateBeforeCall(fixed, freeForm, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param fixed (optional) + * @param freeForm (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call fakeFreeFormQueryParametersGetAsync(@jakarta.annotation.Nullable String fixed, @jakarta.annotation.Nullable Object freeForm, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeFreeFormQueryParametersGetValidateBeforeCall(fixed, freeForm, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for fakeOneOfWIthSameErasureGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeOneOfWIthSameErasureGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/oneOfWIthSameErasure"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOneOfWIthSameErasureGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeOneOfWIthSameErasureGetCall(_callback); + + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return FakeOneOfWIthSameErasureGet200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public FakeOneOfWIthSameErasureGet200Response fakeOneOfWIthSameErasureGet() throws ApiException { + ApiResponse localVarResp = fakeOneOfWIthSameErasureGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return ApiResponse<FakeOneOfWIthSameErasureGet200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public ApiResponse fakeOneOfWIthSameErasureGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeOneOfWIthSameErasureGetValidateBeforeCall(null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test route, this shouldn't cause a compiler error + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeOneOfWIthSameErasureGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOneOfWIthSameErasureGetValidateBeforeCall(_callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fooGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public okhttp3.Call fooGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/foo"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fooGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fooGetCall(_callback); + + } + + /** + * + * + * @return FooGetDefaultResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public FooGetDefaultResponse fooGet() throws ApiException { + ApiResponse localVarResp = fooGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * + * @return ApiResponse<FooGetDefaultResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public ApiResponse fooGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fooGetValidateBeforeCall(null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public okhttp3.Call fooGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fooGetValidateBeforeCall(_callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 000000000000..8c1454563345 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,3456 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + + +import java.io.IOException; + + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import org.openapitools.client.model.FakeRefParameterPetIdParameter; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.FreeFormObjectTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.NullableFieldsMapResponse; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.RequiredNullableBody; +import org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for fakeGetFreeFormObjectGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call fakeGetFreeFormObjectGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/get-free-form-object"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeGetFreeFormObjectGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeGetFreeFormObjectGetCall(_callback); + + } + + /** + * + * Get a free form object or Json string + * @return FreeFormObjectTestClass + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public FreeFormObjectTestClass fakeGetFreeFormObjectGet() throws ApiException { + ApiResponse localVarResp = fakeGetFreeFormObjectGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * Get a free form object or Json string + * @return ApiResponse<FreeFormObjectTestClass> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse fakeGetFreeFormObjectGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeGetFreeFormObjectGetValidateBeforeCall(null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get a free form object or Json string + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call fakeGetFreeFormObjectGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeGetFreeFormObjectGetValidateBeforeCall(_callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterBooleanSerialize + * @param body Input boolean as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeCall(@jakarta.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterBooleanSerializeValidateBeforeCall(@jakarta.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + return fakeOuterBooleanSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public Boolean fakeOuterBooleanSerialize(@jakarta.annotation.Nullable Boolean body) throws ApiException { + ApiResponse localVarResp = fakeOuterBooleanSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return ApiResponse<Boolean> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(@jakarta.annotation.Nullable Boolean body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterBooleanSerializeValidateBeforeCall(body, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeAsync(@jakarta.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterBooleanSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterCompositeSerialize + * @param outerComposite Input composite as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeCall(@jakarta.annotation.Nullable OuterComposite outerComposite, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = outerComposite; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterCompositeSerializeValidateBeforeCall(@jakarta.annotation.Nullable OuterComposite outerComposite, final ApiCallback _callback) throws ApiException { + return fakeOuterCompositeSerializeCall(outerComposite, _callback); + + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public OuterComposite fakeOuterCompositeSerialize(@jakarta.annotation.Nullable OuterComposite outerComposite) throws ApiException { + ApiResponse localVarResp = fakeOuterCompositeSerializeWithHttpInfo(outerComposite); + return localVarResp.getData(); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return ApiResponse<OuterComposite> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(@jakarta.annotation.Nullable OuterComposite outerComposite) throws ApiException { + okhttp3.Call localVarCall = fakeOuterCompositeSerializeValidateBeforeCall(outerComposite, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeAsync(@jakarta.annotation.Nullable OuterComposite outerComposite, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterCompositeSerializeValidateBeforeCall(outerComposite, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterNumberSerialize + * @param body Input number as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeCall(@jakarta.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterNumberSerializeValidateBeforeCall(@jakarta.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + return fakeOuterNumberSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public BigDecimal fakeOuterNumberSerialize(@jakarta.annotation.Nullable BigDecimal body) throws ApiException { + ApiResponse localVarResp = fakeOuterNumberSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return ApiResponse<BigDecimal> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public ApiResponse fakeOuterNumberSerializeWithHttpInfo(@jakarta.annotation.Nullable BigDecimal body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterNumberSerializeValidateBeforeCall(body, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeAsync(@jakarta.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterNumberSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterStringSerialize + * @param body Input string as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeCall(@jakarta.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterStringSerializeValidateBeforeCall(@jakarta.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + return fakeOuterStringSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public String fakeOuterStringSerialize(@jakarta.annotation.Nullable String body) throws ApiException { + ApiResponse localVarResp = fakeOuterStringSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public ApiResponse fakeOuterStringSerializeWithHttpInfo(@jakarta.annotation.Nullable String body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterStringSerializeValidateBeforeCall(body, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeAsync(@jakarta.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterStringSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeRefParameter + * @param petId to test oneOf in parameter $ref (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeRefParameterCall(@jakarta.annotation.Nonnull FakeRefParameterPetIdParameter petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/pet/{petId}/reference/parameter" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeRefParameterValidateBeforeCall(@jakarta.annotation.Nonnull FakeRefParameterPetIdParameter petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling fakeRefParameter(Async)"); + } + + return fakeRefParameterCall(petId, _callback); + + } + + /** + * fake reference parameter + * + * @param petId to test oneOf in parameter $ref (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void fakeRefParameter(@jakarta.annotation.Nonnull FakeRefParameterPetIdParameter petId) throws ApiException { + fakeRefParameterWithHttpInfo(petId); + } + + /** + * fake reference parameter + * + * @param petId to test oneOf in parameter $ref (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse fakeRefParameterWithHttpInfo(@jakarta.annotation.Nonnull FakeRefParameterPetIdParameter petId) throws ApiException { + okhttp3.Call localVarCall = fakeRefParameterValidateBeforeCall(petId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * fake reference parameter (asynchronously) + * + * @param petId to test oneOf in parameter $ref (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeRefParameterAsync(@jakarta.annotation.Nonnull FakeRefParameterPetIdParameter petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeRefParameterValidateBeforeCall(petId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for fakeRequiredNullableBodyGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public okhttp3.Call fakeRequiredNullableBodyGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/required-nullable-body"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeRequiredNullableBodyGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeRequiredNullableBodyGetCall(_callback); + + } + + /** + * fields in the response body, required and nullable are both true + * + * @return RequiredNullableBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public RequiredNullableBody fakeRequiredNullableBodyGet() throws ApiException { + ApiResponse localVarResp = fakeRequiredNullableBodyGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * fields in the response body, required and nullable are both true + * + * @return ApiResponse<RequiredNullableBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public ApiResponse fakeRequiredNullableBodyGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeRequiredNullableBodyGetValidateBeforeCall(null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * fields in the response body, required and nullable are both true (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public okhttp3.Call fakeRequiredNullableBodyGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeRequiredNullableBodyGetValidateBeforeCall(_callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeUploadRefRequestBodies + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeUploadRefRequestBodiesCall(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeUploadRefRequestBodiesValidateBeforeCall(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling fakeUploadRefRequestBodies(Async)"); + } + + return fakeUploadRefRequestBodiesCall(petId, additionalMetadata, _file, _callback); + + } + + /** + * fake reference parameter + * + * @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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse fakeUploadRefRequestBodies(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = fakeUploadRefRequestBodiesWithHttpInfo(petId, additionalMetadata, _file); + return localVarResp.getData(); + } + + /** + * fake reference parameter + * + * @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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse fakeUploadRefRequestBodiesWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = fakeUploadRefRequestBodiesValidateBeforeCall(petId, additionalMetadata, _file, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * fake reference parameter (asynchronously) + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeUploadRefRequestBodiesAsync(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeUploadRefRequestBodiesValidateBeforeCall(petId, additionalMetadata, _file, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getFakeArrayofenums + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public okhttp3.Call getFakeArrayofenumsCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/array-of-enums"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFakeArrayofenumsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getFakeArrayofenumsCall(_callback); + + } + + /** + * Array of Enums + * + * @return List<OuterEnum> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public List getFakeArrayofenums() throws ApiException { + ApiResponse> localVarResp = getFakeArrayofenumsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Array of Enums + * + * @return ApiResponse<List<OuterEnum>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public ApiResponse> getFakeArrayofenumsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getFakeArrayofenumsValidateBeforeCall(null); + + + Type localVarReturnType = new JSON.GenericType>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Array of Enums (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public okhttp3.Call getFakeArrayofenumsAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getFakeArrayofenumsValidateBeforeCall(_callback); + Type localVarReturnType = new JSON.GenericType>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getFakeHealth + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public okhttp3.Call getFakeHealthCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/health"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFakeHealthValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getFakeHealthCall(_callback); + + } + + /** + * Health check endpoint + * + * @return HealthCheckResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public HealthCheckResult getFakeHealth() throws ApiException { + ApiResponse localVarResp = getFakeHealthWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Health check endpoint + * + * @return ApiResponse<HealthCheckResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public ApiResponse getFakeHealthWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getFakeHealthValidateBeforeCall(null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Health check endpoint (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public okhttp3.Call getFakeHealthAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getFakeHealthValidateBeforeCall(_callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getParameterNameMapping + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterNameMappingCall(@jakarta.annotation.Nonnull Long underscoreType, @jakarta.annotation.Nonnull String type, @jakarta.annotation.Nonnull String typeWithUnderscore, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/parameter-name-mapping"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (type != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("type", type)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (underscoreType != null) { + localVarHeaderParams.put("_type", localVarApiClient.parameterToString(underscoreType)); + } + + + if (typeWithUnderscore != null) { + localVarHeaderParams.put("type_", localVarApiClient.parameterToString(typeWithUnderscore)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getParameterNameMappingValidateBeforeCall(@jakarta.annotation.Nonnull Long underscoreType, @jakarta.annotation.Nonnull String type, @jakarta.annotation.Nonnull String typeWithUnderscore, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'underscoreType' is set + if (underscoreType == null) { + throw new ApiException("Missing the required parameter 'underscoreType' when calling getParameterNameMapping(Async)"); + } + + // verify the required parameter 'type' is set + if (type == null) { + throw new ApiException("Missing the required parameter 'type' when calling getParameterNameMapping(Async)"); + } + + // verify the required parameter 'typeWithUnderscore' is set + if (typeWithUnderscore == null) { + throw new ApiException("Missing the required parameter 'typeWithUnderscore' when calling getParameterNameMapping(Async)"); + } + + return getParameterNameMappingCall(underscoreType, type, typeWithUnderscore, _callback); + + } + + /** + * parameter name mapping test + * + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getParameterNameMapping(@jakarta.annotation.Nonnull Long underscoreType, @jakarta.annotation.Nonnull String type, @jakarta.annotation.Nonnull String typeWithUnderscore) throws ApiException { + getParameterNameMappingWithHttpInfo(underscoreType, type, typeWithUnderscore); + } + + /** + * parameter name mapping test + * + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getParameterNameMappingWithHttpInfo(@jakarta.annotation.Nonnull Long underscoreType, @jakarta.annotation.Nonnull String type, @jakarta.annotation.Nonnull String typeWithUnderscore) throws ApiException { + okhttp3.Call localVarCall = getParameterNameMappingValidateBeforeCall(underscoreType, type, typeWithUnderscore, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * parameter name mapping test (asynchronously) + * + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterNameMappingAsync(@jakarta.annotation.Nonnull Long underscoreType, @jakarta.annotation.Nonnull String type, @jakarta.annotation.Nonnull String typeWithUnderscore, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getParameterNameMappingValidateBeforeCall(underscoreType, type, typeWithUnderscore, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testAdditionalPropertiesReference + * @param requestBody request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testAdditionalPropertiesReferenceCall(@jakarta.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/fake/additionalProperties-reference"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testAdditionalPropertiesReferenceValidateBeforeCall(@jakarta.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference(Async)"); + } + + return testAdditionalPropertiesReferenceCall(requestBody, _callback); + + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testAdditionalPropertiesReference(@jakarta.annotation.Nonnull Map requestBody) throws ApiException { + testAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(@jakarta.annotation.Nonnull Map requestBody) throws ApiException { + okhttp3.Call localVarCall = testAdditionalPropertiesReferenceValidateBeforeCall(requestBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test referenced additionalProperties (asynchronously) + * + * @param requestBody request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testAdditionalPropertiesReferenceAsync(@jakarta.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testAdditionalPropertiesReferenceValidateBeforeCall(requestBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testBodyWithFileSchema + * @param fileSchemaTestClass (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaCall(@jakarta.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = fileSchemaTestClass; + + // create path and map variables + String localVarPath = "/fake/body-with-file-schema"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithFileSchemaValidateBeforeCall(@jakarta.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) { + throw new ApiException("Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema(Async)"); + } + + return testBodyWithFileSchemaCall(fileSchemaTestClass, _callback); + + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithFileSchema(@jakarta.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithFileSchemaWithHttpInfo(@jakarta.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { + okhttp3.Call localVarCall = testBodyWithFileSchemaValidateBeforeCall(fileSchemaTestClass, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaAsync(@jakarta.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyWithFileSchemaValidateBeforeCall(fileSchemaTestClass, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testBodyWithQueryParams + * @param query (required) + * @param user (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsCall(@jakarta.annotation.Nonnull String query, @jakarta.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (query != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithQueryParamsValidateBeforeCall(@jakarta.annotation.Nonnull String query, @jakarta.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException("Missing the required parameter 'query' when calling testBodyWithQueryParams(Async)"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling testBodyWithQueryParams(Async)"); + } + + return testBodyWithQueryParamsCall(query, user, _callback); + + } + + /** + * + * + * @param query (required) + * @param user (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithQueryParams(@jakarta.annotation.Nonnull String query, @jakarta.annotation.Nonnull User user) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(query, user); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(@jakarta.annotation.Nonnull String query, @jakarta.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = testBodyWithQueryParamsValidateBeforeCall(query, user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param query (required) + * @param user (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsAsync(@jakarta.annotation.Nonnull String query, @jakarta.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyWithQueryParamsValidateBeforeCall(query, user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testClientModel + * @param client client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelCall(@jakarta.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = client; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClientModelValidateBeforeCall(@jakarta.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException("Missing the required parameter 'client' when calling testClientModel(Async)"); + } + + return testClientModelCall(client, _callback); + + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClientModel(@jakarta.annotation.Nonnull Client client) throws ApiException { + ApiResponse localVarResp = testClientModelWithHttpInfo(client); + return localVarResp.getData(); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return ApiResponse<Client> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClientModelWithHttpInfo(@jakarta.annotation.Nonnull Client client) throws ApiException { + okhttp3.Call localVarCall = testClientModelValidateBeforeCall(client, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test \"client\" model (asynchronously) + * To test \"client\" model + * @param client client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelAsync(@jakarta.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testClientModelValidateBeforeCall(client, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testEndpointParameters + * @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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersCall(@jakarta.annotation.Nonnull BigDecimal number, @jakarta.annotation.Nonnull Double _double, @jakarta.annotation.Nonnull String patternWithoutDelimiter, @jakarta.annotation.Nonnull byte[] _byte, @jakarta.annotation.Nullable Integer integer, @jakarta.annotation.Nullable Integer int32, @jakarta.annotation.Nullable Long int64, @jakarta.annotation.Nullable Float _float, @jakarta.annotation.Nullable String string, @jakarta.annotation.Nullable File binary, @jakarta.annotation.Nullable LocalDate date, @jakarta.annotation.Nullable OffsetDateTime dateTime, @jakarta.annotation.Nullable String password, @jakarta.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "http_basic_test" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEndpointParametersValidateBeforeCall(@jakarta.annotation.Nonnull BigDecimal number, @jakarta.annotation.Nonnull Double _double, @jakarta.annotation.Nonnull String patternWithoutDelimiter, @jakarta.annotation.Nonnull byte[] _byte, @jakarta.annotation.Nullable Integer integer, @jakarta.annotation.Nullable Integer int32, @jakarta.annotation.Nullable Long int64, @jakarta.annotation.Nullable Float _float, @jakarta.annotation.Nullable String string, @jakarta.annotation.Nullable File binary, @jakarta.annotation.Nullable LocalDate date, @jakarta.annotation.Nullable OffsetDateTime dateTime, @jakarta.annotation.Nullable String password, @jakarta.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException("Missing the required parameter 'number' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException("Missing the required parameter '_double' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) { + throw new ApiException("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException("Missing the required parameter '_byte' when calling testEndpointParameters(Async)"); + } + + return testEndpointParametersCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, _callback); + + } + + /** + * 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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void testEndpointParameters(@jakarta.annotation.Nonnull BigDecimal number, @jakarta.annotation.Nonnull Double _double, @jakarta.annotation.Nonnull String patternWithoutDelimiter, @jakarta.annotation.Nonnull byte[] _byte, @jakarta.annotation.Nullable Integer integer, @jakarta.annotation.Nullable Integer int32, @jakarta.annotation.Nullable Long int64, @jakarta.annotation.Nullable Float _float, @jakarta.annotation.Nullable String string, @jakarta.annotation.Nullable File binary, @jakarta.annotation.Nullable LocalDate date, @jakarta.annotation.Nullable OffsetDateTime dateTime, @jakarta.annotation.Nullable String password, @jakarta.annotation.Nullable 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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse testEndpointParametersWithHttpInfo(@jakarta.annotation.Nonnull BigDecimal number, @jakarta.annotation.Nonnull Double _double, @jakarta.annotation.Nonnull String patternWithoutDelimiter, @jakarta.annotation.Nonnull byte[] _byte, @jakarta.annotation.Nullable Integer integer, @jakarta.annotation.Nullable Integer int32, @jakarta.annotation.Nullable Long int64, @jakarta.annotation.Nullable Float _float, @jakarta.annotation.Nullable String string, @jakarta.annotation.Nullable File binary, @jakarta.annotation.Nullable LocalDate date, @jakarta.annotation.Nullable OffsetDateTime dateTime, @jakarta.annotation.Nullable String password, @jakarta.annotation.Nullable String paramCallback) throws ApiException { + okhttp3.Call localVarCall = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 (asynchronously) + * 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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersAsync(@jakarta.annotation.Nonnull BigDecimal number, @jakarta.annotation.Nonnull Double _double, @jakarta.annotation.Nonnull String patternWithoutDelimiter, @jakarta.annotation.Nonnull byte[] _byte, @jakarta.annotation.Nullable Integer integer, @jakarta.annotation.Nullable Integer int32, @jakarta.annotation.Nullable Long int64, @jakarta.annotation.Nullable Float _float, @jakarta.annotation.Nullable String string, @jakarta.annotation.Nullable File binary, @jakarta.annotation.Nullable LocalDate date, @jakarta.annotation.Nullable OffsetDateTime dateTime, @jakarta.annotation.Nullable String password, @jakarta.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testEnumParameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersCall(@jakarta.annotation.Nullable List enumHeaderStringArray, @jakarta.annotation.Nullable String enumHeaderString, @jakarta.annotation.Nullable List enumQueryStringArray, @jakarta.annotation.Nullable String enumQueryString, @jakarta.annotation.Nullable Integer enumQueryInteger, @jakarta.annotation.Nullable Double enumQueryDouble, @jakarta.annotation.Nullable List enumFormStringArray, @jakarta.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (enumFormStringArray != null) { + localVarFormParams.put("enum_form_string_array", enumFormStringArray); + } + + if (enumFormString != null) { + localVarFormParams.put("enum_form_string", enumFormString); + } + + if (enumQueryStringArray != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "enum_query_string_array", enumQueryStringArray)); + } + + if (enumQueryString != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_string", enumQueryString)); + } + + if (enumQueryInteger != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_integer", enumQueryInteger)); + } + + if (enumQueryDouble != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_double", enumQueryDouble)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (enumHeaderStringArray != null) { + localVarHeaderParams.put("enum_header_string_array", localVarApiClient.parameterToString(enumHeaderStringArray)); + } + + + if (enumHeaderString != null) { + localVarHeaderParams.put("enum_header_string", localVarApiClient.parameterToString(enumHeaderString)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEnumParametersValidateBeforeCall(@jakarta.annotation.Nullable List enumHeaderStringArray, @jakarta.annotation.Nullable String enumHeaderString, @jakarta.annotation.Nullable List enumQueryStringArray, @jakarta.annotation.Nullable String enumQueryString, @jakarta.annotation.Nullable Integer enumQueryInteger, @jakarta.annotation.Nullable Double enumQueryDouble, @jakarta.annotation.Nullable List enumFormStringArray, @jakarta.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + return testEnumParametersCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, _callback); + + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public void testEnumParameters(@jakarta.annotation.Nullable List enumHeaderStringArray, @jakarta.annotation.Nullable String enumHeaderString, @jakarta.annotation.Nullable List enumQueryStringArray, @jakarta.annotation.Nullable String enumQueryString, @jakarta.annotation.Nullable Integer enumQueryInteger, @jakarta.annotation.Nullable Double enumQueryDouble, @jakarta.annotation.Nullable List enumFormStringArray, @jakarta.annotation.Nullable 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) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public ApiResponse testEnumParametersWithHttpInfo(@jakarta.annotation.Nullable List enumHeaderStringArray, @jakarta.annotation.Nullable String enumHeaderString, @jakarta.annotation.Nullable List enumQueryStringArray, @jakarta.annotation.Nullable String enumQueryString, @jakarta.annotation.Nullable Integer enumQueryInteger, @jakarta.annotation.Nullable Double enumQueryDouble, @jakarta.annotation.Nullable List enumFormStringArray, @jakarta.annotation.Nullable String enumFormString) throws ApiException { + okhttp3.Call localVarCall = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * To test enum parameters (asynchronously) + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersAsync(@jakarta.annotation.Nullable List enumHeaderStringArray, @jakarta.annotation.Nullable String enumHeaderString, @jakarta.annotation.Nullable List enumQueryStringArray, @jakarta.annotation.Nullable String enumQueryString, @jakarta.annotation.Nullable Integer enumQueryInteger, @jakarta.annotation.Nullable Double enumQueryDouble, @jakarta.annotation.Nullable List enumFormStringArray, @jakarta.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + private okhttp3.Call testGroupParametersCall(@jakarta.annotation.Nonnull Integer requiredStringGroup, @jakarta.annotation.Nonnull Boolean requiredBooleanGroup, @jakarta.annotation.Nonnull Long requiredInt64Group, @jakarta.annotation.Nullable Integer stringGroup, @jakarta.annotation.Nullable Boolean booleanGroup, @jakarta.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (requiredStringGroup != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("required_string_group", requiredStringGroup)); + } + + if (requiredInt64Group != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("required_int64_group", requiredInt64Group)); + } + + if (stringGroup != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("string_group", stringGroup)); + } + + if (int64Group != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("int64_group", int64Group)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (requiredBooleanGroup != null) { + localVarHeaderParams.put("required_boolean_group", localVarApiClient.parameterToString(requiredBooleanGroup)); + } + + + if (booleanGroup != null) { + localVarHeaderParams.put("boolean_group", localVarApiClient.parameterToString(booleanGroup)); + } + + + String[] localVarAuthNames = new String[] { "bearer_test" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testGroupParametersValidateBeforeCall(@jakarta.annotation.Nonnull Integer requiredStringGroup, @jakarta.annotation.Nonnull Boolean requiredBooleanGroup, @jakarta.annotation.Nonnull Long requiredInt64Group, @jakarta.annotation.Nullable Integer stringGroup, @jakarta.annotation.Nullable Boolean booleanGroup, @jakarta.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requiredStringGroup' is set + if (requiredStringGroup == null) { + throw new ApiException("Missing the required parameter 'requiredStringGroup' when calling testGroupParameters(Async)"); + } + + // verify the required parameter 'requiredBooleanGroup' is set + if (requiredBooleanGroup == null) { + throw new ApiException("Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters(Async)"); + } + + // verify the required parameter 'requiredInt64Group' is set + if (requiredInt64Group == null) { + throw new ApiException("Missing the required parameter 'requiredInt64Group' when calling testGroupParameters(Async)"); + } + + return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + + } + + + private ApiResponse testGroupParametersWithHttpInfo(@jakarta.annotation.Nonnull Integer requiredStringGroup, @jakarta.annotation.Nonnull Boolean requiredBooleanGroup, @jakarta.annotation.Nonnull Long requiredInt64Group, @jakarta.annotation.Nullable Integer stringGroup, @jakarta.annotation.Nullable Boolean booleanGroup, @jakarta.annotation.Nullable Long int64Group) throws ApiException { + okhttp3.Call localVarCall = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call testGroupParametersAsync(@jakarta.annotation.Nonnull Integer requiredStringGroup, @jakarta.annotation.Nonnull Boolean requiredBooleanGroup, @jakarta.annotation.Nonnull Long requiredInt64Group, @jakarta.annotation.Nullable Integer stringGroup, @jakarta.annotation.Nullable Boolean booleanGroup, @jakarta.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APItestGroupParametersRequest { + @jakarta.annotation.Nonnull + private final Integer requiredStringGroup; + @jakarta.annotation.Nonnull + private final Boolean requiredBooleanGroup; + @jakarta.annotation.Nonnull + private final Long requiredInt64Group; + @jakarta.annotation.Nullable + private Integer stringGroup; + @jakarta.annotation.Nullable + private Boolean booleanGroup; + @jakarta.annotation.Nullable + private Long int64Group; + + private APItestGroupParametersRequest(@jakarta.annotation.Nonnull Integer requiredStringGroup, @jakarta.annotation.Nonnull Boolean requiredBooleanGroup, @jakarta.annotation.Nonnull Long requiredInt64Group) { + this.requiredStringGroup = requiredStringGroup; + this.requiredBooleanGroup = requiredBooleanGroup; + this.requiredInt64Group = requiredInt64Group; + } + + /** + * Set stringGroup + * @param stringGroup String in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest stringGroup(@jakarta.annotation.Nullable Integer stringGroup) { + this.stringGroup = stringGroup; + return this; + } + + /** + * Set booleanGroup + * @param booleanGroup Boolean in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest booleanGroup(@jakarta.annotation.Nullable Boolean booleanGroup) { + this.booleanGroup = booleanGroup; + return this; + } + + /** + * Set int64Group + * @param int64Group Integer in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest int64Group(@jakarta.annotation.Nullable Long int64Group) { + this.int64Group = int64Group; + return this; + } + + /** + * Build call for testGroupParameters + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + } + + /** + * Execute testGroupParameters request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public void execute() throws ApiException { + testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /** + * Execute testGroupParameters request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /** + * Execute testGroupParameters request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return testGroupParametersAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + } + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @return APItestGroupParametersRequest + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public APItestGroupParametersRequest testGroupParameters(@jakarta.annotation.Nonnull Integer requiredStringGroup, @jakarta.annotation.Nonnull Boolean requiredBooleanGroup, @jakarta.annotation.Nonnull Long requiredInt64Group) { + return new APItestGroupParametersRequest(requiredStringGroup, requiredBooleanGroup, requiredInt64Group); + } + /** + * Build call for testInlineAdditionalProperties + * @param requestBody request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineAdditionalPropertiesCall(@jakarta.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/fake/inline-additionalProperties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testInlineAdditionalPropertiesValidateBeforeCall(@jakarta.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties(Async)"); + } + + return testInlineAdditionalPropertiesCall(requestBody, _callback); + + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testInlineAdditionalProperties(@jakarta.annotation.Nonnull Map requestBody) throws ApiException { + testInlineAdditionalPropertiesWithHttpInfo(requestBody); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(@jakarta.annotation.Nonnull Map requestBody) throws ApiException { + okhttp3.Call localVarCall = testInlineAdditionalPropertiesValidateBeforeCall(requestBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test inline additionalProperties (asynchronously) + * + * @param requestBody request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineAdditionalPropertiesAsync(@jakarta.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testInlineAdditionalPropertiesValidateBeforeCall(requestBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testInlineFreeformAdditionalProperties + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineFreeformAdditionalPropertiesCall(@jakarta.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = testInlineFreeformAdditionalPropertiesRequest; + + // create path and map variables + String localVarPath = "/fake/inline-freeform-additionalProperties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testInlineFreeformAdditionalPropertiesValidateBeforeCall(@jakarta.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set + if (testInlineFreeformAdditionalPropertiesRequest == null) { + throw new ApiException("Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties(Async)"); + } + + return testInlineFreeformAdditionalPropertiesCall(testInlineFreeformAdditionalPropertiesRequest, _callback); + + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testInlineFreeformAdditionalProperties(@jakarta.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { + testInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest); + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testInlineFreeformAdditionalPropertiesWithHttpInfo(@jakarta.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { + okhttp3.Call localVarCall = testInlineFreeformAdditionalPropertiesValidateBeforeCall(testInlineFreeformAdditionalPropertiesRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test inline free-form additionalProperties (asynchronously) + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineFreeformAdditionalPropertiesAsync(@jakarta.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testInlineFreeformAdditionalPropertiesValidateBeforeCall(testInlineFreeformAdditionalPropertiesRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testJsonFormData + * @param param field1 (required) + * @param param2 field2 (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testJsonFormDataCall(@jakarta.annotation.Nonnull String param, @jakarta.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/jsonFormData"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testJsonFormDataValidateBeforeCall(@jakarta.annotation.Nonnull String param, @jakarta.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'param' is set + if (param == null) { + throw new ApiException("Missing the required parameter 'param' when calling testJsonFormData(Async)"); + } + + // verify the required parameter 'param2' is set + if (param2 == null) { + throw new ApiException("Missing the required parameter 'param2' when calling testJsonFormData(Async)"); + } + + return testJsonFormDataCall(param, param2, _callback); + + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testJsonFormData(@jakarta.annotation.Nonnull String param, @jakarta.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testJsonFormDataWithHttpInfo(@jakarta.annotation.Nonnull String param, @jakarta.annotation.Nonnull String param2) throws ApiException { + okhttp3.Call localVarCall = testJsonFormDataValidateBeforeCall(param, param2, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test json serialization of form data (asynchronously) + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testJsonFormDataAsync(@jakarta.annotation.Nonnull String param, @jakarta.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testJsonFormDataValidateBeforeCall(param, param2, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testNullableRequiredFieldsAnyOf + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testNullableRequiredFieldsAnyOfCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/nullable-required-fields-anyof"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testNullableRequiredFieldsAnyOfValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return testNullableRequiredFieldsAnyOfCall(_callback); + + } + + /** + * test anyOf with map of objects containing nullable required fields + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * @return NullableFieldsMapResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public NullableFieldsMapResponse testNullableRequiredFieldsAnyOf() throws ApiException { + ApiResponse localVarResp = testNullableRequiredFieldsAnyOfWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * test anyOf with map of objects containing nullable required fields + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * @return ApiResponse<NullableFieldsMapResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testNullableRequiredFieldsAnyOfWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = testNullableRequiredFieldsAnyOfValidateBeforeCall(null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * test anyOf with map of objects containing nullable required fields (asynchronously) + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testNullableRequiredFieldsAnyOfAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testNullableRequiredFieldsAnyOfValidateBeforeCall(_callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryParameterCollectionFormat + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testQueryParameterCollectionFormatCall(@jakarta.annotation.Nonnull List pipe, @jakarta.annotation.Nonnull List ioutil, @jakarta.annotation.Nonnull List http, @jakarta.annotation.Nonnull List url, @jakarta.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/test-query-parameters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pipe != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "pipe", pipe)); + } + + if (ioutil != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "ioutil", ioutil)); + } + + if (http != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("ssv", "http", http)); + } + + if (url != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "url", url)); + } + + if (context != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "context", context)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryParameterCollectionFormatValidateBeforeCall(@jakarta.annotation.Nonnull List pipe, @jakarta.annotation.Nonnull List ioutil, @jakarta.annotation.Nonnull List http, @jakarta.annotation.Nonnull List url, @jakarta.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pipe' is set + if (pipe == null) { + throw new ApiException("Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) { + throw new ApiException("Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'http' is set + if (http == null) { + throw new ApiException("Missing the required parameter 'http' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'url' is set + if (url == null) { + throw new ApiException("Missing the required parameter 'url' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'context' is set + if (context == null) { + throw new ApiException("Missing the required parameter 'context' when calling testQueryParameterCollectionFormat(Async)"); + } + + return testQueryParameterCollectionFormatCall(pipe, ioutil, http, url, context, _callback); + + } + + /** + * + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testQueryParameterCollectionFormat(@jakarta.annotation.Nonnull List pipe, @jakarta.annotation.Nonnull List ioutil, @jakarta.annotation.Nonnull List http, @jakarta.annotation.Nonnull List url, @jakarta.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@jakarta.annotation.Nonnull List pipe, @jakarta.annotation.Nonnull List ioutil, @jakarta.annotation.Nonnull List http, @jakarta.annotation.Nonnull List url, @jakarta.annotation.Nonnull List context) throws ApiException { + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testQueryParameterCollectionFormatAsync(@jakarta.annotation.Nonnull List pipe, @jakarta.annotation.Nonnull List ioutil, @jakarta.annotation.Nonnull List http, @jakarta.annotation.Nonnull List url, @jakarta.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testStringMapReference + * @param requestBody request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testStringMapReferenceCall(@jakarta.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/fake/stringMap-reference"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testStringMapReferenceValidateBeforeCall(@jakarta.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling testStringMapReference(Async)"); + } + + return testStringMapReferenceCall(requestBody, _callback); + + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testStringMapReference(@jakarta.annotation.Nonnull Map requestBody) throws ApiException { + testStringMapReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testStringMapReferenceWithHttpInfo(@jakarta.annotation.Nonnull Map requestBody) throws ApiException { + okhttp3.Call localVarCall = testStringMapReferenceValidateBeforeCall(requestBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test referenced string map (asynchronously) + * + * @param requestBody request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testStringMapReferenceAsync(@jakarta.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testStringMapReferenceValidateBeforeCall(requestBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java new file mode 100644 index 000000000000..b38298c4cc4a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,204 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + + +import java.io.IOException; + + +import org.openapitools.client.model.Client; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeClassnameTags123Api { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for testClassname + * @param client client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameCall(@jakarta.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = client; + + // create path and map variables + String localVarPath = "/fake_classname_test"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key_query" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClassnameValidateBeforeCall(@jakarta.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException("Missing the required parameter 'client' when calling testClassname(Async)"); + } + + return testClassnameCall(client, _callback); + + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClassname(@jakarta.annotation.Nonnull Client client) throws ApiException { + ApiResponse localVarResp = testClassnameWithHttpInfo(client); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClassnameWithHttpInfo(@jakarta.annotation.Nonnull Client client) throws ApiException { + okhttp3.Call localVarCall = testClassnameValidateBeforeCall(client, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test class name in snake case (asynchronously) + * To test class name in snake case + * @param client client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameAsync(@jakarta.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testClassnameValidateBeforeCall(client, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..64458f52ca6b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1328 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PetApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addPet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call addPetCall(@jakarta.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addPetValidateBeforeCall(@jakarta.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling addPet(Async)"); + } + + return addPetCall(pet, _callback); + + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void addPet(@jakarta.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse addPetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Add a new pet to the store (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call addPetAsync(@jakarta.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deletePet + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetCall(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePetValidateBeforeCall(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); + } + + return deletePetCall(petId, apiKey, _callback); + + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public void deletePet(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws ApiException { + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deletes a pet (asynchronously) + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetAsync(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for findPetsByStatus + * @param status Status values that need to be considered for filter (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusCall(@jakarta.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "status", status)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByStatusValidateBeforeCall(@jakarta.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + + return findPetsByStatusCall(status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(@jakarta.annotation.Nonnull List status) throws ApiException { + ApiResponse> localVarResp = findPetsByStatusWithHttpInfo(status); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(@jakarta.annotation.Nonnull List status) throws ApiException { + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null); + + + Type localVarReturnType = new JSON.GenericType>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by status (asynchronously) + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusAsync(@jakarta.annotation.Nonnull List status, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback); + Type localVarReturnType = new JSON.GenericType>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for findPetsByTags + * @param tags Tags to filter by (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsCall(@jakarta.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByTagsValidateBeforeCall(@jakarta.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); + } + + return findPetsByTagsCall(tags, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public List findPetsByTags(@jakarta.annotation.Nonnull List tags) throws ApiException { + ApiResponse> localVarResp = findPetsByTagsWithHttpInfo(tags); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@jakarta.annotation.Nonnull List tags) throws ApiException { + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null); + + + Type localVarReturnType = new JSON.GenericType>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by tags (asynchronously) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsAsync(@jakarta.annotation.Nonnull List tags, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback); + Type localVarReturnType = new JSON.GenericType>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPetById + * @param petId ID of pet to return (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdCall(@jakarta.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(@jakarta.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + return getPetByIdCall(petId, _callback); + + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(@jakarta.annotation.Nonnull Long petId) throws ApiException { + ApiResponse localVarResp = getPetByIdWithHttpInfo(petId); + return localVarResp.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws ApiException { + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find pet by ID (asynchronously) + * Returns a single pet + * @param petId ID of pet to return (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdAsync(@jakarta.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetCall(@jakarta.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetValidateBeforeCall(@jakarta.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling updatePet(Async)"); + } + + return updatePetCall(pet, _callback); + + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public void updatePet(@jakarta.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public ApiResponse updatePetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update an existing pet (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetAsync(@jakarta.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updatePetWithForm + * @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) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormCall(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetWithFormValidateBeforeCall(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); + } + + return updatePetWithFormCall(petId, name, status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status) throws ApiException { + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updates a pet in the store with form data (asynchronously) + * + * @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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormAsync(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for uploadFile + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileCall(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String contentType, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (contentType != null) { + localVarHeaderParams.put("Content-Type", localVarApiClient.parameterToString(contentType)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileValidateBeforeCall(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String contentType, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); + } + + return uploadFileCall(petId, contentType, additionalMetadata, _file, _callback); + + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String contentType, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = uploadFileWithHttpInfo(petId, contentType, additionalMetadata, _file); + return localVarResp.getData(); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String contentType, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, contentType, additionalMetadata, _file, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (asynchronously) + * + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileAsync(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String contentType, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, contentType, additionalMetadata, _file, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for uploadFileWithRequiredFile + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileCall(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nonnull File requiredFile, @jakarta.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileWithRequiredFileValidateBeforeCall(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nonnull File requiredFile, @jakarta.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFileWithRequiredFile(Async)"); + } + + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) { + throw new ApiException("Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile(Async)"); + } + + return uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFileWithRequiredFile(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nonnull File requiredFile, @jakarta.annotation.Nullable String additionalMetadata) throws ApiException { + ApiResponse localVarResp = uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithRequiredFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nonnull File requiredFile, @jakarta.annotation.Nullable String additionalMetadata) throws ApiException { + okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (required) (asynchronously) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileAsync(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nonnull File requiredFile, @jakarta.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..9dcf4b893324 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,592 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + + +import java.io.IOException; + + +import org.openapitools.client.model.Order; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class StoreApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteOrder + * @param orderId ID of the order that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderCall(@jakarta.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replace("{" + "order_id" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOrderValidateBeforeCall(@jakarta.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); + } + + return deleteOrderCall(orderId, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(@jakarta.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(@jakarta.annotation.Nonnull String orderId) throws ApiException { + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete purchase order by ID (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderAsync(@jakarta.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getInventory + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getInventoryCall(_callback); + + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Map getInventory() throws ApiException { + ApiResponse> localVarResp = getInventoryWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null); + + + Type localVarReturnType = new JSON.GenericType>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Returns pet inventories by status (asynchronously) + * Returns a map of status codes to quantities + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback); + Type localVarReturnType = new JSON.GenericType>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderById + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdCall(@jakarta.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replace("{" + "order_id" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderByIdValidateBeforeCall(@jakarta.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); + } + + return getOrderByIdCall(orderId, _callback); + + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(@jakarta.annotation.Nonnull Long orderId) throws ApiException { + ApiResponse localVarResp = getOrderByIdWithHttpInfo(orderId); + return localVarResp.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(@jakarta.annotation.Nonnull Long orderId) throws ApiException { + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find purchase order by ID (asynchronously) + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdAsync(@jakarta.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for placeOrder + * @param order order placed for purchasing the pet (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderCall(@jakarta.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = order; + + // create path and map variables + String localVarPath = "/store/order"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(@jakarta.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException("Missing the required parameter 'order' when calling placeOrder(Async)"); + } + + return placeOrderCall(order, _callback); + + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(@jakarta.annotation.Nonnull Order order) throws ApiException { + ApiResponse localVarResp = placeOrderWithHttpInfo(order); + return localVarResp.getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(@jakarta.annotation.Nonnull Order order) throws ApiException { + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Place an order for a pet (asynchronously) + * + * @param order order placed for purchasing the pet (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderAsync(@jakarta.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..75bf404c0c45 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,1104 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + + +import java.io.IOException; + + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UserApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createUser + * @param user Created user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserCall(@jakarta.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUserValidateBeforeCall(@jakarta.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUser(Async)"); + } + + return createUserCall(user, _callback); + + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(@jakarta.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUserWithHttpInfo(@jakarta.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create user (asynchronously) + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserAsync(@jakarta.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithArrayInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputCall(@jakarta.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(@jakarta.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithArrayInput(Async)"); + } + + return createUsersWithArrayInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(@jakarta.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@jakarta.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputAsync(@jakarta.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithListInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputCall(@jakarta.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithList"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithListInputValidateBeforeCall(@jakarta.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithListInput(Async)"); + } + + return createUsersWithListInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(@jakarta.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(@jakarta.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputAsync(@jakarta.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteUser + * @param username The name that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserCall(@jakarta.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteUserValidateBeforeCall(@jakarta.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); + } + + return deleteUserCall(username, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(@jakarta.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(@jakarta.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete user (asynchronously) + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserAsync(@jakarta.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getUserByName + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameCall(@jakarta.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByNameValidateBeforeCall(@jakarta.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); + } + + return getUserByNameCall(username, _callback); + + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(@jakarta.annotation.Nonnull String username) throws ApiException { + ApiResponse localVarResp = getUserByNameWithHttpInfo(username); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(@jakarta.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get user by user name (asynchronously) + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameAsync(@jakarta.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for loginUser + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
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 okhttp3.Call loginUserCall(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (username != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); + } + + if (password != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("password", password)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call loginUserValidateBeforeCall(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); + } + + return loginUserCall(username, password, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
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(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password) throws ApiException { + ApiResponse localVarResp = loginUserWithHttpInfo(username, password); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
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(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password) throws ApiException { + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Logs user into the system (asynchronously) + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
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 okhttp3.Call loginUserAsync(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for logoutUser + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return logoutUserCall(_callback); + + } + + /** + * Logs out current logged in user session + * + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Logs out current logged in user session (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateUser + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserCall(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserValidateBeforeCall(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling updateUser(Async)"); + } + + return updateUserCall(username, user, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updated user (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserAsync(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/ValuesApi.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/ValuesApi.java new file mode 100644 index 000000000000..8f90b19fd7b1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/api/ValuesApi.java @@ -0,0 +1,198 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + + +import java.io.IOException; + + +import org.openapitools.client.model.Variable; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ValuesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ValuesApi() { + this(Configuration.getDefaultApiClient()); + } + + public ValuesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getSomeValues + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public okhttp3.Call getSomeValuesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/values"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSomeValuesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getSomeValuesCall(_callback); + + } + + /** + * Get some primitive variable values + * + * @return Variable + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public Variable getSomeValues() throws ApiException { + ApiResponse localVarResp = getSomeValuesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get some primitive variable values + * + * @return ApiResponse<Variable> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public ApiResponse getSomeValuesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getSomeValuesValidateBeforeCall(null); + + + Type localVarReturnType = new JSON.GenericType(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get some primitive variable values (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public okhttp3.Call getSomeValuesAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSomeValuesValidateBeforeCall(_callback); + Type localVarReturnType = new JSON.GenericType(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..677f8b441fe6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..19583eb3062a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * 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; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..cb5aab7cb017 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..42d103390f85 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/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; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..f78703725750 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,43 @@ +/* + * 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; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..57aab92c1470 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * 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; + +/** + * OAuth flows that are supported by this client + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..cefbf4af907b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * 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 okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..5521ee31599c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * 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.ApiException; +import org.openapitools.client.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..2a13fa371613 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.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 org.openapitools.client.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..be1a17800fdd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,380 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesClass + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesClass { + public static final String SERIALIZED_NAME_MAP_PROPERTY = "map_property"; + @JsonbProperty(SERIALIZED_NAME_MAP_PROPERTY) + @jakarta.annotation.Nullable + private Map mapProperty = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_OF_MAP_PROPERTY = "map_of_map_property"; + @JsonbProperty(SERIALIZED_NAME_MAP_OF_MAP_PROPERTY) + @jakarta.annotation.Nullable + private Map> mapOfMapProperty = new HashMap<>(); + + public static final String SERIALIZED_NAME_ANYTYPE1 = "anytype_1"; + @JsonbProperty(SERIALIZED_NAME_ANYTYPE1) + @jakarta.annotation.Nullable + private Object anytype1 = null; + + public static final String SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1 = "map_with_undeclared_properties_anytype_1"; + @JsonbProperty(SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1) + @jakarta.annotation.Nullable + private Object mapWithUndeclaredPropertiesAnytype1; + + public static final String SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2 = "map_with_undeclared_properties_anytype_2"; + @JsonbProperty(SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2) + @jakarta.annotation.Nullable + private Object mapWithUndeclaredPropertiesAnytype2; + + public static final String SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3 = "map_with_undeclared_properties_anytype_3"; + @JsonbProperty(SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3) + @jakarta.annotation.Nullable + private Map mapWithUndeclaredPropertiesAnytype3 = new HashMap<>(); + + public static final String SERIALIZED_NAME_EMPTY_MAP = "empty_map"; + @JsonbProperty(SERIALIZED_NAME_EMPTY_MAP) + @jakarta.annotation.Nullable + private Object emptyMap; + + public static final String SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_STRING = "map_with_undeclared_properties_string"; + @JsonbProperty(SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_STRING) + @jakarta.annotation.Nullable + private Map mapWithUndeclaredPropertiesString = new HashMap<>(); + + public AdditionalPropertiesClass() { + } + + public AdditionalPropertiesClass mapProperty(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public Map getMapProperty() { + return mapProperty; + } + + public void setMapProperty(@jakarta.annotation.Nullable Map mapProperty) { + this.mapProperty = mapProperty; + } + + + public AdditionalPropertiesClass mapOfMapProperty(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + public void setMapOfMapProperty(@jakarta.annotation.Nullable Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + public AdditionalPropertiesClass anytype1(@jakarta.annotation.Nullable Object anytype1) { + this.anytype1 = anytype1; + return this; + } + + /** + * Get anytype1 + * @return anytype1 + */ + @jakarta.annotation.Nullable + + public Object getAnytype1() { + return anytype1; + } + + public void setAnytype1(@jakarta.annotation.Nullable Object anytype1) { + this.anytype1 = anytype1; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype1(@jakarta.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype1) { + this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; + return this; + } + + /** + * Get mapWithUndeclaredPropertiesAnytype1 + * @return mapWithUndeclaredPropertiesAnytype1 + */ + @jakarta.annotation.Nullable + + public Object getMapWithUndeclaredPropertiesAnytype1() { + return mapWithUndeclaredPropertiesAnytype1; + } + + public void setMapWithUndeclaredPropertiesAnytype1(@jakarta.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype1) { + this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype2(@jakarta.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype2) { + this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; + return this; + } + + /** + * Get mapWithUndeclaredPropertiesAnytype2 + * @return mapWithUndeclaredPropertiesAnytype2 + */ + @jakarta.annotation.Nullable + + public Object getMapWithUndeclaredPropertiesAnytype2() { + return mapWithUndeclaredPropertiesAnytype2; + } + + public void setMapWithUndeclaredPropertiesAnytype2(@jakarta.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype2) { + this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype3(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public Map getMapWithUndeclaredPropertiesAnytype3() { + return mapWithUndeclaredPropertiesAnytype3; + } + + public void setMapWithUndeclaredPropertiesAnytype3(@jakarta.annotation.Nullable Map mapWithUndeclaredPropertiesAnytype3) { + this.mapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; + } + + + public AdditionalPropertiesClass emptyMap(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public Object getEmptyMap() { + return emptyMap; + } + + public void setEmptyMap(@jakarta.annotation.Nullable Object emptyMap) { + this.emptyMap = emptyMap; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesString(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public Map getMapWithUndeclaredPropertiesString() { + return mapWithUndeclaredPropertiesString; + } + + public void setMapWithUndeclaredPropertiesString(@jakarta.annotation.Nullable Map mapWithUndeclaredPropertiesString) { + this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesClass instance itself + */ + public AdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("map_property", "map_of_map_property", "anytype_1", "map_with_undeclared_properties_anytype_1", "map_with_undeclared_properties_anytype_2", "map_with_undeclared_properties_anytype_3", "empty_map", "map_with_undeclared_properties_string")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java new file mode 100644 index 000000000000..1c5758167bdf --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java @@ -0,0 +1,232 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributes; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfModelArrayAnyOf + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfModelArrayAnyOf { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name = "default-name"; + + public static final String SERIALIZED_NAME_LINK_LIST_COLUMN1 = "linkListColumn1"; + @JsonbProperty(SERIALIZED_NAME_LINK_LIST_COLUMN1) + @jakarta.annotation.Nullable + private AllOfModelArrayAnyOfAllOfLinkListColumn1 linkListColumn1; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @JsonbProperty(SERIALIZED_NAME_ATTRIBUTES) + @jakarta.annotation.Nullable + private AllOfModelArrayAnyOfAllOfAttributes attributes; + + public AllOfModelArrayAnyOf() { + } + + public AllOfModelArrayAnyOf id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public AllOfModelArrayAnyOf name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + + public AllOfModelArrayAnyOf linkListColumn1(@jakarta.annotation.Nullable AllOfModelArrayAnyOfAllOfLinkListColumn1 linkListColumn1) { + this.linkListColumn1 = linkListColumn1; + return this; + } + + /** + * Get linkListColumn1 + * @return linkListColumn1 + */ + @jakarta.annotation.Nullable + + public AllOfModelArrayAnyOfAllOfLinkListColumn1 getLinkListColumn1() { + return linkListColumn1; + } + + public void setLinkListColumn1(@jakarta.annotation.Nullable AllOfModelArrayAnyOfAllOfLinkListColumn1 linkListColumn1) { + this.linkListColumn1 = linkListColumn1; + } + + + public AllOfModelArrayAnyOf attributes(@jakarta.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @jakarta.annotation.Nullable + + public AllOfModelArrayAnyOfAllOfAttributes getAttributes() { + return attributes; + } + + public void setAttributes(@jakarta.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributes attributes) { + this.attributes = attributes; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfModelArrayAnyOf instance itself + */ + public AllOfModelArrayAnyOf putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfModelArrayAnyOf {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" linkListColumn1: ").append(toIndentedString(linkListColumn1)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name", "linkListColumn1", "attributes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java new file mode 100644 index 000000000000..60f4d88d551f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java @@ -0,0 +1,153 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributesC; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfModelArrayAnyOfAllOfAttributes + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfModelArrayAnyOfAllOfAttributes { + public static final String SERIALIZED_NAME_C = "C"; + @JsonbProperty(SERIALIZED_NAME_C) + @jakarta.annotation.Nullable + private AllOfModelArrayAnyOfAllOfAttributesC C; + + public AllOfModelArrayAnyOfAllOfAttributes() { + } + + public AllOfModelArrayAnyOfAllOfAttributes C(@jakarta.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributesC C) { + this.C = C; + return this; + } + + /** + * Get C + * @return C + */ + @jakarta.annotation.Nullable + + public AllOfModelArrayAnyOfAllOfAttributesC getC() { + return C; + } + + public void setC(@jakarta.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributesC C) { + this.C = C; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfModelArrayAnyOfAllOfAttributes instance itself + */ + public AllOfModelArrayAnyOfAllOfAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfModelArrayAnyOfAllOfAttributes {\n"); + sb.append(" C: ").append(toIndentedString(C)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("C")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java new file mode 100644 index 000000000000..e558c63e878c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java @@ -0,0 +1,136 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Order; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.Tag; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfModelArrayAnyOfAllOfAttributesC extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AllOfModelArrayAnyOfAllOfAttributesC.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public AllOfModelArrayAnyOfAllOfAttributesC() { + super("oneOf", Boolean.FALSE); + } + + public AllOfModelArrayAnyOfAllOfAttributesC(Order o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public AllOfModelArrayAnyOfAllOfAttributesC(Pet o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Order", Order.class); + schemas.put("Pet", Pet.class); + } + + @Override + public Map> getSchemas() { + return AllOfModelArrayAnyOfAllOfAttributesC.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Order, Pet + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Order.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Pet.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Order, Pet"); + } + + /** + * Get the actual instance, which can be the following: + * Order, Pet + * + * @return The actual instance (Order, Pet) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Order`. If the actual instance is not `Order`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Order` + * @throws ClassCastException if the instance is not `Order` + */ + public Order getOrder() throws ClassCastException { + return (Order)super.getActualInstance(); + } + + /** + * Get the actual instance of `Pet`. If the actual instance is not `Pet`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Pet` + * @throws ClassCastException if the instance is not `Pet` + */ + public Pet getPet() throws ClassCastException { + return (Pet)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java new file mode 100644 index 000000000000..7b82430c15bf --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1Value; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfModelArrayAnyOfAllOfLinkListColumn1 { + public static final String SERIALIZED_NAME_VALUE = "value"; + @JsonbProperty(SERIALIZED_NAME_VALUE) + @jakarta.annotation.Nonnull + private List value = new ArrayList<>(); + + public AllOfModelArrayAnyOfAllOfLinkListColumn1() { + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1 value(@jakarta.annotation.Nonnull List value) { + this.value = value; + return this; + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1 addValueItem(AllOfModelArrayAnyOfAllOfLinkListColumn1Value valueItem) { + if (this.value == null) { + this.value = new ArrayList<>(); + } + this.value.add(valueItem); + return this; + } + + /** + * Get value + * @return value + */ + @jakarta.annotation.Nonnull + + public List getValue() { + return value; + } + + public void setValue(@jakarta.annotation.Nonnull List value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfModelArrayAnyOfAllOfLinkListColumn1 instance itself + */ + public AllOfModelArrayAnyOfAllOfLinkListColumn1 putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfModelArrayAnyOfAllOfLinkListColumn1 {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("value")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java new file mode 100644 index 000000000000..6917369d845c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.Tag; +import org.openapitools.client.model.User; +import org.openapitools.jackson.nullable.JsonNullable; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfModelArrayAnyOfAllOfLinkListColumn1Value extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AllOfModelArrayAnyOfAllOfLinkListColumn1Value.class.getName()); + + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value() { + super("anyOf", Boolean.FALSE); + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(Tag o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(User o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Tag", Tag.class); + schemas.put("User", User.class); + } + + @Override + public Map> getSchemas() { + return AllOfModelArrayAnyOfAllOfLinkListColumn1Value.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Tag, User + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Tag.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(User.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Tag, User"); + } + + /** + * Get the actual instance, which can be the following: + * Tag, User + * + * @return The actual instance (Tag, User) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Tag`. If the actual instance is not `Tag`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Tag` + * @throws ClassCastException if the instance is not `Tag` + */ + public Tag getTag() throws ClassCastException { + return (Tag)super.getActualInstance(); + } + + /** + * Get the actual instance of `User`. If the actual instance is not `User`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `User` + * @throws ClassCastException if the instance is not `User` + */ + public User getUser() throws ClassCastException { + return (User)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java new file mode 100644 index 000000000000..77134321de47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to double + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfRefToDouble { + public static final String SERIALIZED_NAME_HEIGHT = "height"; + @JsonbProperty(SERIALIZED_NAME_HEIGHT) + @jakarta.annotation.Nullable + private Double height = 32.1d; + + public AllOfRefToDouble() { + } + + public AllOfRefToDouble height(@jakarta.annotation.Nullable Double height) { + this.height = height; + return this; + } + + /** + * Height as double + * @return height + */ + @jakarta.annotation.Nullable + + public Double getHeight() { + return height; + } + + public void setHeight(@jakarta.annotation.Nullable Double height) { + this.height = height; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToDouble instance itself + */ + public AllOfRefToDouble putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToDouble {\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("height")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java new file mode 100644 index 000000000000..d78a50016232 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to float + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfRefToFloat { + public static final String SERIALIZED_NAME_WEIGHT = "weight"; + @JsonbProperty(SERIALIZED_NAME_WEIGHT) + @jakarta.annotation.Nullable + private Float weight = 7.89f; + + public AllOfRefToFloat() { + } + + public AllOfRefToFloat weight(@jakarta.annotation.Nullable Float weight) { + this.weight = weight; + return this; + } + + /** + * Weight as float + * @return weight + */ + @jakarta.annotation.Nullable + + public Float getWeight() { + return weight; + } + + public void setWeight(@jakarta.annotation.Nullable Float weight) { + this.weight = weight; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToFloat instance itself + */ + public AllOfRefToFloat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToFloat {\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("weight")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToLong.java new file mode 100644 index 000000000000..18b6fa0fc13b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to long + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfRefToLong { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id = 10l; + + public AllOfRefToLong() { + } + + public AllOfRefToLong id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Id as long + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToLong instance itself + */ + public AllOfRefToLong putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToLong {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 000000000000..f91847826f44 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Animal.java @@ -0,0 +1,179 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Animal + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Animal { + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @JsonbProperty(SERIALIZED_NAME_CLASS_NAME) + @jakarta.annotation.Nonnull + protected String className; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @JsonbProperty(SERIALIZED_NAME_COLOR) + @jakarta.annotation.Nullable + private String color = "red"; + + public Animal() { + this.className = this.getClass().getSimpleName(); + } + + public Animal className(@jakarta.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @jakarta.annotation.Nonnull + + public String getClassName() { + return className; + } + + public void setClassName(@jakarta.annotation.Nonnull String className) { + this.className = className; + } + + + public Animal color(@jakarta.annotation.Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @jakarta.annotation.Nullable + + public String getColor() { + return color; + } + + public void setColor(@jakarta.annotation.Nullable String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Animal instance itself + */ + public Animal putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Apple.java new file mode 100644 index 000000000000..8587480b7f25 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Apple.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Apple + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Apple { + public static final String SERIALIZED_NAME_CULTIVAR = "cultivar"; + @JsonbProperty(SERIALIZED_NAME_CULTIVAR) + @jakarta.annotation.Nullable + private String cultivar; + + public static final String SERIALIZED_NAME_ORIGIN = "origin"; + @JsonbProperty(SERIALIZED_NAME_ORIGIN) + @jakarta.annotation.Nullable + private String origin; + + public Apple() { + } + + public Apple cultivar(@jakarta.annotation.Nullable String cultivar) { + this.cultivar = cultivar; + return this; + } + + /** + * Get cultivar + * @return cultivar + */ + @jakarta.annotation.Nullable + + public String getCultivar() { + return cultivar; + } + + public void setCultivar(@jakarta.annotation.Nullable String cultivar) { + this.cultivar = cultivar; + } + + + public Apple origin(@jakarta.annotation.Nullable String origin) { + this.origin = origin; + return this; + } + + /** + * Get origin + * @return origin + */ + @jakarta.annotation.Nullable + + public String getOrigin() { + return origin; + } + + public void setOrigin(@jakarta.annotation.Nullable String origin) { + this.origin = origin; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Apple instance itself + */ + public Apple putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("cultivar", "origin")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AppleReq.java new file mode 100644 index 000000000000..b77fec341867 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AppleReq.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AppleReq + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AppleReq { + public static final String SERIALIZED_NAME_CULTIVAR = "cultivar"; + @JsonbProperty(SERIALIZED_NAME_CULTIVAR) + @jakarta.annotation.Nonnull + private String cultivar; + + public static final String SERIALIZED_NAME_MEALY = "mealy"; + @JsonbProperty(SERIALIZED_NAME_MEALY) + @jakarta.annotation.Nullable + private Boolean mealy; + + public AppleReq() { + } + + public AppleReq cultivar(@jakarta.annotation.Nonnull String cultivar) { + this.cultivar = cultivar; + return this; + } + + /** + * Get cultivar + * @return cultivar + */ + @jakarta.annotation.Nonnull + + public String getCultivar() { + return cultivar; + } + + public void setCultivar(@jakarta.annotation.Nonnull String cultivar) { + this.cultivar = cultivar; + } + + + public AppleReq mealy(@jakarta.annotation.Nullable Boolean mealy) { + this.mealy = mealy; + return this; + } + + /** + * Get mealy + * @return mealy + */ + @jakarta.annotation.Nullable + + public Boolean getMealy() { + return mealy; + } + + public void setMealy(@jakarta.annotation.Nullable Boolean mealy) { + this.mealy = mealy; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AppleReq instance itself + */ + public AppleReq putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("cultivar", "mealy")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("cultivar")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayAnyOf.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayAnyOf.java new file mode 100644 index 000000000000..c938b507089a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayAnyOf.java @@ -0,0 +1,129 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayAnyOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ArrayAnyOf.class.getName()); + + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public ArrayAnyOf() { + super("anyOf", Boolean.FALSE); + } + + public ArrayAnyOf(Integer o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ArrayAnyOf(List o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("List", List.class); + } + + @Override + public Map> getSchemas() { + return ArrayAnyOf.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Integer, List + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, List"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, List + * + * @return The actual instance (Integer, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayDefault.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayDefault.java new file mode 100644 index 000000000000..463174cea6ac --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayDefault.java @@ -0,0 +1,197 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayDefault + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayDefault { + public static final String SERIALIZED_NAME_WITH_DEFAULT_EMPTY_BRACKET = "WithDefaultEmptyBracket"; + @JsonbProperty(SERIALIZED_NAME_WITH_DEFAULT_EMPTY_BRACKET) + @jakarta.annotation.Nullable + private List withDefaultEmptyBracket = new ArrayList<>(); + + public static final String SERIALIZED_NAME_WITHOUT_DEFAULT = "WithoutDefault"; + @JsonbProperty(SERIALIZED_NAME_WITHOUT_DEFAULT) + @jakarta.annotation.Nullable + private List withoutDefault = new ArrayList<>(); + + public ArrayDefault() { + } + + public ArrayDefault withDefaultEmptyBracket(@jakarta.annotation.Nullable List withDefaultEmptyBracket) { + this.withDefaultEmptyBracket = withDefaultEmptyBracket; + return this; + } + + public ArrayDefault addWithDefaultEmptyBracketItem(String withDefaultEmptyBracketItem) { + if (this.withDefaultEmptyBracket == null) { + this.withDefaultEmptyBracket = new ArrayList<>(); + } + this.withDefaultEmptyBracket.add(withDefaultEmptyBracketItem); + return this; + } + + /** + * Get withDefaultEmptyBracket + * @return withDefaultEmptyBracket + */ + @jakarta.annotation.Nullable + + public List getWithDefaultEmptyBracket() { + return withDefaultEmptyBracket; + } + + public void setWithDefaultEmptyBracket(@jakarta.annotation.Nullable List withDefaultEmptyBracket) { + this.withDefaultEmptyBracket = withDefaultEmptyBracket; + } + + + public ArrayDefault withoutDefault(@jakarta.annotation.Nullable List withoutDefault) { + this.withoutDefault = withoutDefault; + return this; + } + + public ArrayDefault addWithoutDefaultItem(String withoutDefaultItem) { + if (this.withoutDefault == null) { + this.withoutDefault = new ArrayList<>(); + } + this.withoutDefault.add(withoutDefaultItem); + return this; + } + + /** + * Get withoutDefault + * @return withoutDefault + */ + @jakarta.annotation.Nullable + + public List getWithoutDefault() { + return withoutDefault; + } + + public void setWithoutDefault(@jakarta.annotation.Nullable List withoutDefault) { + this.withoutDefault = withoutDefault; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayDefault instance itself + */ + public ArrayDefault putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayDefault {\n"); + sb.append(" withDefaultEmptyBracket: ").append(toIndentedString(withDefaultEmptyBracket)).append("\n"); + sb.append(" withoutDefault: ").append(toIndentedString(withoutDefault)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("WithDefaultEmptyBracket", "WithoutDefault")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..8c04cd3c0939 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfArrayOfNumberOnly + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOfArrayOfNumberOnly { + public static final String SERIALIZED_NAME_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + @JsonbProperty(SERIALIZED_NAME_ARRAY_ARRAY_NUMBER) + @jakarta.annotation.Nullable + private List> arrayArrayNumber = new ArrayList<>(); + + public ArrayOfArrayOfNumberOnly() { + } + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + public void setArrayArrayNumber(@jakarta.annotation.Nullable List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfArrayOfNumberOnly instance itself + */ + public ArrayOfArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ArrayArrayNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java new file mode 100644 index 000000000000..a10141679626 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java @@ -0,0 +1,216 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ArrayOfInlineAllOfArrayAllofDogPropertyInner; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfInlineAllOf + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOfInlineAllOf { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_ARRAY_ALLOF_DOG_PROPERTY = "array_allof_dog_property"; + @JsonbProperty(SERIALIZED_NAME_ARRAY_ALLOF_DOG_PROPERTY) + @jakarta.annotation.Nullable + private List arrayAllofDogProperty = new ArrayList<>(); + + public ArrayOfInlineAllOf() { + } + + public ArrayOfInlineAllOf id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public ArrayOfInlineAllOf name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + + public ArrayOfInlineAllOf arrayAllofDogProperty(@jakarta.annotation.Nullable List arrayAllofDogProperty) { + this.arrayAllofDogProperty = arrayAllofDogProperty; + return this; + } + + public ArrayOfInlineAllOf addArrayAllofDogPropertyItem(ArrayOfInlineAllOfArrayAllofDogPropertyInner arrayAllofDogPropertyItem) { + if (this.arrayAllofDogProperty == null) { + this.arrayAllofDogProperty = new ArrayList<>(); + } + this.arrayAllofDogProperty.add(arrayAllofDogPropertyItem); + return this; + } + + /** + * Get arrayAllofDogProperty + * @return arrayAllofDogProperty + */ + @jakarta.annotation.Nullable + + public List getArrayAllofDogProperty() { + return arrayAllofDogProperty; + } + + public void setArrayAllofDogProperty(@jakarta.annotation.Nullable List arrayAllofDogProperty) { + this.arrayAllofDogProperty = arrayAllofDogProperty; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfInlineAllOf instance itself + */ + public ArrayOfInlineAllOf putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfInlineAllOf {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" arrayAllofDogProperty: ").append(toIndentedString(arrayAllofDogProperty)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name", "array_allof_dog_property")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java new file mode 100644 index 000000000000..b35b88a6c3c3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOfInlineAllOfArrayAllofDogPropertyInner { + public static final String SERIALIZED_NAME_BREED = "breed"; + @JsonbProperty(SERIALIZED_NAME_BREED) + @jakarta.annotation.Nullable + private String breed; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @JsonbProperty(SERIALIZED_NAME_COLOR) + @jakarta.annotation.Nullable + private String color; + + public ArrayOfInlineAllOfArrayAllofDogPropertyInner() { + } + + public ArrayOfInlineAllOfArrayAllofDogPropertyInner breed(@jakarta.annotation.Nullable String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + */ + @jakarta.annotation.Nullable + + public String getBreed() { + return breed; + } + + public void setBreed(@jakarta.annotation.Nullable String breed) { + this.breed = breed; + } + + + public ArrayOfInlineAllOfArrayAllofDogPropertyInner color(@jakarta.annotation.Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @jakarta.annotation.Nullable + + public String getColor() { + return color; + } + + public void setColor(@jakarta.annotation.Nullable String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfInlineAllOfArrayAllofDogPropertyInner instance itself + */ + public ArrayOfInlineAllOfArrayAllofDogPropertyInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfInlineAllOfArrayAllofDogPropertyInner {\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("breed", "color")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..7faaa3feacd1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfNumberOnly + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOfNumberOnly { + public static final String SERIALIZED_NAME_ARRAY_NUMBER = "ArrayNumber"; + @JsonbProperty(SERIALIZED_NAME_ARRAY_NUMBER) + @jakarta.annotation.Nullable + private List arrayNumber = new ArrayList<>(); + + public ArrayOfNumberOnly() { + } + + public ArrayOfNumberOnly arrayNumber(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public List getArrayNumber() { + return arrayNumber; + } + + public void setArrayNumber(@jakarta.annotation.Nullable List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfNumberOnly instance itself + */ + public ArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ArrayNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOneOf.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOneOf.java new file mode 100644 index 000000000000..6dd46938a0e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOneOf.java @@ -0,0 +1,129 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOneOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ArrayOneOf.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public ArrayOneOf() { + super("oneOf", Boolean.FALSE); + } + + public ArrayOneOf(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ArrayOneOf(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("List", List.class); + } + + @Override + public Map> getSchemas() { + return ArrayOneOf.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Integer, List + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, List"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, List + * + * @return The actual instance (Integer, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayTest.java new file mode 100644 index 000000000000..b902d7b08f17 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -0,0 +1,232 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayTest + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayTest { + public static final String SERIALIZED_NAME_ARRAY_OF_STRING = "array_of_string"; + @JsonbProperty(SERIALIZED_NAME_ARRAY_OF_STRING) + @jakarta.annotation.Nullable + private List arrayOfString = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + @JsonbProperty(SERIALIZED_NAME_ARRAY_ARRAY_OF_INTEGER) + @jakarta.annotation.Nullable + private List> arrayArrayOfInteger = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + @JsonbProperty(SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL) + @jakarta.annotation.Nullable + private List> arrayArrayOfModel = new ArrayList<>(); + + public ArrayTest() { + } + + public ArrayTest arrayOfString(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public List getArrayOfString() { + return arrayOfString; + } + + public void setArrayOfString(@jakarta.annotation.Nullable List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + + public ArrayTest arrayArrayOfInteger(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + public void setArrayArrayOfInteger(@jakarta.annotation.Nullable List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + + public ArrayTest arrayArrayOfModel(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + public void setArrayArrayOfModel(@jakarta.annotation.Nullable List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayTest instance itself + */ + public ArrayTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("array_of_string", "array_array_of_integer", "array_array_of_model")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Banana.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Banana.java new file mode 100644 index 000000000000..2356396531d6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Banana.java @@ -0,0 +1,153 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Banana + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Banana { + public static final String SERIALIZED_NAME_LENGTH_CM = "lengthCm"; + @JsonbProperty(SERIALIZED_NAME_LENGTH_CM) + @jakarta.annotation.Nullable + private BigDecimal lengthCm; + + public Banana() { + } + + public Banana lengthCm(@jakarta.annotation.Nullable BigDecimal lengthCm) { + this.lengthCm = lengthCm; + return this; + } + + /** + * Get lengthCm + * @return lengthCm + */ + @jakarta.annotation.Nullable + + public BigDecimal getLengthCm() { + return lengthCm; + } + + public void setLengthCm(@jakarta.annotation.Nullable BigDecimal lengthCm) { + this.lengthCm = lengthCm; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Banana instance itself + */ + public Banana putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Banana {\n"); + sb.append(" lengthCm: ").append(toIndentedString(lengthCm)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("lengthCm")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BananaReq.java new file mode 100644 index 000000000000..7003cecf1e9e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BananaReq.java @@ -0,0 +1,179 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BananaReq + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class BananaReq { + public static final String SERIALIZED_NAME_LENGTH_CM = "lengthCm"; + @JsonbProperty(SERIALIZED_NAME_LENGTH_CM) + @jakarta.annotation.Nonnull + private BigDecimal lengthCm; + + public static final String SERIALIZED_NAME_SWEET = "sweet"; + @JsonbProperty(SERIALIZED_NAME_SWEET) + @jakarta.annotation.Nullable + private Boolean sweet; + + public BananaReq() { + } + + public BananaReq lengthCm(@jakarta.annotation.Nonnull BigDecimal lengthCm) { + this.lengthCm = lengthCm; + return this; + } + + /** + * Get lengthCm + * @return lengthCm + */ + @jakarta.annotation.Nonnull + + public BigDecimal getLengthCm() { + return lengthCm; + } + + public void setLengthCm(@jakarta.annotation.Nonnull BigDecimal lengthCm) { + this.lengthCm = lengthCm; + } + + + public BananaReq sweet(@jakarta.annotation.Nullable Boolean sweet) { + this.sweet = sweet; + return this; + } + + /** + * Get sweet + * @return sweet + */ + @jakarta.annotation.Nullable + + public Boolean getSweet() { + return sweet; + } + + public void setSweet(@jakarta.annotation.Nullable Boolean sweet) { + this.sweet = sweet; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BananaReq instance itself + */ + public BananaReq putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("lengthCm", "sweet")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("lengthCm")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BasquePig.java new file mode 100644 index 000000000000..62c0d7f0191c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BasquePig.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BasquePig + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class BasquePig { + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @JsonbProperty(SERIALIZED_NAME_CLASS_NAME) + @jakarta.annotation.Nonnull + private String className; + + public BasquePig() { + } + + public BasquePig className(@jakarta.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @jakarta.annotation.Nonnull + + public String getClassName() { + return className; + } + + public void setClassName(@jakarta.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BasquePig instance itself + */ + public BasquePig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BasquePig {\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Capitalization.java new file mode 100644 index 000000000000..5c97ebcce378 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Capitalization.java @@ -0,0 +1,282 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Capitalization + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Capitalization { + public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; + @JsonbProperty(SERIALIZED_NAME_SMALL_CAMEL) + @jakarta.annotation.Nullable + private String smallCamel; + + public static final String SERIALIZED_NAME_CAPITAL_CAMEL = "CapitalCamel"; + @JsonbProperty(SERIALIZED_NAME_CAPITAL_CAMEL) + @jakarta.annotation.Nullable + private String capitalCamel; + + public static final String SERIALIZED_NAME_SMALL_SNAKE = "small_Snake"; + @JsonbProperty(SERIALIZED_NAME_SMALL_SNAKE) + @jakarta.annotation.Nullable + private String smallSnake; + + public static final String SERIALIZED_NAME_CAPITAL_SNAKE = "Capital_Snake"; + @JsonbProperty(SERIALIZED_NAME_CAPITAL_SNAKE) + @jakarta.annotation.Nullable + private String capitalSnake; + + public static final String SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + @JsonbProperty(SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS) + @jakarta.annotation.Nullable + private String scAETHFlowPoints; + + public static final String SERIALIZED_NAME_A_T_T_N_A_M_E = "ATT_NAME"; + @JsonbProperty(SERIALIZED_NAME_A_T_T_N_A_M_E) + @jakarta.annotation.Nullable + private String ATT_NAME; + + public Capitalization() { + } + + public Capitalization smallCamel(@jakarta.annotation.Nullable String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + */ + @jakarta.annotation.Nullable + + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(@jakarta.annotation.Nullable String smallCamel) { + this.smallCamel = smallCamel; + } + + + public Capitalization capitalCamel(@jakarta.annotation.Nullable String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + */ + @jakarta.annotation.Nullable + + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(@jakarta.annotation.Nullable String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + + public Capitalization smallSnake(@jakarta.annotation.Nullable String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + */ + @jakarta.annotation.Nullable + + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(@jakarta.annotation.Nullable String smallSnake) { + this.smallSnake = smallSnake; + } + + + public Capitalization capitalSnake(@jakarta.annotation.Nullable String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + */ + @jakarta.annotation.Nullable + + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(@jakarta.annotation.Nullable String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + + public Capitalization scAETHFlowPoints(@jakarta.annotation.Nullable String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + */ + @jakarta.annotation.Nullable + + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(@jakarta.annotation.Nullable String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + + public Capitalization ATT_NAME(@jakarta.annotation.Nullable String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + */ + @jakarta.annotation.Nullable + + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(@jakarta.annotation.Nullable String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Capitalization instance itself + */ + public Capitalization putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 000000000000..32b201ee9ac1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,156 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.Map; +import org.openapitools.client.model.Animal; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Cat + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Cat extends Animal { + public static final String SERIALIZED_NAME_DECLAWED = "declawed"; + @JsonbProperty(SERIALIZED_NAME_DECLAWED) + @jakarta.annotation.Nullable + private Boolean declawed; + + public Cat() { + this.className = this.getClass().getSimpleName(); + } + + public Cat declawed(@jakarta.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + */ + @jakarta.annotation.Nullable + + public Boolean getDeclawed() { + return declawed; + } + + public void setDeclawed(@jakarta.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Cat instance itself + */ + public Cat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "declawed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..af65ab6b13a7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Category.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Category + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Category { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name = "default-name"; + + public Category() { + } + + public Category id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ClassModel.java new file mode 100644 index 000000000000..5096f22a6671 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ClassModel.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model with \"_class\" property + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ClassModel { + public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; + @JsonbProperty(SERIALIZED_NAME_PROPERTY_CLASS) + @jakarta.annotation.Nullable + private String propertyClass; + + public ClassModel() { + } + + public ClassModel propertyClass(@jakarta.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @jakarta.annotation.Nullable + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(@jakarta.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ClassModel instance itself + */ + public ClassModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("_class")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Client.java new file mode 100644 index 000000000000..0524d88fa2cb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Client.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Client + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Client { + public static final String SERIALIZED_NAME_CLIENT = "client"; + @JsonbProperty(SERIALIZED_NAME_CLIENT) + @jakarta.annotation.Nullable + private String client; + + public Client() { + } + + public Client client(@jakarta.annotation.Nullable String client) { + this.client = client; + return this; + } + + /** + * Get client + * @return client + */ + @jakarta.annotation.Nullable + + public String getClient() { + return client; + } + + public void setClient(@jakarta.annotation.Nullable String client) { + this.client = client; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Client instance itself + */ + public Client putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("client")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java new file mode 100644 index 000000000000..5d8b21e920cb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ComplexQuadrilateral + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ComplexQuadrilateral { + public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; + @JsonbProperty(SERIALIZED_NAME_SHAPE_TYPE) + @jakarta.annotation.Nonnull + private String shapeType; + + public static final String SERIALIZED_NAME_QUADRILATERAL_TYPE = "quadrilateralType"; + @JsonbProperty(SERIALIZED_NAME_QUADRILATERAL_TYPE) + @jakarta.annotation.Nonnull + private String quadrilateralType; + + public ComplexQuadrilateral() { + } + + public ComplexQuadrilateral shapeType(@jakarta.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @jakarta.annotation.Nonnull + + public String getShapeType() { + return shapeType; + } + + public void setShapeType(@jakarta.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public ComplexQuadrilateral quadrilateralType(@jakarta.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + */ + @jakarta.annotation.Nonnull + + public String getQuadrilateralType() { + return quadrilateralType; + } + + public void setQuadrilateralType(@jakarta.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ComplexQuadrilateral instance itself + */ + public ComplexQuadrilateral putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DanishPig.java new file mode 100644 index 000000000000..6044c3a5fe6c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DanishPig.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DanishPig + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class DanishPig { + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @JsonbProperty(SERIALIZED_NAME_CLASS_NAME) + @jakarta.annotation.Nonnull + private String className; + + public DanishPig() { + } + + public DanishPig className(@jakarta.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @jakarta.annotation.Nonnull + + public String getClassName() { + return className; + } + + public void setClassName(@jakarta.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DanishPig instance itself + */ + public DanishPig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DanishPig {\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DeprecatedObject.java new file mode 100644 index 000000000000..246eb446209e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -0,0 +1,154 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DeprecatedObject + * @deprecated + */ +@Deprecated +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class DeprecatedObject { + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public DeprecatedObject() { + } + + public DeprecatedObject name(@jakarta.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DeprecatedObject instance itself + */ + public DeprecatedObject putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeprecatedObject {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 000000000000..0ef71c6ef893 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,155 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.Animal; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Dog + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Dog extends Animal { + public static final String SERIALIZED_NAME_BREED = "breed"; + @JsonbProperty(SERIALIZED_NAME_BREED) + @jakarta.annotation.Nullable + private String breed; + + public Dog() { + this.className = this.getClass().getSimpleName(); + } + + public Dog breed(@jakarta.annotation.Nullable String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + */ + @jakarta.annotation.Nullable + + public String getBreed() { + return breed; + } + + public void setBreed(@jakarta.annotation.Nullable String breed) { + this.breed = breed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Dog instance itself + */ + public Dog putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "breed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Drawing.java new file mode 100644 index 000000000000..ea7803af610c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Drawing.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Fruit; +import org.openapitools.client.model.NullableShape; +import org.openapitools.client.model.Shape; +import org.openapitools.client.model.ShapeOrNull; +import org.openapitools.jackson.nullable.JsonNullable; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Drawing + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Drawing { + public static final String SERIALIZED_NAME_MAIN_SHAPE = "mainShape"; + @JsonbProperty(SERIALIZED_NAME_MAIN_SHAPE) + @jakarta.annotation.Nullable + private Shape mainShape; + + public static final String SERIALIZED_NAME_SHAPE_OR_NULL = "shapeOrNull"; + @JsonbProperty(SERIALIZED_NAME_SHAPE_OR_NULL) + @jakarta.annotation.Nullable + private ShapeOrNull shapeOrNull; + + public static final String SERIALIZED_NAME_NULLABLE_SHAPE = "nullableShape"; + @JsonbProperty(SERIALIZED_NAME_NULLABLE_SHAPE) + @jakarta.annotation.Nullable + private NullableShape nullableShape; + + public static final String SERIALIZED_NAME_SHAPES = "shapes"; + @JsonbProperty(SERIALIZED_NAME_SHAPES) + @jakarta.annotation.Nullable + private List shapes = new ArrayList<>(); + + public Drawing() { + } + + public Drawing mainShape(@jakarta.annotation.Nullable Shape mainShape) { + this.mainShape = mainShape; + return this; + } + + /** + * Get mainShape + * @return mainShape + */ + @jakarta.annotation.Nullable + + public Shape getMainShape() { + return mainShape; + } + + public void setMainShape(@jakarta.annotation.Nullable Shape mainShape) { + this.mainShape = mainShape; + } + + + public Drawing shapeOrNull(@jakarta.annotation.Nullable ShapeOrNull shapeOrNull) { + this.shapeOrNull = shapeOrNull; + return this; + } + + /** + * Get shapeOrNull + * @return shapeOrNull + */ + @jakarta.annotation.Nullable + + public ShapeOrNull getShapeOrNull() { + return shapeOrNull; + } + + public void setShapeOrNull(@jakarta.annotation.Nullable ShapeOrNull shapeOrNull) { + this.shapeOrNull = shapeOrNull; + } + + + public Drawing nullableShape(@jakarta.annotation.Nullable NullableShape nullableShape) { + this.nullableShape = nullableShape; + return this; + } + + /** + * Get nullableShape + * @return nullableShape + */ + @jakarta.annotation.Nullable + + public NullableShape getNullableShape() { + return nullableShape; + } + + public void setNullableShape(@jakarta.annotation.Nullable NullableShape nullableShape) { + this.nullableShape = nullableShape; + } + + + public Drawing shapes(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public List getShapes() { + return shapes; + } + + public void setShapes(@jakarta.annotation.Nullable List shapes) { + this.shapes = shapes; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Drawing instance itself + */ + public Drawing putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Drawing {\n"); + sb.append(" mainShape: ").append(toIndentedString(mainShape)).append("\n"); + sb.append(" shapeOrNull: ").append(toIndentedString(shapeOrNull)).append("\n"); + sb.append(" nullableShape: ").append(toIndentedString(nullableShape)).append("\n"); + sb.append(" shapes: ").append(toIndentedString(shapes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("mainShape", "shapeOrNull", "nullableShape", "shapes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumArrays.java new file mode 100644 index 000000000000..de69f9b63071 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -0,0 +1,261 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EnumArrays + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_JUST_SYMBOL = "just_symbol"; + @JsonbProperty(SERIALIZED_NAME_JUST_SYMBOL) + @jakarta.annotation.Nullable + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_ARRAY_ENUM = "array_enum"; + @JsonbProperty(SERIALIZED_NAME_ARRAY_ENUM) + @jakarta.annotation.Nullable + private List arrayEnum = new ArrayList<>(); + + public EnumArrays() { + } + + public EnumArrays justSymbol(@jakarta.annotation.Nullable JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + */ + @jakarta.annotation.Nullable + + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + public void setJustSymbol(@jakarta.annotation.Nullable JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + + public EnumArrays arrayEnum(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public List getArrayEnum() { + return arrayEnum; + } + + public void setArrayEnum(@jakarta.annotation.Nullable List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumArrays instance itself + */ + public EnumArrays putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("just_symbol", "array_enum")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumClass.java new file mode 100644 index 000000000000..45d95ab19c16 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumClass.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.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +import jakarta.json.bind.annotation.JsonbCreator; +import jakarta.json.bind.annotation.JsonbValue; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java new file mode 100644 index 000000000000..eb8cd95cb598 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java @@ -0,0 +1,189 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * An object to test discriminator of enum string + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class EnumStringDiscriminator { + /** + * enum string type + */ + public enum EnumStrTypeEnum { + A("type_a"), + + B("type_b"); + + private String value; + + EnumStrTypeEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + public static EnumStrTypeEnum fromValue(String value) { + for (EnumStrTypeEnum b : EnumStrTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + } + + public static final String SERIALIZED_NAME_ENUM_STR_TYPE = "enum_str_type"; + @JsonbProperty(SERIALIZED_NAME_ENUM_STR_TYPE) + @jakarta.annotation.Nonnull + protected EnumStrTypeEnum enumStrType; + + public EnumStringDiscriminator() { + + } + + public EnumStringDiscriminator enumStrType(@jakarta.annotation.Nonnull EnumStrTypeEnum enumStrType) { + this.enumStrType = enumStrType; + return this; + } + + /** + * enum string type + * @return enumStrType + */ + @jakarta.annotation.Nonnull + + public EnumStrTypeEnum getEnumStrType() { + return enumStrType; + } + + public void setEnumStrType(@jakarta.annotation.Nonnull EnumStrTypeEnum enumStrType) { + this.enumStrType = enumStrType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumStringDiscriminator instance itself + */ + public EnumStringDiscriminator putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumStringDiscriminator {\n"); + sb.append(" enumStrType: ").append(toIndentedString(enumStrType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("enum_str_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("enum_str_type")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumTest.java new file mode 100644 index 000000000000..07e49bfb31db --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumTest.java @@ -0,0 +1,565 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +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 org.openapitools.jackson.nullable.JsonNullable; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EnumTest + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class EnumTest { + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_ENUM_STRING = "enum_string"; + @JsonbProperty(SERIALIZED_NAME_ENUM_STRING) + @jakarta.annotation.Nullable + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_ENUM_STRING_REQUIRED = "enum_string_required"; + @JsonbProperty(SERIALIZED_NAME_ENUM_STRING_REQUIRED) + @jakarta.annotation.Nonnull + 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; + } + + @JsonbValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_ENUM_INTEGER = "enum_integer"; + @JsonbProperty(SERIALIZED_NAME_ENUM_INTEGER) + @jakarta.annotation.Nullable + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumIntegerOnly + */ + public enum EnumIntegerOnlyEnum { + NUMBER_2(2), + + NUMBER_MINUS_2(-2); + + private Integer value; + + EnumIntegerOnlyEnum(Integer value) { + this.value = value; + } + + @JsonbValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + public static EnumIntegerOnlyEnum fromValue(Integer value) { + for (EnumIntegerOnlyEnum b : EnumIntegerOnlyEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + } + + public static final String SERIALIZED_NAME_ENUM_INTEGER_ONLY = "enum_integer_only"; + @JsonbProperty(SERIALIZED_NAME_ENUM_INTEGER_ONLY) + @jakarta.annotation.Nullable + private EnumIntegerOnlyEnum enumIntegerOnly; + + /** + * 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; + } + + @JsonbValue + public Double getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_ENUM_NUMBER = "enum_number"; + @JsonbProperty(SERIALIZED_NAME_ENUM_NUMBER) + @jakarta.annotation.Nullable + private EnumNumberEnum enumNumber; + + public static final String SERIALIZED_NAME_OUTER_ENUM = "outerEnum"; + @JsonbProperty(SERIALIZED_NAME_OUTER_ENUM) + @jakarta.annotation.Nullable + private OuterEnum outerEnum; + + public static final String SERIALIZED_NAME_OUTER_ENUM_INTEGER = "outerEnumInteger"; + @Deprecated + @JsonbProperty(SERIALIZED_NAME_OUTER_ENUM_INTEGER) + @jakarta.annotation.Nullable + private OuterEnumInteger outerEnumInteger; + + public static final String SERIALIZED_NAME_OUTER_ENUM_DEFAULT_VALUE = "outerEnumDefaultValue"; + @JsonbProperty(SERIALIZED_NAME_OUTER_ENUM_DEFAULT_VALUE) + @jakarta.annotation.Nullable + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + + public static final String SERIALIZED_NAME_OUTER_ENUM_INTEGER_DEFAULT_VALUE = "outerEnumIntegerDefaultValue"; + @JsonbProperty(SERIALIZED_NAME_OUTER_ENUM_INTEGER_DEFAULT_VALUE) + @jakarta.annotation.Nullable + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + + public EnumTest() { + } + + public EnumTest enumString(@jakarta.annotation.Nullable EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + */ + @jakarta.annotation.Nullable + + public EnumStringEnum getEnumString() { + return enumString; + } + + public void setEnumString(@jakarta.annotation.Nullable EnumStringEnum enumString) { + this.enumString = enumString; + } + + + public EnumTest enumStringRequired(@jakarta.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + */ + @jakarta.annotation.Nonnull + + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(@jakarta.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + + public EnumTest enumInteger(@jakarta.annotation.Nullable EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + */ + @jakarta.annotation.Nullable + + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + public void setEnumInteger(@jakarta.annotation.Nullable EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + public EnumTest enumIntegerOnly(@jakarta.annotation.Nullable EnumIntegerOnlyEnum enumIntegerOnly) { + this.enumIntegerOnly = enumIntegerOnly; + return this; + } + + /** + * Get enumIntegerOnly + * @return enumIntegerOnly + */ + @jakarta.annotation.Nullable + + public EnumIntegerOnlyEnum getEnumIntegerOnly() { + return enumIntegerOnly; + } + + public void setEnumIntegerOnly(@jakarta.annotation.Nullable EnumIntegerOnlyEnum enumIntegerOnly) { + this.enumIntegerOnly = enumIntegerOnly; + } + + + public EnumTest enumNumber(@jakarta.annotation.Nullable EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + */ + @jakarta.annotation.Nullable + + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + public void setEnumNumber(@jakarta.annotation.Nullable EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + public EnumTest outerEnum(@jakarta.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + */ + @jakarta.annotation.Nullable + + public OuterEnum getOuterEnum() { + return outerEnum; + } + + public void setOuterEnum(@jakarta.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + + @Deprecated + public EnumTest outerEnumInteger(@jakarta.annotation.Nullable OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return this; + } + + /** + * Get outerEnumInteger + * @return outerEnumInteger + * @deprecated + */ + @Deprecated + @jakarta.annotation.Nullable + + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + @Deprecated + public void setOuterEnumInteger(@jakarta.annotation.Nullable OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + + public EnumTest outerEnumDefaultValue(@jakarta.annotation.Nullable OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + /** + * Get outerEnumDefaultValue + * @return outerEnumDefaultValue + */ + @jakarta.annotation.Nullable + + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + public void setOuterEnumDefaultValue(@jakarta.annotation.Nullable OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + + public EnumTest outerEnumIntegerDefaultValue(@jakarta.annotation.Nullable OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + /** + * Get outerEnumIntegerDefaultValue + * @return outerEnumIntegerDefaultValue + */ + @jakarta.annotation.Nullable + + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + public void setOuterEnumIntegerDefaultValue(@jakarta.annotation.Nullable OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumTest instance itself + */ + public EnumTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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(" enumIntegerOnly: ").append(toIndentedString(enumIntegerOnly)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); + sb.append(" outerEnumDefaultValue: ").append(toIndentedString(outerEnumDefaultValue)).append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ").append(toIndentedString(outerEnumIntegerDefaultValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("enum_string", "enum_string_required", "enum_integer", "enum_integer_only", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("enum_string_required")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EquilateralTriangle.java new file mode 100644 index 000000000000..53912da31e65 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EquilateralTriangle.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EquilateralTriangle + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class EquilateralTriangle { + public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; + @JsonbProperty(SERIALIZED_NAME_SHAPE_TYPE) + @jakarta.annotation.Nonnull + private String shapeType; + + public static final String SERIALIZED_NAME_TRIANGLE_TYPE = "triangleType"; + @JsonbProperty(SERIALIZED_NAME_TRIANGLE_TYPE) + @jakarta.annotation.Nonnull + private String triangleType; + + public EquilateralTriangle() { + } + + public EquilateralTriangle shapeType(@jakarta.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @jakarta.annotation.Nonnull + + public String getShapeType() { + return shapeType; + } + + public void setShapeType(@jakarta.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public EquilateralTriangle triangleType(@jakarta.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @jakarta.annotation.Nonnull + + public String getTriangleType() { + return triangleType; + } + + public void setTriangleType(@jakarta.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EquilateralTriangle instance itself + */ + public EquilateralTriangle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java new file mode 100644 index 000000000000..254922c87997 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java @@ -0,0 +1,129 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FakeAnyOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FakeAnyOfWIthSameErasureGet200Response.class.getName()); + + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public FakeAnyOfWIthSameErasureGet200Response() { + super("anyOf", Boolean.FALSE); + } + + public FakeAnyOfWIthSameErasureGet200Response(List o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public FakeAnyOfWIthSameErasureGet200Response(List o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List", List.class); + schemas.put("List", List.class); + } + + @Override + public Map> getSchemas() { + return FakeAnyOfWIthSameErasureGet200Response.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * List, List + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List, List"); + } + + /** + * Get the actual instance, which can be the following: + * List, List + * + * @return The actual instance (List, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java new file mode 100644 index 000000000000..17924e97f033 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java @@ -0,0 +1,129 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FakeOneOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FakeOneOfWIthSameErasureGet200Response.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public FakeOneOfWIthSameErasureGet200Response() { + super("oneOf", Boolean.FALSE); + } + + public FakeOneOfWIthSameErasureGet200Response(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public FakeOneOfWIthSameErasureGet200Response(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List", List.class); + schemas.put("List", List.class); + } + + @Override + public Map> getSchemas() { + return FakeOneOfWIthSameErasureGet200Response.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * List, List + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List, List"); + } + + /** + * Get the actual instance, which can be the following: + * List, List + * + * @return The actual instance (List, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java new file mode 100644 index 000000000000..a853b333b387 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java @@ -0,0 +1,128 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FakeRefParameterPetIdParameter extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FakeRefParameterPetIdParameter.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public FakeRefParameterPetIdParameter() { + super("oneOf", Boolean.FALSE); + } + + public FakeRefParameterPetIdParameter(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public FakeRefParameterPetIdParameter(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return FakeRefParameterPetIdParameter.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Integer, String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, String"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, String + * + * @return The actual instance (Integer, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..bcebae670b3b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,190 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FileSchemaTestClass + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FileSchemaTestClass { + public static final String SERIALIZED_NAME_FILE = "file"; + @JsonbProperty(SERIALIZED_NAME_FILE) + @jakarta.annotation.Nullable + private ModelFile _file; + + public static final String SERIALIZED_NAME_FILES = "files"; + @JsonbProperty(SERIALIZED_NAME_FILES) + @jakarta.annotation.Nullable + private List files = new ArrayList<>(); + + public FileSchemaTestClass() { + } + + public FileSchemaTestClass _file(@jakarta.annotation.Nullable ModelFile _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + @jakarta.annotation.Nullable + + public ModelFile getFile() { + return _file; + } + + public void setFile(@jakarta.annotation.Nullable ModelFile _file) { + this._file = _file; + } + + + public FileSchemaTestClass files(@jakarta.annotation.Nullable List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(ModelFile filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + */ + @jakarta.annotation.Nullable + + public List getFiles() { + return files; + } + + public void setFiles(@jakarta.annotation.Nullable List files) { + this.files = files; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FileSchemaTestClass instance itself + */ + public FileSchemaTestClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("file", "files")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Foo.java new file mode 100644 index 000000000000..9f3d0e837080 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Foo.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Foo + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Foo { + public static final String SERIALIZED_NAME_BAR = "bar"; + @JsonbProperty(SERIALIZED_NAME_BAR) + @jakarta.annotation.Nullable + private String bar = "bar"; + + public Foo() { + } + + public Foo bar(@jakarta.annotation.Nullable String bar) { + this.bar = bar; + return this; + } + + /** + * Get bar + * @return bar + */ + @jakarta.annotation.Nullable + + public String getBar() { + return bar; + } + + public void setBar(@jakarta.annotation.Nullable String bar) { + this.bar = bar; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Foo instance itself + */ + public Foo putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Foo {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java new file mode 100644 index 000000000000..10cb8983e320 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -0,0 +1,153 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.Foo; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FooGetDefaultResponse + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FooGetDefaultResponse { + public static final String SERIALIZED_NAME_STRING = "string"; + @JsonbProperty(SERIALIZED_NAME_STRING) + @jakarta.annotation.Nullable + private Foo string; + + public FooGetDefaultResponse() { + } + + public FooGetDefaultResponse string(@jakarta.annotation.Nullable Foo string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + */ + @jakarta.annotation.Nullable + + public Foo getString() { + return string; + } + + public void setString(@jakarta.annotation.Nullable Foo string) { + this.string = string; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FooGetDefaultResponse instance itself + */ + public FooGetDefaultResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("string")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FormatTest.java new file mode 100644 index 000000000000..3349ba34916a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FormatTest.java @@ -0,0 +1,583 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FormatTest + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FormatTest { + public static final String SERIALIZED_NAME_INTEGER = "integer"; + @JsonbProperty(SERIALIZED_NAME_INTEGER) + @jakarta.annotation.Nullable + private Integer integer; + + public static final String SERIALIZED_NAME_INT32 = "int32"; + @JsonbProperty(SERIALIZED_NAME_INT32) + @jakarta.annotation.Nullable + private Integer int32; + + public static final String SERIALIZED_NAME_INT64 = "int64"; + @JsonbProperty(SERIALIZED_NAME_INT64) + @jakarta.annotation.Nullable + private Long int64; + + public static final String SERIALIZED_NAME_NUMBER = "number"; + @JsonbProperty(SERIALIZED_NAME_NUMBER) + @jakarta.annotation.Nonnull + private BigDecimal number; + + public static final String SERIALIZED_NAME_FLOAT = "float"; + @JsonbProperty(SERIALIZED_NAME_FLOAT) + @jakarta.annotation.Nullable + private Float _float; + + public static final String SERIALIZED_NAME_DOUBLE = "double"; + @JsonbProperty(SERIALIZED_NAME_DOUBLE) + @jakarta.annotation.Nullable + private Double _double; + + public static final String SERIALIZED_NAME_DECIMAL = "decimal"; + @JsonbProperty(SERIALIZED_NAME_DECIMAL) + @jakarta.annotation.Nullable + private BigDecimal decimal; + + public static final String SERIALIZED_NAME_STRING = "string"; + @JsonbProperty(SERIALIZED_NAME_STRING) + @jakarta.annotation.Nullable + private String string; + + public static final String SERIALIZED_NAME_BYTE = "byte"; + @JsonbProperty(SERIALIZED_NAME_BYTE) + @jakarta.annotation.Nonnull + private byte[] _byte; + + public static final String SERIALIZED_NAME_BINARY = "binary"; + @JsonbProperty(SERIALIZED_NAME_BINARY) + @jakarta.annotation.Nullable + private File binary; + + public static final String SERIALIZED_NAME_DATE = "date"; + @JsonbProperty(SERIALIZED_NAME_DATE) + @jakarta.annotation.Nonnull + private LocalDate date; + + public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; + @JsonbProperty(SERIALIZED_NAME_DATE_TIME) + @jakarta.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String SERIALIZED_NAME_UUID = "uuid"; + @JsonbProperty(SERIALIZED_NAME_UUID) + @jakarta.annotation.Nullable + private UUID uuid; + + public static final String SERIALIZED_NAME_UUID_WITH_DEFAULT = "uuid_with_default"; + @JsonbProperty(SERIALIZED_NAME_UUID_WITH_DEFAULT) + @jakarta.annotation.Nullable + private UUID uuidWithDefault = UUID.fromString("11111111-206d-4f12-9f12-3d1e525a8e84"); + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @JsonbProperty(SERIALIZED_NAME_PASSWORD) + @jakarta.annotation.Nonnull + private String password; + + public static final String SERIALIZED_NAME_PATTERN_WITH_DIGITS = "pattern_with_digits"; + @JsonbProperty(SERIALIZED_NAME_PATTERN_WITH_DIGITS) + @jakarta.annotation.Nullable + private String patternWithDigits; + + public static final String SERIALIZED_NAME_PATTERN_WITH_DIGITS_AND_DELIMITER = "pattern_with_digits_and_delimiter"; + @JsonbProperty(SERIALIZED_NAME_PATTERN_WITH_DIGITS_AND_DELIMITER) + @jakarta.annotation.Nullable + private String patternWithDigitsAndDelimiter; + + public FormatTest() { + } + + public FormatTest integer(@jakarta.annotation.Nullable Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + */ + @jakarta.annotation.Nullable + + public Integer getInteger() { + return integer; + } + + public void setInteger(@jakarta.annotation.Nullable Integer integer) { + this.integer = integer; + } + + + public FormatTest int32(@jakarta.annotation.Nullable Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + */ + @jakarta.annotation.Nullable + + public Integer getInt32() { + return int32; + } + + public void setInt32(@jakarta.annotation.Nullable Integer int32) { + this.int32 = int32; + } + + + public FormatTest int64(@jakarta.annotation.Nullable Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + */ + @jakarta.annotation.Nullable + + public Long getInt64() { + return int64; + } + + public void setInt64(@jakarta.annotation.Nullable Long int64) { + this.int64 = int64; + } + + + public FormatTest number(@jakarta.annotation.Nonnull BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + */ + @jakarta.annotation.Nonnull + + public BigDecimal getNumber() { + return number; + } + + public void setNumber(@jakarta.annotation.Nonnull BigDecimal number) { + this.number = number; + } + + + public FormatTest _float(@jakarta.annotation.Nullable Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + */ + @jakarta.annotation.Nullable + + public Float getFloat() { + return _float; + } + + public void setFloat(@jakarta.annotation.Nullable Float _float) { + this._float = _float; + } + + + public FormatTest _double(@jakarta.annotation.Nullable Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + */ + @jakarta.annotation.Nullable + + public Double getDouble() { + return _double; + } + + public void setDouble(@jakarta.annotation.Nullable Double _double) { + this._double = _double; + } + + + public FormatTest decimal(@jakarta.annotation.Nullable BigDecimal decimal) { + this.decimal = decimal; + return this; + } + + /** + * Get decimal + * @return decimal + */ + @jakarta.annotation.Nullable + + public BigDecimal getDecimal() { + return decimal; + } + + public void setDecimal(@jakarta.annotation.Nullable BigDecimal decimal) { + this.decimal = decimal; + } + + + public FormatTest string(@jakarta.annotation.Nullable String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + */ + @jakarta.annotation.Nullable + + public String getString() { + return string; + } + + public void setString(@jakarta.annotation.Nullable String string) { + this.string = string; + } + + + public FormatTest _byte(@jakarta.annotation.Nonnull byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + */ + @jakarta.annotation.Nonnull + + public byte[] getByte() { + return _byte; + } + + public void setByte(@jakarta.annotation.Nonnull byte[] _byte) { + this._byte = _byte; + } + + + public FormatTest binary(@jakarta.annotation.Nullable File binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + */ + @jakarta.annotation.Nullable + + public File getBinary() { + return binary; + } + + public void setBinary(@jakarta.annotation.Nullable File binary) { + this.binary = binary; + } + + + public FormatTest date(@jakarta.annotation.Nonnull LocalDate date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + */ + @jakarta.annotation.Nonnull + + public LocalDate getDate() { + return date; + } + + public void setDate(@jakarta.annotation.Nonnull LocalDate date) { + this.date = date; + } + + + public FormatTest dateTime(@jakarta.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @jakarta.annotation.Nullable + + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(@jakarta.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public FormatTest uuid(@jakarta.annotation.Nullable UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @jakarta.annotation.Nullable + + public UUID getUuid() { + return uuid; + } + + public void setUuid(@jakarta.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + + public FormatTest uuidWithDefault(@jakarta.annotation.Nullable UUID uuidWithDefault) { + this.uuidWithDefault = uuidWithDefault; + return this; + } + + /** + * Get uuidWithDefault + * @return uuidWithDefault + */ + @jakarta.annotation.Nullable + + public UUID getUuidWithDefault() { + return uuidWithDefault; + } + + public void setUuidWithDefault(@jakarta.annotation.Nullable UUID uuidWithDefault) { + this.uuidWithDefault = uuidWithDefault; + } + + + public FormatTest password(@jakarta.annotation.Nonnull String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @jakarta.annotation.Nonnull + + public String getPassword() { + return password; + } + + public void setPassword(@jakarta.annotation.Nonnull String password) { + this.password = password; + } + + + public FormatTest patternWithDigits(@jakarta.annotation.Nullable String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + return this; + } + + /** + * A string that is a 10 digit number. Can have leading zeros. + * @return patternWithDigits + */ + @jakarta.annotation.Nullable + + public String getPatternWithDigits() { + return patternWithDigits; + } + + public void setPatternWithDigits(@jakarta.annotation.Nullable String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + } + + + public FormatTest patternWithDigitsAndDelimiter(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; + } + + public void setPatternWithDigitsAndDelimiter(@jakarta.annotation.Nullable String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FormatTest instance itself + */ + public FormatTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" decimal: ").append(toIndentedString(decimal)).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(" uuidWithDefault: ").append(toIndentedString(uuidWithDefault)).append("\n"); + sb.append(" password: ").append("*").append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer", "int32", "int64", "number", "float", "double", "decimal", "string", "byte", "binary", "date", "dateTime", "uuid", "uuid_with_default", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("number", "byte", "date", "password")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java new file mode 100644 index 000000000000..20a9aa9a51eb --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java @@ -0,0 +1,179 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.FreeFormObjectTestClassProperties; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FreeFormObjectTestClass + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FreeFormObjectTestClass { + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @JsonbProperty(SERIALIZED_NAME_PROPERTIES) + @jakarta.annotation.Nullable + private FreeFormObjectTestClassProperties properties; + + public FreeFormObjectTestClass() { + } + + public FreeFormObjectTestClass name(@jakarta.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nullable String name) { + this.name = name; + } + + + public FreeFormObjectTestClass properties(@jakarta.annotation.Nullable FreeFormObjectTestClassProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get properties + * @return properties + */ + @jakarta.annotation.Nullable + + public FreeFormObjectTestClassProperties getProperties() { + return properties; + } + + public void setProperties(@jakarta.annotation.Nullable FreeFormObjectTestClassProperties properties) { + this.properties = properties; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FreeFormObjectTestClass instance itself + */ + public FreeFormObjectTestClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FreeFormObjectTestClass {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "properties")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java new file mode 100644 index 000000000000..25ae55b9bc45 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java @@ -0,0 +1,129 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.Map; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FreeFormObjectTestClassProperties extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FreeFormObjectTestClassProperties.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public FreeFormObjectTestClassProperties() { + super("oneOf", Boolean.FALSE); + } + + public FreeFormObjectTestClassProperties(Map o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public FreeFormObjectTestClassProperties(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Map", Map.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return FreeFormObjectTestClassProperties.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Map, String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Map.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Map, String"); + } + + /** + * Get the actual instance, which can be the following: + * Map, String + * + * @return The actual instance (Map, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Map`. If the actual instance is not `Map`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Map` + * @throws ClassCastException if the instance is not `Map` + */ + public Map getMap() throws ClassCastException { + return (Map)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Fruit.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Fruit.java new file mode 100644 index 000000000000..15d4f4e0991e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Fruit.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Fruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Fruit.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final 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", Apple.class); + schemas.put("Banana", Banana.class); + } + + @Override + public Map> getSchemas() { + return Fruit.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Apple, Banana + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Apple.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Banana.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } + + /** + * Get the actual instance, which can be the following: + * Apple, Banana + * + * @return The actual instance (Apple, Banana) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Apple`. If the actual instance is not `Apple`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Apple` + * @throws ClassCastException if the instance is not `Apple` + */ + public Apple getApple() throws ClassCastException { + return (Apple)super.getActualInstance(); + } + + /** + * Get the actual instance of `Banana`. If the actual instance is not `Banana`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Banana` + * @throws ClassCastException if the instance is not `Banana` + */ + public Banana getBanana() throws ClassCastException { + return (Banana)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FruitReq.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FruitReq.java new file mode 100644 index 000000000000..0248f08bbff7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FruitReq.java @@ -0,0 +1,136 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FruitReq extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FruitReq.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final 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", AppleReq.class); + schemas.put("BananaReq", BananaReq.class); + } + + @Override + public Map> getSchemas() { + return FruitReq.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * AppleReq, BananaReq + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(AppleReq.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(BananaReq.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be AppleReq, BananaReq"); + } + + /** + * Get the actual instance, which can be the following: + * AppleReq, BananaReq + * + * @return The actual instance (AppleReq, BananaReq) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AppleReq`. If the actual instance is not `AppleReq`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `AppleReq` + * @throws ClassCastException if the instance is not `AppleReq` + */ + public AppleReq getAppleReq() throws ClassCastException { + return (AppleReq)super.getActualInstance(); + } + + /** + * Get the actual instance of `BananaReq`. If the actual instance is not `BananaReq`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BananaReq` + * @throws ClassCastException if the instance is not `BananaReq` + */ + public BananaReq getBananaReq() throws ClassCastException { + return (BananaReq)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GmFruit.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GmFruit.java new file mode 100644 index 000000000000..e08eaf7e907f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GmFruit.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class GmFruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GmFruit.class.getName()); + + + + // store a list of schema names defined in anyOf + public static final 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", Apple.class); + schemas.put("Banana", Banana.class); + } + + @Override + public Map> getSchemas() { + return GmFruit.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Apple, Banana + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Apple.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Banana.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } + + /** + * Get the actual instance, which can be the following: + * Apple, Banana + * + * @return The actual instance (Apple, Banana) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Apple`. If the actual instance is not `Apple`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Apple` + * @throws ClassCastException if the instance is not `Apple` + */ + public Apple getApple() throws ClassCastException { + return (Apple)super.getActualInstance(); + } + + /** + * Get the actual instance of `Banana`. If the actual instance is not `Banana`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Banana` + * @throws ClassCastException if the instance is not `Banana` + */ + public Banana getBanana() throws ClassCastException { + return (Banana)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GrandparentAnimal.java new file mode 100644 index 000000000000..efeb132c73d8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -0,0 +1,153 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * GrandparentAnimal + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class GrandparentAnimal { + public static final String SERIALIZED_NAME_PET_TYPE = "pet_type"; + @JsonbProperty(SERIALIZED_NAME_PET_TYPE) + @jakarta.annotation.Nonnull + protected String petType; + + public GrandparentAnimal() { + this.petType = this.getClass().getSimpleName(); + } + + public GrandparentAnimal petType(@jakarta.annotation.Nonnull String petType) { + this.petType = petType; + return this; + } + + /** + * Get petType + * @return petType + */ + @jakarta.annotation.Nonnull + + public String getPetType() { + return petType; + } + + public void setPetType(@jakarta.annotation.Nonnull String petType) { + this.petType = petType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the GrandparentAnimal instance itself + */ + public GrandparentAnimal putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GrandparentAnimal {\n"); + sb.append(" petType: ").append(toIndentedString(petType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("pet_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("pet_type")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..79159dd8c199 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -0,0 +1,171 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * HasOnlyReadOnly + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class HasOnlyReadOnly { + public static final String SERIALIZED_NAME_BAR = "bar"; + @JsonbProperty(SERIALIZED_NAME_BAR) + @jakarta.annotation.Nullable + private String bar; + + public static final String SERIALIZED_NAME_FOO = "foo"; + @JsonbProperty(SERIALIZED_NAME_FOO) + @jakarta.annotation.Nullable + private String foo; + + public HasOnlyReadOnly() { + } + + public HasOnlyReadOnly( + String bar, + String foo + ) { + this(); + this.bar = bar; + this.foo = foo; + } + + /** + * Get bar + * @return bar + */ + @jakarta.annotation.Nullable + + public String getBar() { + return bar; + } + + + + /** + * Get foo + * @return foo + */ + @jakarta.annotation.Nullable + + public String getFoo() { + return foo; + } + + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the HasOnlyReadOnly instance itself + */ + public HasOnlyReadOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar", "foo")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HealthCheckResult.java new file mode 100644 index 000000000000..e58501f7b0ca --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HealthCheckResult.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class HealthCheckResult { + public static final String SERIALIZED_NAME_NULLABLE_MESSAGE = "NullableMessage"; + @JsonbProperty(SERIALIZED_NAME_NULLABLE_MESSAGE) + @jakarta.annotation.Nullable + private String nullableMessage; + + public HealthCheckResult() { + } + + public HealthCheckResult nullableMessage(@jakarta.annotation.Nullable String nullableMessage) { + this.nullableMessage = nullableMessage; + return this; + } + + /** + * Get nullableMessage + * @return nullableMessage + */ + @jakarta.annotation.Nullable + + public String getNullableMessage() { + return nullableMessage; + } + + public void setNullableMessage(@jakarta.annotation.Nullable String nullableMessage) { + this.nullableMessage = nullableMessage; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the HealthCheckResult instance itself + */ + public HealthCheckResult putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("NullableMessage")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java new file mode 100644 index 000000000000..e3f484ae64b0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/IsoscelesTriangle.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IsoscelesTriangle + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class IsoscelesTriangle { + public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; + @JsonbProperty(SERIALIZED_NAME_SHAPE_TYPE) + @jakarta.annotation.Nonnull + private String shapeType; + + public static final String SERIALIZED_NAME_TRIANGLE_TYPE = "triangleType"; + @JsonbProperty(SERIALIZED_NAME_TRIANGLE_TYPE) + @jakarta.annotation.Nonnull + private String triangleType; + + public IsoscelesTriangle() { + } + + public IsoscelesTriangle shapeType(@jakarta.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @jakarta.annotation.Nonnull + + public String getShapeType() { + return shapeType; + } + + public void setShapeType(@jakarta.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public IsoscelesTriangle triangleType(@jakarta.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @jakarta.annotation.Nonnull + + public String getTriangleType() { + return triangleType; + } + + public void setTriangleType(@jakarta.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IsoscelesTriangle instance itself + */ + public IsoscelesTriangle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Mammal.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Mammal.java new file mode 100644 index 000000000000..35e754488152 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Mammal.java @@ -0,0 +1,153 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Mammal extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Mammal.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final 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", Pig.class); + schemas.put("Whale", Whale.class); + schemas.put("Zebra", Zebra.class); + } + + @Override + public Map> getSchemas() { + return Mammal.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Pig, Whale, Zebra + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Pig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Whale.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Zebra.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Pig, Whale, Zebra"); + } + + /** + * Get the actual instance, which can be the following: + * Pig, Whale, Zebra + * + * @return The actual instance (Pig, Whale, Zebra) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Pig`. If the actual instance is not `Pig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Pig` + * @throws ClassCastException if the instance is not `Pig` + */ + public Pig getPig() throws ClassCastException { + return (Pig)super.getActualInstance(); + } + + /** + * Get the actual instance of `Whale`. If the actual instance is not `Whale`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Whale` + * @throws ClassCastException if the instance is not `Whale` + */ + public Whale getWhale() throws ClassCastException { + return (Whale)super.getActualInstance(); + } + + /** + * Get the actual instance of `Zebra`. If the actual instance is not `Zebra`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Zebra` + * @throws ClassCastException if the instance is not `Zebra` + */ + public Zebra getZebra() throws ClassCastException { + return (Zebra)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MammalAnyof.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MammalAnyof.java new file mode 100644 index 000000000000..9bc9e18491a2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MammalAnyof.java @@ -0,0 +1,153 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class MammalAnyof extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(MammalAnyof.class.getName()); + + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public MammalAnyof() { + super("anyOf", Boolean.FALSE); + } + + public MammalAnyof(Pig o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public MammalAnyof(Whale o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public MammalAnyof(Zebra o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Pig", Pig.class); + schemas.put("Whale", Whale.class); + schemas.put("Zebra", Zebra.class); + } + + @Override + public Map> getSchemas() { + return MammalAnyof.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Pig, Whale, Zebra + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Pig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Whale.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Zebra.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Pig, Whale, Zebra"); + } + + /** + * Get the actual instance, which can be the following: + * Pig, Whale, Zebra + * + * @return The actual instance (Pig, Whale, Zebra) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Pig`. If the actual instance is not `Pig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Pig` + * @throws ClassCastException if the instance is not `Pig` + */ + public Pig getPig() throws ClassCastException { + return (Pig)super.getActualInstance(); + } + + /** + * Get the actual instance of `Whale`. If the actual instance is not `Whale`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Whale` + * @throws ClassCastException if the instance is not `Whale` + */ + public Whale getWhale() throws ClassCastException { + return (Whale)super.getActualInstance(); + } + + /** + * Get the actual instance of `Zebra`. If the actual instance is not `Zebra`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Zebra` + * @throws ClassCastException if the instance is not `Zebra` + */ + public Zebra getZebra() throws ClassCastException { + return (Zebra)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MapTest.java new file mode 100644 index 000000000000..5b7a3f568519 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,300 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.HashMap; +import java.util.Map; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * MapTest + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class MapTest { + public static final String SERIALIZED_NAME_MAP_MAP_OF_STRING = "map_map_of_string"; + @JsonbProperty(SERIALIZED_NAME_MAP_MAP_OF_STRING) + @jakarta.annotation.Nullable + private Map> mapMapOfString = new HashMap<>(); + + /** + * Gets or Sets inner + */ + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_MAP_OF_ENUM_STRING = "map_of_enum_string"; + @JsonbProperty(SERIALIZED_NAME_MAP_OF_ENUM_STRING) + @jakarta.annotation.Nullable + private Map mapOfEnumString = new HashMap<>(); + + public static final String SERIALIZED_NAME_DIRECT_MAP = "direct_map"; + @JsonbProperty(SERIALIZED_NAME_DIRECT_MAP) + @jakarta.annotation.Nullable + private Map directMap = new HashMap<>(); + + public static final String SERIALIZED_NAME_INDIRECT_MAP = "indirect_map"; + @JsonbProperty(SERIALIZED_NAME_INDIRECT_MAP) + @jakarta.annotation.Nullable + private Map indirectMap = new HashMap<>(); + + public MapTest() { + } + + public MapTest mapMapOfString(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public Map> getMapMapOfString() { + return mapMapOfString; + } + + public void setMapMapOfString(@jakarta.annotation.Nullable Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + + public MapTest mapOfEnumString(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + public void setMapOfEnumString(@jakarta.annotation.Nullable Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + + public MapTest directMap(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public Map getDirectMap() { + return directMap; + } + + public void setDirectMap(@jakarta.annotation.Nullable Map directMap) { + this.directMap = directMap; + } + + + public MapTest indirectMap(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public Map getIndirectMap() { + return indirectMap; + } + + public void setIndirectMap(@jakarta.annotation.Nullable Map indirectMap) { + this.indirectMap = indirectMap; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MapTest instance itself + */ + public MapTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..916f8228bb42 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,217 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class MixedPropertiesAndAdditionalPropertiesClass { + public static final String SERIALIZED_NAME_UUID = "uuid"; + @JsonbProperty(SERIALIZED_NAME_UUID) + @jakarta.annotation.Nullable + private UUID uuid; + + public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; + @JsonbProperty(SERIALIZED_NAME_DATE_TIME) + @jakarta.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String SERIALIZED_NAME_MAP = "map"; + @JsonbProperty(SERIALIZED_NAME_MAP) + @jakarta.annotation.Nullable + private Map map = new HashMap<>(); + + public MixedPropertiesAndAdditionalPropertiesClass() { + } + + public MixedPropertiesAndAdditionalPropertiesClass uuid(@jakarta.annotation.Nullable UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @jakarta.annotation.Nullable + + public UUID getUuid() { + return uuid; + } + + public void setUuid(@jakarta.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(@jakarta.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @jakarta.annotation.Nullable + + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(@jakarta.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public MixedPropertiesAndAdditionalPropertiesClass map(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public Map getMap() { + return map; + } + + public void setMap(@jakarta.annotation.Nullable Map map) { + this.map = map; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MixedPropertiesAndAdditionalPropertiesClass instance itself + */ + public MixedPropertiesAndAdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("uuid", "dateTime", "map")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Model200Response.java new file mode 100644 index 000000000000..708283508f22 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Model200Response.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model name starting with number + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Model200Response { + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private Integer name; + + public static final String SERIALIZED_NAME_PROPERTY_CLASS = "class"; + @JsonbProperty(SERIALIZED_NAME_PROPERTY_CLASS) + @jakarta.annotation.Nullable + private String propertyClass; + + public Model200Response() { + } + + public Model200Response name(@jakarta.annotation.Nullable Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nullable + + public Integer getName() { + return name; + } + + public void setName(@jakarta.annotation.Nullable Integer name) { + this.name = name; + } + + + public Model200Response propertyClass(@jakarta.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @jakarta.annotation.Nullable + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(@jakarta.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Model200Response instance itself + */ + public Model200Response putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "class")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..b13c075fb0a1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,204 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelApiResponse + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelApiResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + @JsonbProperty(SERIALIZED_NAME_CODE) + @jakarta.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @JsonbProperty(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @JsonbProperty(SERIALIZED_NAME_MESSAGE) + @jakarta.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@jakarta.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @jakarta.annotation.Nullable + + public Integer getCode() { + return code; + } + + public void setCode(@jakarta.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @jakarta.annotation.Nullable + + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@jakarta.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @jakarta.annotation.Nullable + + public String getMessage() { + return message; + } + + public void setMessage(@jakarta.annotation.Nullable String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("code", "type", "message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelFile.java new file mode 100644 index 000000000000..3954a46adcb2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelFile.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Must be named `File` for test. + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelFile { + public static final String SERIALIZED_NAME_SOURCE_U_R_I = "sourceURI"; + @JsonbProperty(SERIALIZED_NAME_SOURCE_U_R_I) + @jakarta.annotation.Nullable + private String sourceURI; + + public ModelFile() { + } + + public ModelFile sourceURI(@jakarta.annotation.Nullable String sourceURI) { + this.sourceURI = sourceURI; + return this; + } + + /** + * Test capitalization + * @return sourceURI + */ + @jakarta.annotation.Nullable + + public String getSourceURI() { + return sourceURI; + } + + public void setSourceURI(@jakarta.annotation.Nullable String sourceURI) { + this.sourceURI = sourceURI; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelFile instance itself + */ + public ModelFile putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelFile {\n"); + sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("sourceURI")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelList.java new file mode 100644 index 000000000000..109909b69108 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelList.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelList + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelList { + public static final String SERIALIZED_NAME_123LIST = "123-list"; + @JsonbProperty(SERIALIZED_NAME_123LIST) + @jakarta.annotation.Nullable + private String _123list; + + public ModelList() { + } + + public ModelList _123list(@jakarta.annotation.Nullable String _123list) { + this._123list = _123list; + return this; + } + + /** + * Get _123list + * @return _123list + */ + @jakarta.annotation.Nullable + + public String get123list() { + return _123list; + } + + public void set123list(@jakarta.annotation.Nullable String _123list) { + this._123list = _123list; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelList instance itself + */ + public ModelList putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelList {\n"); + sb.append(" _123list: ").append(toIndentedString(_123list)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("123-list")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelReturn.java new file mode 100644 index 000000000000..03b374333add --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing reserved words + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelReturn { + public static final String SERIALIZED_NAME_RETURN = "return"; + @JsonbProperty(SERIALIZED_NAME_RETURN) + @jakarta.annotation.Nullable + private Integer _return; + + public ModelReturn() { + } + + public ModelReturn _return(@jakarta.annotation.Nullable Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + */ + @jakarta.annotation.Nullable + + public Integer getReturn() { + return _return; + } + + public void setReturn(@jakarta.annotation.Nullable Integer _return) { + this._return = _return; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelReturn instance itself + */ + public ModelReturn putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("return")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java new file mode 100644 index 000000000000..276c8bed82fa --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java @@ -0,0 +1,180 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.ArrayAnyOf; +import org.openapitools.client.model.ArrayOneOf; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelWithOneOfAnyOfProperties + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelWithOneOfAnyOfProperties { + public static final String SERIALIZED_NAME_ONEOF_PROP = "oneof_prop"; + @JsonbProperty(SERIALIZED_NAME_ONEOF_PROP) + @jakarta.annotation.Nullable + private ArrayOneOf oneofProp; + + public static final String SERIALIZED_NAME_ANYOF_PROP = "anyof_prop"; + @JsonbProperty(SERIALIZED_NAME_ANYOF_PROP) + @jakarta.annotation.Nullable + private ArrayAnyOf anyofProp; + + public ModelWithOneOfAnyOfProperties() { + } + + public ModelWithOneOfAnyOfProperties oneofProp(@jakarta.annotation.Nullable ArrayOneOf oneofProp) { + this.oneofProp = oneofProp; + return this; + } + + /** + * Get oneofProp + * @return oneofProp + */ + @jakarta.annotation.Nullable + + public ArrayOneOf getOneofProp() { + return oneofProp; + } + + public void setOneofProp(@jakarta.annotation.Nullable ArrayOneOf oneofProp) { + this.oneofProp = oneofProp; + } + + + public ModelWithOneOfAnyOfProperties anyofProp(@jakarta.annotation.Nullable ArrayAnyOf anyofProp) { + this.anyofProp = anyofProp; + return this; + } + + /** + * Get anyofProp + * @return anyofProp + */ + @jakarta.annotation.Nullable + + public ArrayAnyOf getAnyofProp() { + return anyofProp; + } + + public void setAnyofProp(@jakarta.annotation.Nullable ArrayAnyOf anyofProp) { + this.anyofProp = anyofProp; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelWithOneOfAnyOfProperties instance itself + */ + public ModelWithOneOfAnyOfProperties putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelWithOneOfAnyOfProperties {\n"); + sb.append(" oneofProp: ").append(toIndentedString(oneofProp)).append("\n"); + sb.append(" anyofProp: ").append(toIndentedString(anyofProp)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("oneof_prop", "anyof_prop")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Name.java new file mode 100644 index 000000000000..8924f0a9605e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Name.java @@ -0,0 +1,223 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model name same as property name + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Name { + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private Integer name; + + public static final String SERIALIZED_NAME_SNAKE_CASE = "snake_case"; + @JsonbProperty(SERIALIZED_NAME_SNAKE_CASE) + @jakarta.annotation.Nullable + private Integer snakeCase; + + public static final String SERIALIZED_NAME_PROPERTY = "property"; + @JsonbProperty(SERIALIZED_NAME_PROPERTY) + @jakarta.annotation.Nullable + private String property; + + public static final String SERIALIZED_NAME_123NUMBER = "123Number"; + @JsonbProperty(SERIALIZED_NAME_123NUMBER) + @jakarta.annotation.Nullable + private Integer _123number; + + public Name() { + } + + public Name( + Integer snakeCase, + Integer _123number + ) { + this(); + this.snakeCase = snakeCase; + this._123number = _123number; + } + + public Name name(@jakarta.annotation.Nonnull Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nonnull + + public Integer getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull Integer name) { + this.name = name; + } + + + /** + * Get snakeCase + * @return snakeCase + */ + @jakarta.annotation.Nullable + + public Integer getSnakeCase() { + return snakeCase; + } + + + + public Name property(@jakarta.annotation.Nullable String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + */ + @jakarta.annotation.Nullable + + public String getProperty() { + return property; + } + + public void setProperty(@jakarta.annotation.Nullable String property) { + this.property = property; + } + + + /** + * Get _123number + * @return _123number + */ + @jakarta.annotation.Nullable + + public Integer get123number() { + return _123number; + } + + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Name instance itself + */ + public Name putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "snake_case", "property", "123Number")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java new file mode 100644 index 000000000000..5afb590614f2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NestedArrayWithDefaultValues + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NestedArrayWithDefaultValues { + public static final String SERIALIZED_NAME_NESTED_ARRAY = "nestedArray"; + @JsonbProperty(SERIALIZED_NAME_NESTED_ARRAY) + @jakarta.annotation.Nullable + private List> nestedArray; + + public NestedArrayWithDefaultValues() { + } + + public NestedArrayWithDefaultValues nestedArray(@jakarta.annotation.Nullable List> nestedArray) { + this.nestedArray = nestedArray; + return this; + } + + public NestedArrayWithDefaultValues addNestedArrayItem(List nestedArrayItem) { + if (this.nestedArray == null) { + this.nestedArray = new ArrayList<>(); + } + this.nestedArray.add(nestedArrayItem); + return this; + } + + /** + * Get nestedArray + * @return nestedArray + */ + @jakarta.annotation.Nullable + + public List> getNestedArray() { + return nestedArray; + } + + public void setNestedArray(@jakarta.annotation.Nullable List> nestedArray) { + this.nestedArray = nestedArray; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NestedArrayWithDefaultValues instance itself + */ + public NestedArrayWithDefaultValues putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NestedArrayWithDefaultValues {\n"); + sb.append(" nestedArray: ").append(toIndentedString(nestedArray)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("nestedArray")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPet.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPet.java new file mode 100644 index 000000000000..3d2d331f10fa --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPet.java @@ -0,0 +1,419 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.NewPetCategoryInlineAllof; +import org.openapitools.client.model.Tag; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NewPet + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NewPet { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY_INLINE_ALLOF = "category_inline_allof"; + @JsonbProperty(SERIALIZED_NAME_CATEGORY_INLINE_ALLOF) + @jakarta.annotation.Nullable + private NewPetCategoryInlineAllof categoryInlineAllof; + + public static final String SERIALIZED_NAME_CATEGORY_ALL_OF_REF = "category_allOf_ref"; + @JsonbProperty(SERIALIZED_NAME_CATEGORY_ALL_OF_REF) + @jakarta.annotation.Nullable + private Category categoryAllOfRef; + + public static final String SERIALIZED_NAME_CATEGORY_ALL_OF_REF_DESCRIPTION = "category_allOf_ref_description"; + @JsonbProperty(SERIALIZED_NAME_CATEGORY_ALL_OF_REF_DESCRIPTION) + @jakarta.annotation.Nullable + private Category categoryAllOfRefDescription; + + public static final String SERIALIZED_NAME_CATEGORY_ALL_OF_REF_DESCRIPTION_READONLY = "category_allOf_ref_description_readonly"; + @JsonbProperty(SERIALIZED_NAME_CATEGORY_ALL_OF_REF_DESCRIPTION_READONLY) + @jakarta.annotation.Nullable + private Category categoryAllOfRefDescriptionReadonly; + + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @JsonbProperty(SERIALIZED_NAME_PHOTO_URLS) + @jakarta.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @JsonbProperty(SERIALIZED_NAME_TAGS) + @jakarta.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_STATUS = "status"; + @JsonbProperty(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private StatusEnum status; + + public NewPet() { + } + + public NewPet( + Category categoryAllOfRefDescriptionReadonly + ) { + this(); + this.categoryAllOfRefDescriptionReadonly = categoryAllOfRefDescriptionReadonly; + } + + public NewPet id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public NewPet categoryInlineAllof(@jakarta.annotation.Nullable NewPetCategoryInlineAllof categoryInlineAllof) { + this.categoryInlineAllof = categoryInlineAllof; + return this; + } + + /** + * Get categoryInlineAllof + * @return categoryInlineAllof + */ + @jakarta.annotation.Nullable + + public NewPetCategoryInlineAllof getCategoryInlineAllof() { + return categoryInlineAllof; + } + + public void setCategoryInlineAllof(@jakarta.annotation.Nullable NewPetCategoryInlineAllof categoryInlineAllof) { + this.categoryInlineAllof = categoryInlineAllof; + } + + + public NewPet categoryAllOfRef(@jakarta.annotation.Nullable Category categoryAllOfRef) { + this.categoryAllOfRef = categoryAllOfRef; + return this; + } + + /** + * Get categoryAllOfRef + * @return categoryAllOfRef + */ + @jakarta.annotation.Nullable + + public Category getCategoryAllOfRef() { + return categoryAllOfRef; + } + + public void setCategoryAllOfRef(@jakarta.annotation.Nullable Category categoryAllOfRef) { + this.categoryAllOfRef = categoryAllOfRef; + } + + + public NewPet categoryAllOfRefDescription(@jakarta.annotation.Nullable Category categoryAllOfRefDescription) { + this.categoryAllOfRefDescription = categoryAllOfRefDescription; + return this; + } + + /** + * Adding description to property using allOf + * @return categoryAllOfRefDescription + */ + @jakarta.annotation.Nullable + + public Category getCategoryAllOfRefDescription() { + return categoryAllOfRefDescription; + } + + public void setCategoryAllOfRefDescription(@jakarta.annotation.Nullable Category categoryAllOfRefDescription) { + this.categoryAllOfRefDescription = categoryAllOfRefDescription; + } + + + /** + * Adding description to readonly property using allOf + * @return categoryAllOfRefDescriptionReadonly + */ + @jakarta.annotation.Nullable + + public Category getCategoryAllOfRefDescriptionReadonly() { + return categoryAllOfRefDescriptionReadonly; + } + + + + public NewPet name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + + public NewPet photoUrls(@jakarta.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public NewPet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @jakarta.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@jakarta.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public NewPet tags(@jakarta.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public NewPet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @jakarta.annotation.Nullable + + public List getTags() { + return tags; + } + + public void setTags(@jakarta.annotation.Nullable List tags) { + this.tags = tags; + } + + + public NewPet status(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @jakarta.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NewPet instance itself + */ + public NewPet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewPet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" categoryInlineAllof: ").append(toIndentedString(categoryInlineAllof)).append("\n"); + sb.append(" categoryAllOfRef: ").append(toIndentedString(categoryAllOfRef)).append("\n"); + sb.append(" categoryAllOfRefDescription: ").append(toIndentedString(categoryAllOfRefDescription)).append("\n"); + sb.append(" categoryAllOfRefDescriptionReadonly: ").append(toIndentedString(categoryAllOfRefDescriptionReadonly)).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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category_inline_allof", "category_allOf_ref", "category_allOf_ref_description", "category_allOf_ref_description_readonly", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java new file mode 100644 index 000000000000..f69e39e1e057 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java @@ -0,0 +1,205 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.NewPetCategoryInlineAllofAllOfCategoryTag; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NewPetCategoryInlineAllof + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NewPetCategoryInlineAllof { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name = "default-name"; + + public static final String SERIALIZED_NAME_CATEGORY_TAG = "category_tag"; + @JsonbProperty(SERIALIZED_NAME_CATEGORY_TAG) + @jakarta.annotation.Nullable + private NewPetCategoryInlineAllofAllOfCategoryTag categoryTag; + + public NewPetCategoryInlineAllof() { + } + + public NewPetCategoryInlineAllof id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public NewPetCategoryInlineAllof name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + + public NewPetCategoryInlineAllof categoryTag(@jakarta.annotation.Nullable NewPetCategoryInlineAllofAllOfCategoryTag categoryTag) { + this.categoryTag = categoryTag; + return this; + } + + /** + * Get categoryTag + * @return categoryTag + */ + @jakarta.annotation.Nullable + + public NewPetCategoryInlineAllofAllOfCategoryTag getCategoryTag() { + return categoryTag; + } + + public void setCategoryTag(@jakarta.annotation.Nullable NewPetCategoryInlineAllofAllOfCategoryTag categoryTag) { + this.categoryTag = categoryTag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NewPetCategoryInlineAllof instance itself + */ + public NewPetCategoryInlineAllof putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewPetCategoryInlineAllof {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" categoryTag: ").append(toIndentedString(categoryTag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name", "category_tag")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java new file mode 100644 index 000000000000..ee0151338600 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NewPetCategoryInlineAllofAllOfCategoryTag + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NewPetCategoryInlineAllofAllOfCategoryTag { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public NewPetCategoryInlineAllofAllOfCategoryTag() { + } + + public NewPetCategoryInlineAllofAllOfCategoryTag id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public NewPetCategoryInlineAllofAllOfCategoryTag name(@jakarta.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NewPetCategoryInlineAllofAllOfCategoryTag instance itself + */ + public NewPetCategoryInlineAllofAllOfCategoryTag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewPetCategoryInlineAllofAllOfCategoryTag {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableClass.java new file mode 100644 index 000000000000..39e84cb4260e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableClass.java @@ -0,0 +1,506 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NullableClass + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NullableClass { + public static final String SERIALIZED_NAME_INTEGER_PROP = "integer_prop"; + @JsonbProperty(SERIALIZED_NAME_INTEGER_PROP) + @jakarta.annotation.Nullable + private Integer integerProp; + + public static final String SERIALIZED_NAME_NUMBER_PROP = "number_prop"; + @JsonbProperty(SERIALIZED_NAME_NUMBER_PROP) + @jakarta.annotation.Nullable + private BigDecimal numberProp; + + public static final String SERIALIZED_NAME_BOOLEAN_PROP = "boolean_prop"; + @JsonbProperty(SERIALIZED_NAME_BOOLEAN_PROP) + @jakarta.annotation.Nullable + private Boolean booleanProp; + + public static final String SERIALIZED_NAME_STRING_PROP = "string_prop"; + @JsonbProperty(SERIALIZED_NAME_STRING_PROP) + @jakarta.annotation.Nullable + private String stringProp; + + public static final String SERIALIZED_NAME_DATE_PROP = "date_prop"; + @JsonbProperty(SERIALIZED_NAME_DATE_PROP) + @jakarta.annotation.Nullable + private LocalDate dateProp; + + public static final String SERIALIZED_NAME_DATETIME_PROP = "datetime_prop"; + @JsonbProperty(SERIALIZED_NAME_DATETIME_PROP) + @jakarta.annotation.Nullable + private OffsetDateTime datetimeProp; + + public static final String SERIALIZED_NAME_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + @JsonbProperty(SERIALIZED_NAME_ARRAY_NULLABLE_PROP) + @jakarta.annotation.Nullable + private List arrayNullableProp; + + public static final String SERIALIZED_NAME_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + @JsonbProperty(SERIALIZED_NAME_ARRAY_AND_ITEMS_NULLABLE_PROP) + @jakarta.annotation.Nullable + private List arrayAndItemsNullableProp; + + public static final String SERIALIZED_NAME_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + @JsonbProperty(SERIALIZED_NAME_ARRAY_ITEMS_NULLABLE) + @jakarta.annotation.Nullable + private List arrayItemsNullable = new ArrayList<>(); + + public static final String SERIALIZED_NAME_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + @JsonbProperty(SERIALIZED_NAME_OBJECT_NULLABLE_PROP) + @jakarta.annotation.Nullable + private Map objectNullableProp; + + public static final String SERIALIZED_NAME_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + @JsonbProperty(SERIALIZED_NAME_OBJECT_AND_ITEMS_NULLABLE_PROP) + @jakarta.annotation.Nullable + private Map objectAndItemsNullableProp; + + public static final String SERIALIZED_NAME_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + @JsonbProperty(SERIALIZED_NAME_OBJECT_ITEMS_NULLABLE) + @jakarta.annotation.Nullable + private Map objectItemsNullable = new HashMap<>(); + + public NullableClass() { + } + + public NullableClass integerProp(@jakarta.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + return this; + } + + /** + * Get integerProp + * @return integerProp + */ + @jakarta.annotation.Nullable + + public Integer getIntegerProp() { + return integerProp; + } + + public void setIntegerProp(@jakarta.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + } + + + public NullableClass numberProp(@jakarta.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + return this; + } + + /** + * Get numberProp + * @return numberProp + */ + @jakarta.annotation.Nullable + + public BigDecimal getNumberProp() { + return numberProp; + } + + public void setNumberProp(@jakarta.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + } + + + public NullableClass booleanProp(@jakarta.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + return this; + } + + /** + * Get booleanProp + * @return booleanProp + */ + @jakarta.annotation.Nullable + + public Boolean getBooleanProp() { + return booleanProp; + } + + public void setBooleanProp(@jakarta.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + } + + + public NullableClass stringProp(@jakarta.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + return this; + } + + /** + * Get stringProp + * @return stringProp + */ + @jakarta.annotation.Nullable + + public String getStringProp() { + return stringProp; + } + + public void setStringProp(@jakarta.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + } + + + public NullableClass dateProp(@jakarta.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + return this; + } + + /** + * Get dateProp + * @return dateProp + */ + @jakarta.annotation.Nullable + + public LocalDate getDateProp() { + return dateProp; + } + + public void setDateProp(@jakarta.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + } + + + public NullableClass datetimeProp(@jakarta.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + */ + @jakarta.annotation.Nullable + + public OffsetDateTime getDatetimeProp() { + return datetimeProp; + } + + public void setDatetimeProp(@jakarta.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + } + + + public NullableClass arrayNullableProp(@jakarta.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + return this; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null) { + this.arrayNullableProp = new ArrayList<>(); + } + this.arrayNullableProp.add(arrayNullablePropItem); + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + */ + @jakarta.annotation.Nullable + + public List getArrayNullableProp() { + return arrayNullableProp; + } + + public void setArrayNullableProp(@jakarta.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + + public NullableClass arrayAndItemsNullableProp(@jakarta.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null) { + this.arrayAndItemsNullableProp = new ArrayList<>(); + } + this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem); + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + */ + @jakarta.annotation.Nullable + + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp; + } + + public void setArrayAndItemsNullableProp(@jakarta.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + + public NullableClass arrayItemsNullable(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + public void setArrayItemsNullable(@jakarta.annotation.Nullable List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + + public NullableClass objectNullableProp(@jakarta.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + return this; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null) { + this.objectNullableProp = new HashMap<>(); + } + this.objectNullableProp.put(key, objectNullablePropItem); + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + */ + @jakarta.annotation.Nullable + + public Map getObjectNullableProp() { + return objectNullableProp; + } + + public void setObjectNullableProp(@jakarta.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + + public NullableClass objectAndItemsNullableProp(@jakarta.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null) { + this.objectAndItemsNullableProp = new HashMap<>(); + } + this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem); + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + */ + @jakarta.annotation.Nullable + + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp; + } + + public void setObjectAndItemsNullableProp(@jakarta.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + + public NullableClass objectItemsNullable(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + public void setObjectItemsNullable(@jakarta.annotation.Nullable Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableClass instance itself + */ + public NullableClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableEnum.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableEnum.java new file mode 100644 index 000000000000..55a8a386325c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableEnum.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +import jakarta.json.bind.annotation.JsonbCreator; +import jakarta.json.bind.annotation.JsonbValue; + +/** + * Gets or Sets NullableEnum + */ +public enum NullableEnum { + + CUSTOM("custom"); + + private String value; + + NullableEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + public static NullableEnum fromValue(String value) { + for (NullableEnum b : NullableEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java new file mode 100644 index 000000000000..2bac4c25bd3c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapError.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Error response + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NullableFieldsMapError { + public static final String SERIALIZED_NAME_STATUS = "status"; + @JsonbProperty(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nonnull + private String status; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @JsonbProperty(SERIALIZED_NAME_REASON) + @jakarta.annotation.Nonnull + private String reason; + + public NullableFieldsMapError() { + } + + public NullableFieldsMapError status(@jakarta.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @jakarta.annotation.Nonnull + + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nonnull String status) { + this.status = status; + } + + + public NullableFieldsMapError reason(@jakarta.annotation.Nonnull String reason) { + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + */ + @jakarta.annotation.Nonnull + + public String getReason() { + return reason; + } + + public void setReason(@jakarta.annotation.Nonnull String reason) { + this.reason = reason; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsMapError instance itself + */ + public NullableFieldsMapError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableFieldsMapError {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("status", "reason")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status", "reason")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java new file mode 100644 index 000000000000..c56bb4744028 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsMapError; +import org.openapitools.client.model.NullableFieldsMapSuccess; +import org.openapitools.client.model.NullableFieldsValue; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NullableFieldsMapResponse extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(NullableFieldsMapResponse.class.getName()); + + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public NullableFieldsMapResponse() { + super("anyOf", Boolean.FALSE); + } + + public NullableFieldsMapResponse(NullableFieldsMapError o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public NullableFieldsMapResponse(NullableFieldsMapSuccess o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("NullableFieldsMapError", NullableFieldsMapError.class); + schemas.put("NullableFieldsMapSuccess", NullableFieldsMapSuccess.class); + } + + @Override + public Map> getSchemas() { + return NullableFieldsMapResponse.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * NullableFieldsMapError, NullableFieldsMapSuccess + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(NullableFieldsMapError.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(NullableFieldsMapSuccess.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be NullableFieldsMapError, NullableFieldsMapSuccess"); + } + + /** + * Get the actual instance, which can be the following: + * NullableFieldsMapError, NullableFieldsMapSuccess + * + * @return The actual instance (NullableFieldsMapError, NullableFieldsMapSuccess) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `NullableFieldsMapError`. If the actual instance is not `NullableFieldsMapError`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `NullableFieldsMapError` + * @throws ClassCastException if the instance is not `NullableFieldsMapError` + */ + public NullableFieldsMapError getNullableFieldsMapError() throws ClassCastException { + return (NullableFieldsMapError)super.getActualInstance(); + } + + /** + * Get the actual instance of `NullableFieldsMapSuccess`. If the actual instance is not `NullableFieldsMapSuccess`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `NullableFieldsMapSuccess` + * @throws ClassCastException if the instance is not `NullableFieldsMapSuccess` + */ + public NullableFieldsMapSuccess getNullableFieldsMapSuccess() throws ClassCastException { + return (NullableFieldsMapSuccess)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java new file mode 100644 index 000000000000..4b3e8f98e0d7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java @@ -0,0 +1,189 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsValue; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Success response containing a map of objects with nullable fields + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NullableFieldsMapSuccess { + public static final String SERIALIZED_NAME_STATUS = "status"; + @JsonbProperty(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nonnull + private String status; + + public static final String SERIALIZED_NAME_POSITIONS = "positions"; + @JsonbProperty(SERIALIZED_NAME_POSITIONS) + @jakarta.annotation.Nonnull + private Map positions; + + public NullableFieldsMapSuccess() { + } + + public NullableFieldsMapSuccess status(@jakarta.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @jakarta.annotation.Nonnull + + public String getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nonnull String status) { + this.status = status; + } + + + public NullableFieldsMapSuccess positions(@jakarta.annotation.Nonnull Map positions) { + this.positions = positions; + return this; + } + + public NullableFieldsMapSuccess putPositionsItem(String key, NullableFieldsValue positionsItem) { + if (this.positions == null) { + this.positions = new HashMap<>(); + } + this.positions.put(key, positionsItem); + return this; + } + + /** + * Get positions + * @return positions + */ + @jakarta.annotation.Nonnull + + public Map getPositions() { + return positions; + } + + public void setPositions(@jakarta.annotation.Nonnull Map positions) { + this.positions = positions; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsMapSuccess instance itself + */ + public NullableFieldsMapSuccess putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableFieldsMapSuccess {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" positions: ").append(toIndentedString(positions)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("status", "positions")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status", "positions")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsValue.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsValue.java new file mode 100644 index 000000000000..2886d1dc0d1f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsValue.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with required but nullable string fields + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NullableFieldsValue { + public static final String SERIALIZED_NAME_BEFORE = "before"; + @JsonbProperty(SERIALIZED_NAME_BEFORE) + @jakarta.annotation.Nullable + private String before; + + public static final String SERIALIZED_NAME_AFTER = "after"; + @JsonbProperty(SERIALIZED_NAME_AFTER) + @jakarta.annotation.Nullable + private String after; + + public NullableFieldsValue() { + } + + public NullableFieldsValue before(@jakarta.annotation.Nullable String before) { + this.before = before; + return this; + } + + /** + * Get before + * @return before + */ + @jakarta.annotation.Nullable + + public String getBefore() { + return before; + } + + public void setBefore(@jakarta.annotation.Nullable String before) { + this.before = before; + } + + + public NullableFieldsValue after(@jakarta.annotation.Nullable String after) { + this.after = after; + return this; + } + + /** + * Get after + * @return after + */ + @jakarta.annotation.Nullable + + public String getAfter() { + return after; + } + + public void setAfter(@jakarta.annotation.Nullable String after) { + this.after = after; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsValue instance itself + */ + public NullableFieldsValue putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableFieldsValue {\n"); + sb.append(" before: ").append(toIndentedString(before)).append("\n"); + sb.append(" after: ").append(toIndentedString(after)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("before", "after")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("before", "after")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableShape.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableShape.java new file mode 100644 index 000000000000..b130ec456d68 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableShape.java @@ -0,0 +1,135 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NullableShape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(NullableShape.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final 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", Quadrilateral.class); + schemas.put("Triangle", Triangle.class); + } + + @Override + public Map> getSchemas() { + return NullableShape.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NumberOnly.java new file mode 100644 index 000000000000..9f16b31a6c41 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -0,0 +1,153 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NumberOnly + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NumberOnly { + public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; + @JsonbProperty(SERIALIZED_NAME_JUST_NUMBER) + @jakarta.annotation.Nullable + private BigDecimal justNumber; + + public NumberOnly() { + } + + public NumberOnly justNumber(@jakarta.annotation.Nullable BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + */ + @jakarta.annotation.Nullable + + public BigDecimal getJustNumber() { + return justNumber; + } + + public void setJustNumber(@jakarta.annotation.Nullable BigDecimal justNumber) { + this.justNumber = justNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NumberOnly instance itself + */ + public NumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("JustNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java new file mode 100644 index 000000000000..dc10af7fc79a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -0,0 +1,258 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.DeprecatedObject; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ObjectWithDeprecatedFields + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ObjectWithDeprecatedFields { + public static final String SERIALIZED_NAME_UUID = "uuid"; + @JsonbProperty(SERIALIZED_NAME_UUID) + @jakarta.annotation.Nullable + private String uuid; + + public static final String SERIALIZED_NAME_ID = "id"; + @Deprecated + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private BigDecimal id; + + public static final String SERIALIZED_NAME_DEPRECATED_REF = "deprecatedRef"; + @Deprecated + @JsonbProperty(SERIALIZED_NAME_DEPRECATED_REF) + @jakarta.annotation.Nullable + private DeprecatedObject deprecatedRef; + + public static final String SERIALIZED_NAME_BARS = "bars"; + @Deprecated + @JsonbProperty(SERIALIZED_NAME_BARS) + @jakarta.annotation.Nullable + private List bars = new ArrayList<>(); + + public ObjectWithDeprecatedFields() { + } + + public ObjectWithDeprecatedFields uuid(@jakarta.annotation.Nullable String uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @jakarta.annotation.Nullable + + public String getUuid() { + return uuid; + } + + public void setUuid(@jakarta.annotation.Nullable String uuid) { + this.uuid = uuid; + } + + + @Deprecated + public ObjectWithDeprecatedFields id(@jakarta.annotation.Nullable BigDecimal id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + * @deprecated + */ + @Deprecated + @jakarta.annotation.Nullable + + public BigDecimal getId() { + return id; + } + + @Deprecated + public void setId(@jakarta.annotation.Nullable BigDecimal id) { + this.id = id; + } + + + @Deprecated + public ObjectWithDeprecatedFields deprecatedRef(@jakarta.annotation.Nullable DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return this; + } + + /** + * Get deprecatedRef + * @return deprecatedRef + * @deprecated + */ + @Deprecated + @jakarta.annotation.Nullable + + public DeprecatedObject getDeprecatedRef() { + return deprecatedRef; + } + + @Deprecated + public void setDeprecatedRef(@jakarta.annotation.Nullable DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + } + + + @Deprecated + public ObjectWithDeprecatedFields bars(@jakarta.annotation.Nullable List bars) { + this.bars = bars; + return this; + } + + public ObjectWithDeprecatedFields addBarsItem(String barsItem) { + if (this.bars == null) { + this.bars = new ArrayList<>(); + } + this.bars.add(barsItem); + return this; + } + + /** + * Get bars + * @return bars + * @deprecated + */ + @Deprecated + @jakarta.annotation.Nullable + + public List getBars() { + return bars; + } + + @Deprecated + public void setBars(@jakarta.annotation.Nullable List bars) { + this.bars = bars; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ObjectWithDeprecatedFields instance itself + */ + public ObjectWithDeprecatedFields putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObjectWithDeprecatedFields {\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" deprecatedRef: ").append(toIndentedString(deprecatedRef)).append("\n"); + sb.append(" bars: ").append(toIndentedString(bars)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("uuid", "id", "deprecatedRef", "bars")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..91f8a24c7762 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,321 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.time.OffsetDateTime; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Order + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Order { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_PET_ID = "petId"; + @JsonbProperty(SERIALIZED_NAME_PET_ID) + @jakarta.annotation.Nullable + private Long petId; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @JsonbProperty(SERIALIZED_NAME_QUANTITY) + @jakarta.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; + @JsonbProperty(SERIALIZED_NAME_SHIP_DATE) + @jakarta.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_STATUS = "status"; + @JsonbProperty(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_COMPLETE = "complete"; + @JsonbProperty(SERIALIZED_NAME_COMPLETE) + @jakarta.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@jakarta.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @jakarta.annotation.Nullable + + public Long getPetId() { + return petId; + } + + public void setPetId(@jakarta.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@jakarta.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @jakarta.annotation.Nullable + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@jakarta.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@jakarta.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @jakarta.annotation.Nullable + + public OffsetDateTime getShipDate() { + return shipDate; + } + + public void setShipDate(@jakarta.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @jakarta.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@jakarta.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @jakarta.annotation.Nullable + + public Boolean getComplete() { + return complete; + } + + public void setComplete(@jakarta.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "petId", "quantity", "shipDate", "status", "complete")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterComposite.java new file mode 100644 index 000000000000..523a87349bb4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -0,0 +1,205 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OuterComposite + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OuterComposite { + public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; + @JsonbProperty(SERIALIZED_NAME_MY_NUMBER) + @jakarta.annotation.Nullable + private BigDecimal myNumber; + + public static final String SERIALIZED_NAME_MY_STRING = "my_string"; + @JsonbProperty(SERIALIZED_NAME_MY_STRING) + @jakarta.annotation.Nullable + private String myString; + + public static final String SERIALIZED_NAME_MY_BOOLEAN = "my_boolean"; + @JsonbProperty(SERIALIZED_NAME_MY_BOOLEAN) + @jakarta.annotation.Nullable + private Boolean myBoolean; + + public OuterComposite() { + } + + public OuterComposite myNumber(@jakarta.annotation.Nullable BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + */ + @jakarta.annotation.Nullable + + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(@jakarta.annotation.Nullable BigDecimal myNumber) { + this.myNumber = myNumber; + } + + + public OuterComposite myString(@jakarta.annotation.Nullable String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + */ + @jakarta.annotation.Nullable + + public String getMyString() { + return myString; + } + + public void setMyString(@jakarta.annotation.Nullable String myString) { + this.myString = myString; + } + + + public OuterComposite myBoolean(@jakarta.annotation.Nullable Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + */ + @jakarta.annotation.Nullable + + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(@jakarta.annotation.Nullable Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OuterComposite instance itself + */ + public OuterComposite putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("my_number", "my_string", "my_boolean")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnum.java new file mode 100644 index 000000000000..a0db60b7ab6e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -0,0 +1,66 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +import jakarta.json.bind.annotation.JsonbCreator; +import jakarta.json.bind.annotation.JsonbValue; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"), + + LOWER_CASE_S("s"), + + UPPER_CASE_S("S"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + public static OuterEnum fromValue(String value) { + for (OuterEnum b : OuterEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..97c4b0d64659 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.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.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +import jakarta.json.bind.annotation.JsonbCreator; +import jakarta.json.bind.annotation.JsonbValue; + +/** + * Gets or Sets OuterEnumDefaultValue + */ +public enum OuterEnumDefaultValue { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnumDefaultValue(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnumInteger.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnumInteger.java new file mode 100644 index 000000000000..a65be6ca871f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnumInteger.java @@ -0,0 +1,63 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +import jakarta.json.bind.annotation.JsonbCreator; +import jakarta.json.bind.annotation.JsonbValue; + +/** + * Gets or Sets OuterEnumInteger + */ +@Deprecated +public enum OuterEnumInteger { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumInteger(Integer value) { + this.value = value; + } + + @JsonbValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..542618db32e2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.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.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import java.io.IOException; +import jakarta.json.bind.annotation.JsonbCreator; +import jakarta.json.bind.annotation.JsonbValue; + +/** + * 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; + } + + @JsonbValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ParentPet.java new file mode 100644 index 000000000000..4f5058b9ed09 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ParentPet.java @@ -0,0 +1,129 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.GrandparentAnimal; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ParentPet + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ParentPet extends GrandparentAnimal { + public ParentPet() { + this.petType = this.getClass().getSimpleName(); + } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ParentPet instance itself + */ + public ParentPet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParentPet {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(0); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("pet_type")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..05a917ec15b7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,341 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Pet + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pet { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @JsonbProperty(SERIALIZED_NAME_CATEGORY) + @jakarta.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @JsonbProperty(SERIALIZED_NAME_PHOTO_URLS) + @jakarta.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @JsonbProperty(SERIALIZED_NAME_TAGS) + @jakarta.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_STATUS = "status"; + @JsonbProperty(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@jakarta.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @jakarta.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@jakarta.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@jakarta.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @jakarta.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@jakarta.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public List getTags() { + return tags; + } + + public void setTags(@jakarta.annotation.Nullable List tags) { + this.tags = tags; + } + + + public Pet status(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @jakarta.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetComposition.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetComposition.java new file mode 100644 index 000000000000..30a1a5330e03 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetComposition.java @@ -0,0 +1,341 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetComposition + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class PetComposition { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @JsonbProperty(SERIALIZED_NAME_CATEGORY) + @jakarta.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @JsonbProperty(SERIALIZED_NAME_PHOTO_URLS) + @jakarta.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @JsonbProperty(SERIALIZED_NAME_TAGS) + @jakarta.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_STATUS = "status"; + @JsonbProperty(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private StatusEnum status; + + public PetComposition() { + } + + public PetComposition id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public PetComposition category(@jakarta.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @jakarta.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@jakarta.annotation.Nullable Category category) { + this.category = category; + } + + + public PetComposition name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + + public PetComposition photoUrls(@jakarta.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetComposition addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @jakarta.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@jakarta.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetComposition tags(@jakarta.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetComposition addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @jakarta.annotation.Nullable + + public List getTags() { + return tags; + } + + public void setTags(@jakarta.annotation.Nullable List tags) { + this.tags = tags; + } + + + public PetComposition status(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @jakarta.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetComposition instance itself + */ + public PetComposition putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetComposition {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetRef.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetRef.java new file mode 100644 index 000000000000..4b27e0514af1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetRef.java @@ -0,0 +1,341 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetRef + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class PetRef { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @JsonbProperty(SERIALIZED_NAME_CATEGORY) + @jakarta.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @JsonbProperty(SERIALIZED_NAME_PHOTO_URLS) + @jakarta.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @JsonbProperty(SERIALIZED_NAME_TAGS) + @jakarta.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_STATUS = "status"; + @JsonbProperty(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private StatusEnum status; + + public PetRef() { + } + + public PetRef id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public PetRef category(@jakarta.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @jakarta.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@jakarta.annotation.Nullable Category category) { + this.category = category; + } + + + public PetRef name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + + public PetRef photoUrls(@jakarta.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetRef addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @jakarta.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@jakarta.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetRef tags(@jakarta.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetRef addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @jakarta.annotation.Nullable + + public List getTags() { + return tags; + } + + public void setTags(@jakarta.annotation.Nullable List tags) { + this.tags = tags; + } + + + public PetRef status(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @jakarta.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetRef instance itself + */ + public PetRef putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetRef {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetUsingAllOf.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetUsingAllOf.java new file mode 100644 index 000000000000..eb158771a79f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetUsingAllOf.java @@ -0,0 +1,341 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetUsingAllOf + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class PetUsingAllOf { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @JsonbProperty(SERIALIZED_NAME_CATEGORY) + @jakarta.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @JsonbProperty(SERIALIZED_NAME_PHOTO_URLS) + @jakarta.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @JsonbProperty(SERIALIZED_NAME_TAGS) + @jakarta.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_STATUS = "status"; + @JsonbProperty(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private StatusEnum status; + + public PetUsingAllOf() { + } + + public PetUsingAllOf id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public PetUsingAllOf category(@jakarta.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * multi line description 2nd line last line + * @return category + */ + @jakarta.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@jakarta.annotation.Nullable Category category) { + this.category = category; + } + + + public PetUsingAllOf name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + + public PetUsingAllOf photoUrls(@jakarta.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetUsingAllOf addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @jakarta.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@jakarta.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetUsingAllOf tags(@jakarta.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetUsingAllOf addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @jakarta.annotation.Nullable + + public List getTags() { + return tags; + } + + public void setTags(@jakarta.annotation.Nullable List tags) { + this.tags = tags; + } + + + public PetUsingAllOf status(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @jakarta.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetUsingAllOf instance itself + */ + public PetUsingAllOf putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetUsingAllOf {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java new file mode 100644 index 000000000000..3d3f6e544c57 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java @@ -0,0 +1,341 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetWithRequiredTags + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class PetWithRequiredTags { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @JsonbProperty(SERIALIZED_NAME_CATEGORY) + @jakarta.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @JsonbProperty(SERIALIZED_NAME_PHOTO_URLS) + @jakarta.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @JsonbProperty(SERIALIZED_NAME_TAGS) + @jakarta.annotation.Nonnull + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_STATUS = "status"; + @JsonbProperty(SERIALIZED_NAME_STATUS) + @jakarta.annotation.Nullable + private StatusEnum status; + + public PetWithRequiredTags() { + } + + public PetWithRequiredTags id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public PetWithRequiredTags category(@jakarta.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @jakarta.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@jakarta.annotation.Nullable Category category) { + this.category = category; + } + + + public PetWithRequiredTags name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + + public PetWithRequiredTags photoUrls(@jakarta.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetWithRequiredTags addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @jakarta.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@jakarta.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetWithRequiredTags tags(@jakarta.annotation.Nonnull List tags) { + this.tags = tags; + return this; + } + + public PetWithRequiredTags addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @jakarta.annotation.Nonnull + + public List getTags() { + return tags; + } + + public void setTags(@jakarta.annotation.Nonnull List tags) { + this.tags = tags; + } + + + public PetWithRequiredTags status(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @jakarta.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@jakarta.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetWithRequiredTags instance itself + */ + public PetWithRequiredTags putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetWithRequiredTags {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls", "tags")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pig.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pig.java new file mode 100644 index 000000000000..407d23324839 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pig.java @@ -0,0 +1,130 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.DanishPig; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pig extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Pig.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final 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", BasquePig.class); + schemas.put("DanishPig", DanishPig.class); + } + + @Override + public Map> getSchemas() { + return Pig.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * BasquePig, DanishPig + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(BasquePig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(DanishPig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BasquePig, DanishPig"); + } + + /** + * Get the actual instance, which can be the following: + * BasquePig, DanishPig + * + * @return The actual instance (BasquePig, DanishPig) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BasquePig`. If the actual instance is not `BasquePig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BasquePig` + * @throws ClassCastException if the instance is not `BasquePig` + */ + public BasquePig getBasquePig() throws ClassCastException { + return (BasquePig)super.getActualInstance(); + } + + /** + * Get the actual instance of `DanishPig`. If the actual instance is not `DanishPig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `DanishPig` + * @throws ClassCastException if the instance is not `DanishPig` + */ + public DanishPig getDanishPig() throws ClassCastException { + return (DanishPig)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PropertyNameCollision.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PropertyNameCollision.java new file mode 100644 index 000000000000..16e89bc51224 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PropertyNameCollision.java @@ -0,0 +1,204 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PropertyNameCollision + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class PropertyNameCollision { + public static final String SERIALIZED_NAME_UNDERSCORE_TYPE = "_type"; + @JsonbProperty(SERIALIZED_NAME_UNDERSCORE_TYPE) + @jakarta.annotation.Nullable + private String underscoreType; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @JsonbProperty(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_TYPE_WITH_UNDERSCORE = "type_"; + @JsonbProperty(SERIALIZED_NAME_TYPE_WITH_UNDERSCORE) + @jakarta.annotation.Nullable + private String typeWithUnderscore; + + public PropertyNameCollision() { + } + + public PropertyNameCollision underscoreType(@jakarta.annotation.Nullable String underscoreType) { + this.underscoreType = underscoreType; + return this; + } + + /** + * Get underscoreType + * @return underscoreType + */ + @jakarta.annotation.Nullable + + public String getUnderscoreType() { + return underscoreType; + } + + public void setUnderscoreType(@jakarta.annotation.Nullable String underscoreType) { + this.underscoreType = underscoreType; + } + + + public PropertyNameCollision type(@jakarta.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @jakarta.annotation.Nullable + + public String getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable String type) { + this.type = type; + } + + + public PropertyNameCollision typeWithUnderscore(@jakarta.annotation.Nullable String typeWithUnderscore) { + this.typeWithUnderscore = typeWithUnderscore; + return this; + } + + /** + * Get typeWithUnderscore + * @return typeWithUnderscore + */ + @jakarta.annotation.Nullable + + public String getTypeWithUnderscore() { + return typeWithUnderscore; + } + + public void setTypeWithUnderscore(@jakarta.annotation.Nullable String typeWithUnderscore) { + this.typeWithUnderscore = typeWithUnderscore; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PropertyNameCollision instance itself + */ + public PropertyNameCollision putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertyNameCollision {\n"); + sb.append(" underscoreType: ").append(toIndentedString(underscoreType)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" typeWithUnderscore: ").append(toIndentedString(typeWithUnderscore)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("_type", "type", "type_")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Quadrilateral.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Quadrilateral.java new file mode 100644 index 000000000000..1fce04f9562c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Quadrilateral.java @@ -0,0 +1,130 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Quadrilateral extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Quadrilateral.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final 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", ComplexQuadrilateral.class); + schemas.put("SimpleQuadrilateral", SimpleQuadrilateral.class); + } + + @Override + public Map> getSchemas() { + return Quadrilateral.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * ComplexQuadrilateral, SimpleQuadrilateral + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ComplexQuadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(SimpleQuadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be ComplexQuadrilateral, SimpleQuadrilateral"); + } + + /** + * Get the actual instance, which can be the following: + * ComplexQuadrilateral, SimpleQuadrilateral + * + * @return The actual instance (ComplexQuadrilateral, SimpleQuadrilateral) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ComplexQuadrilateral`. If the actual instance is not `ComplexQuadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ComplexQuadrilateral` + * @throws ClassCastException if the instance is not `ComplexQuadrilateral` + */ + public ComplexQuadrilateral getComplexQuadrilateral() throws ClassCastException { + return (ComplexQuadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `SimpleQuadrilateral`. If the actual instance is not `SimpleQuadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SimpleQuadrilateral` + * @throws ClassCastException if the instance is not `SimpleQuadrilateral` + */ + public SimpleQuadrilateral getSimpleQuadrilateral() throws ClassCastException { + return (SimpleQuadrilateral)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java new file mode 100644 index 000000000000..c71a0e402a6a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * QuadrilateralInterface + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class QuadrilateralInterface { + public static final String SERIALIZED_NAME_QUADRILATERAL_TYPE = "quadrilateralType"; + @JsonbProperty(SERIALIZED_NAME_QUADRILATERAL_TYPE) + @jakarta.annotation.Nonnull + private String quadrilateralType; + + public QuadrilateralInterface() { + } + + public QuadrilateralInterface quadrilateralType(@jakarta.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + */ + @jakarta.annotation.Nonnull + + public String getQuadrilateralType() { + return quadrilateralType; + } + + public void setQuadrilateralType(@jakarta.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the QuadrilateralInterface instance itself + */ + public QuadrilateralInterface putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuadrilateralInterface {\n"); + sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("quadrilateralType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("quadrilateralType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..945e140a7f43 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ReadOnlyFirst.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReadOnlyFirst + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ReadOnlyFirst { + public static final String SERIALIZED_NAME_BAR = "bar"; + @JsonbProperty(SERIALIZED_NAME_BAR) + @jakarta.annotation.Nullable + private String bar; + + public static final String SERIALIZED_NAME_BAZ = "baz"; + @JsonbProperty(SERIALIZED_NAME_BAZ) + @jakarta.annotation.Nullable + private String baz; + + public ReadOnlyFirst() { + } + + public ReadOnlyFirst( + String bar + ) { + this(); + this.bar = bar; + } + + /** + * Get bar + * @return bar + */ + @jakarta.annotation.Nullable + + public String getBar() { + return bar; + } + + + + public ReadOnlyFirst baz(@jakarta.annotation.Nullable String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + */ + @jakarta.annotation.Nullable + + public String getBaz() { + return baz; + } + + public void setBaz(@jakarta.annotation.Nullable String baz) { + this.baz = baz; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ReadOnlyFirst instance itself + */ + public ReadOnlyFirst putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar", "baz")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/RequiredNullableBody.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/RequiredNullableBody.java new file mode 100644 index 000000000000..9963baaad5ea --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/RequiredNullableBody.java @@ -0,0 +1,581 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.client.model.NullableEnum; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RequiredNullableBody + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class RequiredNullableBody { + public static final String SERIALIZED_NAME_INTEGER_PROP = "integer_prop"; + @JsonbProperty(SERIALIZED_NAME_INTEGER_PROP) + @jakarta.annotation.Nullable + private Integer integerProp; + + public static final String SERIALIZED_NAME_NUMBER_PROP = "number_prop"; + @JsonbProperty(SERIALIZED_NAME_NUMBER_PROP) + @jakarta.annotation.Nullable + private BigDecimal numberProp; + + public static final String SERIALIZED_NAME_BOOLEAN_PROP = "boolean_prop"; + @JsonbProperty(SERIALIZED_NAME_BOOLEAN_PROP) + @jakarta.annotation.Nullable + private Boolean booleanProp; + + public static final String SERIALIZED_NAME_STRING_PROP = "string_prop"; + @JsonbProperty(SERIALIZED_NAME_STRING_PROP) + @jakarta.annotation.Nullable + private String stringProp; + + public static final String SERIALIZED_NAME_DATE_PROP = "date_prop"; + @JsonbProperty(SERIALIZED_NAME_DATE_PROP) + @jakarta.annotation.Nullable + private LocalDate dateProp; + + public static final String SERIALIZED_NAME_DATETIME_PROP = "datetime_prop"; + @JsonbProperty(SERIALIZED_NAME_DATETIME_PROP) + @jakarta.annotation.Nullable + private OffsetDateTime datetimeProp; + + public static final String SERIALIZED_NAME_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + @JsonbProperty(SERIALIZED_NAME_ARRAY_NULLABLE_PROP) + @jakarta.annotation.Nullable + private List arrayNullableProp; + + public static final String SERIALIZED_NAME_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + @JsonbProperty(SERIALIZED_NAME_ARRAY_AND_ITEMS_NULLABLE_PROP) + @jakarta.annotation.Nullable + private List arrayAndItemsNullableProp; + + public static final String SERIALIZED_NAME_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + @JsonbProperty(SERIALIZED_NAME_ARRAY_ITEMS_NULLABLE) + @jakarta.annotation.Nonnull + private List arrayItemsNullable = new ArrayList<>(); + + public static final String SERIALIZED_NAME_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + @JsonbProperty(SERIALIZED_NAME_OBJECT_NULLABLE_PROP) + @jakarta.annotation.Nullable + private Map objectNullableProp; + + public static final String SERIALIZED_NAME_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + @JsonbProperty(SERIALIZED_NAME_OBJECT_AND_ITEMS_NULLABLE_PROP) + @jakarta.annotation.Nullable + private Map objectAndItemsNullableProp; + + public static final String SERIALIZED_NAME_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + @JsonbProperty(SERIALIZED_NAME_OBJECT_ITEMS_NULLABLE) + @jakarta.annotation.Nonnull + private Map objectItemsNullable = new HashMap<>(); + + public static final String SERIALIZED_NAME_CUSTOM_REF_ENUM = "custom_ref_enum"; + @JsonbProperty(SERIALIZED_NAME_CUSTOM_REF_ENUM) + @jakarta.annotation.Nullable + private NullableEnum customRefEnum; + + /** + * Gets or Sets customEnum + */ + public enum CustomEnumEnum { + CUSTOM("custom"); + + private String value; + + CustomEnumEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + public static CustomEnumEnum fromValue(String value) { + for (CustomEnumEnum b : CustomEnumEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + } + + public static final String SERIALIZED_NAME_CUSTOM_ENUM = "custom_enum"; + @JsonbProperty(SERIALIZED_NAME_CUSTOM_ENUM) + @jakarta.annotation.Nullable + private CustomEnumEnum customEnum; + + public RequiredNullableBody() { + } + + public RequiredNullableBody integerProp(@jakarta.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + return this; + } + + /** + * Get integerProp + * @return integerProp + */ + @jakarta.annotation.Nullable + + public Integer getIntegerProp() { + return integerProp; + } + + public void setIntegerProp(@jakarta.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + } + + + public RequiredNullableBody numberProp(@jakarta.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + return this; + } + + /** + * Get numberProp + * @return numberProp + */ + @jakarta.annotation.Nullable + + public BigDecimal getNumberProp() { + return numberProp; + } + + public void setNumberProp(@jakarta.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + } + + + public RequiredNullableBody booleanProp(@jakarta.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + return this; + } + + /** + * Get booleanProp + * @return booleanProp + */ + @jakarta.annotation.Nullable + + public Boolean getBooleanProp() { + return booleanProp; + } + + public void setBooleanProp(@jakarta.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + } + + + public RequiredNullableBody stringProp(@jakarta.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + return this; + } + + /** + * Get stringProp + * @return stringProp + */ + @jakarta.annotation.Nullable + + public String getStringProp() { + return stringProp; + } + + public void setStringProp(@jakarta.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + } + + + public RequiredNullableBody dateProp(@jakarta.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + return this; + } + + /** + * Get dateProp + * @return dateProp + */ + @jakarta.annotation.Nullable + + public LocalDate getDateProp() { + return dateProp; + } + + public void setDateProp(@jakarta.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + } + + + public RequiredNullableBody datetimeProp(@jakarta.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + */ + @jakarta.annotation.Nullable + + public OffsetDateTime getDatetimeProp() { + return datetimeProp; + } + + public void setDatetimeProp(@jakarta.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + } + + + public RequiredNullableBody arrayNullableProp(@jakarta.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + return this; + } + + public RequiredNullableBody addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null) { + this.arrayNullableProp = new ArrayList<>(); + } + this.arrayNullableProp.add(arrayNullablePropItem); + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + */ + @jakarta.annotation.Nullable + + public List getArrayNullableProp() { + return arrayNullableProp; + } + + public void setArrayNullableProp(@jakarta.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + + public RequiredNullableBody arrayAndItemsNullableProp(@jakarta.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + + public RequiredNullableBody addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null) { + this.arrayAndItemsNullableProp = new ArrayList<>(); + } + this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem); + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + */ + @jakarta.annotation.Nullable + + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp; + } + + public void setArrayAndItemsNullableProp(@jakarta.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + + public RequiredNullableBody arrayItemsNullable(@jakarta.annotation.Nonnull List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + public RequiredNullableBody addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<>(); + } + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + /** + * Get arrayItemsNullable + * @return arrayItemsNullable + */ + @jakarta.annotation.Nonnull + + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + public void setArrayItemsNullable(@jakarta.annotation.Nonnull List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + + public RequiredNullableBody objectNullableProp(@jakarta.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + return this; + } + + public RequiredNullableBody putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null) { + this.objectNullableProp = new HashMap<>(); + } + this.objectNullableProp.put(key, objectNullablePropItem); + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + */ + @jakarta.annotation.Nullable + + public Map getObjectNullableProp() { + return objectNullableProp; + } + + public void setObjectNullableProp(@jakarta.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + + public RequiredNullableBody objectAndItemsNullableProp(@jakarta.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + + public RequiredNullableBody putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null) { + this.objectAndItemsNullableProp = new HashMap<>(); + } + this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem); + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + */ + @jakarta.annotation.Nullable + + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp; + } + + public void setObjectAndItemsNullableProp(@jakarta.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + + public RequiredNullableBody objectItemsNullable(@jakarta.annotation.Nonnull Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + return this; + } + + public RequiredNullableBody putObjectItemsNullableItem(String key, Object objectItemsNullableItem) { + if (this.objectItemsNullable == null) { + this.objectItemsNullable = new HashMap<>(); + } + this.objectItemsNullable.put(key, objectItemsNullableItem); + return this; + } + + /** + * Get objectItemsNullable + * @return objectItemsNullable + */ + @jakarta.annotation.Nonnull + + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + public void setObjectItemsNullable(@jakarta.annotation.Nonnull Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + + public RequiredNullableBody customRefEnum(@jakarta.annotation.Nullable NullableEnum customRefEnum) { + this.customRefEnum = customRefEnum; + return this; + } + + /** + * Get customRefEnum + * @return customRefEnum + */ + @jakarta.annotation.Nullable + + public NullableEnum getCustomRefEnum() { + return customRefEnum; + } + + public void setCustomRefEnum(@jakarta.annotation.Nullable NullableEnum customRefEnum) { + this.customRefEnum = customRefEnum; + } + + + public RequiredNullableBody customEnum(@jakarta.annotation.Nullable CustomEnumEnum customEnum) { + this.customEnum = customEnum; + return this; + } + + /** + * Get customEnum + * @return customEnum + */ + @jakarta.annotation.Nullable + + public CustomEnumEnum getCustomEnum() { + return customEnum; + } + + public void setCustomEnum(@jakarta.annotation.Nullable CustomEnumEnum customEnum) { + this.customEnum = customEnum; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RequiredNullableBody instance itself + */ + public RequiredNullableBody putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequiredNullableBody {\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(" customRefEnum: ").append(toIndentedString(customRefEnum)).append("\n"); + sb.append(" customEnum: ").append(toIndentedString(customEnum)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable", "custom_ref_enum", "custom_enum")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable", "custom_ref_enum", "custom_enum")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Scalar.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Scalar.java new file mode 100644 index 000000000000..f4c2970ad6c0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Scalar.java @@ -0,0 +1,174 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import java.util.UUID; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Scalar extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Scalar.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Scalar() { + super("oneOf", Boolean.FALSE); + } + + public Scalar(BigDecimal o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Scalar(Boolean o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Scalar(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Scalar(UUID o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("BigDecimal", BigDecimal.class); + schemas.put("Boolean", Boolean.class); + schemas.put("String", String.class); + schemas.put("UUID", UUID.class); + } + + @Override + public Map> getSchemas() { + return Scalar.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * BigDecimal, Boolean, String, UUID + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(BigDecimal.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Boolean.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UUID.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BigDecimal, Boolean, String, UUID"); + } + + /** + * Get the actual instance, which can be the following: + * BigDecimal, Boolean, String, UUID + * + * @return The actual instance (BigDecimal, Boolean, String, UUID) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BigDecimal`. If the actual instance is not `BigDecimal`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BigDecimal` + * @throws ClassCastException if the instance is not `BigDecimal` + */ + public BigDecimal getBigDecimal() throws ClassCastException { + return (BigDecimal)super.getActualInstance(); + } + + /** + * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Boolean` + * @throws ClassCastException if the instance is not `Boolean` + */ + public Boolean getBoolean() throws ClassCastException { + return (Boolean)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + /** + * Get the actual instance of `UUID`. If the actual instance is not `UUID`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UUID` + * @throws ClassCastException if the instance is not `UUID` + */ + public UUID getUUID() throws ClassCastException { + return (UUID)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScalarAnyOf.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScalarAnyOf.java new file mode 100644 index 000000000000..e8952691b6db --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScalarAnyOf.java @@ -0,0 +1,174 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import java.util.UUID; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ScalarAnyOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ScalarAnyOf.class.getName()); + + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public ScalarAnyOf() { + super("anyOf", Boolean.FALSE); + } + + public ScalarAnyOf(BigDecimal o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarAnyOf(Boolean o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarAnyOf(String o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarAnyOf(UUID o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("BigDecimal", BigDecimal.class); + schemas.put("Boolean", Boolean.class); + schemas.put("String", String.class); + schemas.put("UUID", UUID.class); + } + + @Override + public Map> getSchemas() { + return ScalarAnyOf.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * BigDecimal, Boolean, String, UUID + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(BigDecimal.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Boolean.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UUID.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BigDecimal, Boolean, String, UUID"); + } + + /** + * Get the actual instance, which can be the following: + * BigDecimal, Boolean, String, UUID + * + * @return The actual instance (BigDecimal, Boolean, String, UUID) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BigDecimal`. If the actual instance is not `BigDecimal`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BigDecimal` + * @throws ClassCastException if the instance is not `BigDecimal` + */ + public BigDecimal getBigDecimal() throws ClassCastException { + return (BigDecimal)super.getActualInstance(); + } + + /** + * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Boolean` + * @throws ClassCastException if the instance is not `Boolean` + */ + public Boolean getBoolean() throws ClassCastException { + return (Boolean)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + /** + * Get the actual instance of `UUID`. If the actual instance is not `UUID`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UUID` + * @throws ClassCastException if the instance is not `UUID` + */ + public UUID getUUID() throws ClassCastException { + return (UUID)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScaleneTriangle.java new file mode 100644 index 000000000000..6e7714f48522 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScaleneTriangle.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ScaleneTriangle + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ScaleneTriangle { + public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; + @JsonbProperty(SERIALIZED_NAME_SHAPE_TYPE) + @jakarta.annotation.Nonnull + private String shapeType; + + public static final String SERIALIZED_NAME_TRIANGLE_TYPE = "triangleType"; + @JsonbProperty(SERIALIZED_NAME_TRIANGLE_TYPE) + @jakarta.annotation.Nonnull + private String triangleType; + + public ScaleneTriangle() { + } + + public ScaleneTriangle shapeType(@jakarta.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @jakarta.annotation.Nonnull + + public String getShapeType() { + return shapeType; + } + + public void setShapeType(@jakarta.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public ScaleneTriangle triangleType(@jakarta.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @jakarta.annotation.Nonnull + + public String getTriangleType() { + return triangleType; + } + + public void setTriangleType(@jakarta.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ScaleneTriangle instance itself + */ + public ScaleneTriangle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Shape.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Shape.java new file mode 100644 index 000000000000..64282b8b346a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Shape.java @@ -0,0 +1,130 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Shape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Shape.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final 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", Quadrilateral.class); + schemas.put("Triangle", Triangle.class); + } + + @Override + public Map> getSchemas() { + return Shape.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeInterface.java new file mode 100644 index 000000000000..627aad206277 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ShapeInterface + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ShapeInterface { + public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; + @JsonbProperty(SERIALIZED_NAME_SHAPE_TYPE) + @jakarta.annotation.Nonnull + private String shapeType; + + public ShapeInterface() { + } + + public ShapeInterface shapeType(@jakarta.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @jakarta.annotation.Nonnull + + public String getShapeType() { + return shapeType; + } + + public void setShapeType(@jakarta.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ShapeInterface instance itself + */ + public ShapeInterface putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShapeInterface {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeOrNull.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeOrNull.java new file mode 100644 index 000000000000..4662fb2245a1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeOrNull.java @@ -0,0 +1,135 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ShapeOrNull extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ShapeOrNull.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final 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", Quadrilateral.class); + schemas.put("Triangle", Triangle.class); + } + + @Override + public Map> getSchemas() { + return ShapeOrNull.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java new file mode 100644 index 000000000000..d50ab340fe18 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SimpleQuadrilateral + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class SimpleQuadrilateral { + public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; + @JsonbProperty(SERIALIZED_NAME_SHAPE_TYPE) + @jakarta.annotation.Nonnull + private String shapeType; + + public static final String SERIALIZED_NAME_QUADRILATERAL_TYPE = "quadrilateralType"; + @JsonbProperty(SERIALIZED_NAME_QUADRILATERAL_TYPE) + @jakarta.annotation.Nonnull + private String quadrilateralType; + + public SimpleQuadrilateral() { + } + + public SimpleQuadrilateral shapeType(@jakarta.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @jakarta.annotation.Nonnull + + public String getShapeType() { + return shapeType; + } + + public void setShapeType(@jakarta.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public SimpleQuadrilateral quadrilateralType(@jakarta.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + */ + @jakarta.annotation.Nonnull + + public String getQuadrilateralType() { + return quadrilateralType; + } + + public void setQuadrilateralType(@jakarta.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SimpleQuadrilateral instance itself + */ + public SimpleQuadrilateral putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SpecialModelName.java new file mode 100644 index 000000000000..990bd344d2df --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SpecialModelName.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SpecialModelName + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class SpecialModelName { + public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + @JsonbProperty(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) + @jakarta.annotation.Nullable + private Long $specialPropertyName; + + public static final String SERIALIZED_NAME_SPECIAL_MODEL_NAME = "_special_model.name_"; + @JsonbProperty(SERIALIZED_NAME_SPECIAL_MODEL_NAME) + @jakarta.annotation.Nullable + private String specialModelName; + + public SpecialModelName() { + } + + public SpecialModelName $specialPropertyName(@jakarta.annotation.Nullable Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + */ + @jakarta.annotation.Nullable + + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + public void set$SpecialPropertyName(@jakarta.annotation.Nullable Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + public SpecialModelName specialModelName(@jakarta.annotation.Nullable String specialModelName) { + this.specialModelName = specialModelName; + return this; + } + + /** + * Get specialModelName + * @return specialModelName + */ + @jakarta.annotation.Nullable + + public String getSpecialModelName() { + return specialModelName; + } + + public void setSpecialModelName(@jakarta.annotation.Nullable String specialModelName) { + this.specialModelName = specialModelName; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SpecialModelName instance itself + */ + public SpecialModelName putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append(" specialModelName: ").append(toIndentedString(specialModelName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("$special[property.name]", "_special_model.name_")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..d7f20cbc2633 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Tag.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Tag + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Tag { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@jakarta.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java new file mode 100644 index 000000000000..2dd73e4cea8e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TestInlineFreeformAdditionalPropertiesRequest + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class TestInlineFreeformAdditionalPropertiesRequest { + public static final String SERIALIZED_NAME_SOME_PROPERTY = "someProperty"; + @JsonbProperty(SERIALIZED_NAME_SOME_PROPERTY) + @jakarta.annotation.Nullable + private String someProperty; + + public TestInlineFreeformAdditionalPropertiesRequest() { + } + + public TestInlineFreeformAdditionalPropertiesRequest someProperty(@jakarta.annotation.Nullable String someProperty) { + this.someProperty = someProperty; + return this; + } + + /** + * Get someProperty + * @return someProperty + */ + @jakarta.annotation.Nullable + + public String getSomeProperty() { + return someProperty; + } + + public void setSomeProperty(@jakarta.annotation.Nullable String someProperty) { + this.someProperty = someProperty; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TestInlineFreeformAdditionalPropertiesRequest instance itself + */ + public TestInlineFreeformAdditionalPropertiesRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); + sb.append(" someProperty: ").append(toIndentedString(someProperty)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("someProperty")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Triangle.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Triangle.java new file mode 100644 index 000000000000..3f8814efeef5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Triangle.java @@ -0,0 +1,153 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.EquilateralTriangle; +import org.openapitools.client.model.IsoscelesTriangle; +import org.openapitools.client.model.ScaleneTriangle; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Triangle extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Triangle.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final 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", EquilateralTriangle.class); + schemas.put("IsoscelesTriangle", IsoscelesTriangle.class); + schemas.put("ScaleneTriangle", ScaleneTriangle.class); + } + + @Override + public Map> getSchemas() { + return Triangle.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(EquilateralTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(IsoscelesTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(ScaleneTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle"); + } + + /** + * Get the actual instance, which can be the following: + * EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle + * + * @return The actual instance (EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `EquilateralTriangle`. If the actual instance is not `EquilateralTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EquilateralTriangle` + * @throws ClassCastException if the instance is not `EquilateralTriangle` + */ + public EquilateralTriangle getEquilateralTriangle() throws ClassCastException { + return (EquilateralTriangle)super.getActualInstance(); + } + + /** + * Get the actual instance of `IsoscelesTriangle`. If the actual instance is not `IsoscelesTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `IsoscelesTriangle` + * @throws ClassCastException if the instance is not `IsoscelesTriangle` + */ + public IsoscelesTriangle getIsoscelesTriangle() throws ClassCastException { + return (IsoscelesTriangle)super.getActualInstance(); + } + + /** + * Get the actual instance of `ScaleneTriangle`. If the actual instance is not `ScaleneTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ScaleneTriangle` + * @throws ClassCastException if the instance is not `ScaleneTriangle` + */ + public ScaleneTriangle getScaleneTriangle() throws ClassCastException { + return (ScaleneTriangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TriangleInterface.java new file mode 100644 index 000000000000..562ca8bef641 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -0,0 +1,152 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TriangleInterface + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class TriangleInterface { + public static final String SERIALIZED_NAME_TRIANGLE_TYPE = "triangleType"; + @JsonbProperty(SERIALIZED_NAME_TRIANGLE_TYPE) + @jakarta.annotation.Nonnull + private String triangleType; + + public TriangleInterface() { + } + + public TriangleInterface triangleType(@jakarta.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @jakarta.annotation.Nonnull + + public String getTriangleType() { + return triangleType; + } + + public void setTriangleType(@jakarta.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TriangleInterface instance itself + */ + public TriangleInterface putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TriangleInterface {\n"); + sb.append(" triangleType: ").append(toIndentedString(triangleType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("triangleType")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..47131a8b9b29 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,450 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * User + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class User { + public static final String SERIALIZED_NAME_ID = "id"; + @JsonbProperty(SERIALIZED_NAME_ID) + @jakarta.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @JsonbProperty(SERIALIZED_NAME_USERNAME) + @jakarta.annotation.Nullable + private String username; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @JsonbProperty(SERIALIZED_NAME_FIRST_NAME) + @jakarta.annotation.Nullable + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @JsonbProperty(SERIALIZED_NAME_LAST_NAME) + @jakarta.annotation.Nullable + private String lastName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @JsonbProperty(SERIALIZED_NAME_EMAIL) + @jakarta.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @JsonbProperty(SERIALIZED_NAME_PASSWORD) + @jakarta.annotation.Nullable + private String password; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @JsonbProperty(SERIALIZED_NAME_PHONE) + @jakarta.annotation.Nullable + private String phone; + + public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; + @JsonbProperty(SERIALIZED_NAME_USER_STATUS) + @jakarta.annotation.Nullable + private Integer userStatus; + + public static final String SERIALIZED_NAME_OBJECT_WITH_NO_DECLARED_PROPS = "objectWithNoDeclaredProps"; + @JsonbProperty(SERIALIZED_NAME_OBJECT_WITH_NO_DECLARED_PROPS) + @jakarta.annotation.Nullable + private Object objectWithNoDeclaredProps; + + public static final String SERIALIZED_NAME_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE = "objectWithNoDeclaredPropsNullable"; + @JsonbProperty(SERIALIZED_NAME_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE) + @jakarta.annotation.Nullable + private Object objectWithNoDeclaredPropsNullable; + + public static final String SERIALIZED_NAME_ANY_TYPE_PROP = "anyTypeProp"; + @JsonbProperty(SERIALIZED_NAME_ANY_TYPE_PROP) + @jakarta.annotation.Nullable + private Object anyTypeProp = null; + + public static final String SERIALIZED_NAME_ANY_TYPE_PROP_NULLABLE = "anyTypePropNullable"; + @JsonbProperty(SERIALIZED_NAME_ANY_TYPE_PROP_NULLABLE) + @jakarta.annotation.Nullable + private Object anyTypePropNullable = null; + + public User() { + } + + public User id(@jakarta.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @jakarta.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@jakarta.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@jakarta.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @jakarta.annotation.Nullable + + public String getUsername() { + return username; + } + + public void setUsername(@jakarta.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@jakarta.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @jakarta.annotation.Nullable + + public String getFirstName() { + return firstName; + } + + public void setFirstName(@jakarta.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@jakarta.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @jakarta.annotation.Nullable + + public String getLastName() { + return lastName; + } + + public void setLastName(@jakarta.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@jakarta.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @jakarta.annotation.Nullable + + public String getEmail() { + return email; + } + + public void setEmail(@jakarta.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@jakarta.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @jakarta.annotation.Nullable + + public String getPassword() { + return password; + } + + public void setPassword(@jakarta.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@jakarta.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @jakarta.annotation.Nullable + + public String getPhone() { + return phone; + } + + public void setPhone(@jakarta.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@jakarta.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @jakarta.annotation.Nullable + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(@jakarta.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + + public User objectWithNoDeclaredProps(@jakarta.annotation.Nullable 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 + */ + @jakarta.annotation.Nullable + + public Object getObjectWithNoDeclaredProps() { + return objectWithNoDeclaredProps; + } + + public void setObjectWithNoDeclaredProps(@jakarta.annotation.Nullable Object objectWithNoDeclaredProps) { + this.objectWithNoDeclaredProps = objectWithNoDeclaredProps; + } + + + public User objectWithNoDeclaredPropsNullable(@jakarta.annotation.Nullable Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + return this; + } + + /** + * test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + * @return objectWithNoDeclaredPropsNullable + */ + @jakarta.annotation.Nullable + + public Object getObjectWithNoDeclaredPropsNullable() { + return objectWithNoDeclaredPropsNullable; + } + + public void setObjectWithNoDeclaredPropsNullable(@jakarta.annotation.Nullable Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + } + + + public User anyTypeProp(@jakarta.annotation.Nullable Object anyTypeProp) { + this.anyTypeProp = 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 + */ + @jakarta.annotation.Nullable + + public Object getAnyTypeProp() { + return anyTypeProp; + } + + public void setAnyTypeProp(@jakarta.annotation.Nullable Object anyTypeProp) { + this.anyTypeProp = anyTypeProp; + } + + + public User anyTypePropNullable(@jakarta.annotation.Nullable Object anyTypePropNullable) { + this.anyTypePropNullable = 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 + */ + @jakarta.annotation.Nullable + + public Object getAnyTypePropNullable() { + return anyTypePropNullable; + } + + public void setAnyTypePropNullable(@jakarta.annotation.Nullable Object anyTypePropNullable) { + this.anyTypePropNullable = anyTypePropNullable; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus", "objectWithNoDeclaredProps", "objectWithNoDeclaredPropsNullable", "anyTypeProp", "anyTypePropNullable")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Value.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Value.java new file mode 100644 index 000000000000..be6b4ca0d414 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Value.java @@ -0,0 +1,130 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; +import org.openapitools.client.model.Scalar; + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Value extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Value.class.getName()); + + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Value() { + super("oneOf", Boolean.FALSE); + } + + public Value(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Value(Scalar o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List", List.class); + schemas.put("Scalar", Scalar.class); + } + + @Override + public Map> getSchemas() { + return Value.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * List, Scalar + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Scalar.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List, Scalar"); + } + + /** + * Get the actual instance, which can be the following: + * List, Scalar + * + * @return The actual instance (List, Scalar) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Get the actual instance of `Scalar`. If the actual instance is not `Scalar`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Scalar` + * @throws ClassCastException if the instance is not `Scalar` + */ + public Scalar getScalar() throws ClassCastException { + return (Scalar)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Variable.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Variable.java new file mode 100644 index 000000000000..d5c16a4e5ae6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Variable.java @@ -0,0 +1,179 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import org.openapitools.client.model.Value; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Value object + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Variable { + public static final String SERIALIZED_NAME_NAME = "name"; + @JsonbProperty(SERIALIZED_NAME_NAME) + @jakarta.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @JsonbProperty(SERIALIZED_NAME_VALUE) + @jakarta.annotation.Nonnull + private Value value; + + public Variable() { + } + + public Variable name(@jakarta.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @jakarta.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@jakarta.annotation.Nonnull String name) { + this.name = name; + } + + + public Variable value(@jakarta.annotation.Nonnull Value value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @jakarta.annotation.Nonnull + + public Value getValue() { + return value; + } + + public void setValue(@jakarta.annotation.Nonnull Value value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Variable instance itself + */ + public Variable putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Variable {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "value")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Whale.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Whale.java new file mode 100644 index 000000000000..4e53b92a932c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Whale.java @@ -0,0 +1,204 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Whale + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Whale { + public static final String SERIALIZED_NAME_HAS_BALEEN = "hasBaleen"; + @JsonbProperty(SERIALIZED_NAME_HAS_BALEEN) + @jakarta.annotation.Nullable + private Boolean hasBaleen; + + public static final String SERIALIZED_NAME_HAS_TEETH = "hasTeeth"; + @JsonbProperty(SERIALIZED_NAME_HAS_TEETH) + @jakarta.annotation.Nullable + private Boolean hasTeeth; + + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @JsonbProperty(SERIALIZED_NAME_CLASS_NAME) + @jakarta.annotation.Nonnull + private String className; + + public Whale() { + } + + public Whale hasBaleen(@jakarta.annotation.Nullable Boolean hasBaleen) { + this.hasBaleen = hasBaleen; + return this; + } + + /** + * Get hasBaleen + * @return hasBaleen + */ + @jakarta.annotation.Nullable + + public Boolean getHasBaleen() { + return hasBaleen; + } + + public void setHasBaleen(@jakarta.annotation.Nullable Boolean hasBaleen) { + this.hasBaleen = hasBaleen; + } + + + public Whale hasTeeth(@jakarta.annotation.Nullable Boolean hasTeeth) { + this.hasTeeth = hasTeeth; + return this; + } + + /** + * Get hasTeeth + * @return hasTeeth + */ + @jakarta.annotation.Nullable + + public Boolean getHasTeeth() { + return hasTeeth; + } + + public void setHasTeeth(@jakarta.annotation.Nullable Boolean hasTeeth) { + this.hasTeeth = hasTeeth; + } + + + public Whale className(@jakarta.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @jakarta.annotation.Nonnull + + public String getClassName() { + return className; + } + + public void setClassName(@jakarta.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Whale instance itself + */ + public Whale putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("hasBaleen", "hasTeeth", "className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Zebra.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Zebra.java new file mode 100644 index 000000000000..7f3af51fd761 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Zebra.java @@ -0,0 +1,216 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import jakarta.json.bind.annotation.JsonbProperty; +import jakarta.json.bind.annotation.JsonbCreator; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Zebra + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Zebra { + /** + * Gets or Sets type + */ + public enum TypeEnum { + PLAINS("plains"), + + MOUNTAIN("mountain"), + + GREVYS("grevys"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonbValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonbCreator + 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 SERIALIZED_NAME_TYPE = "type"; + @JsonbProperty(SERIALIZED_NAME_TYPE) + @jakarta.annotation.Nullable + private TypeEnum type; + + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @JsonbProperty(SERIALIZED_NAME_CLASS_NAME) + @jakarta.annotation.Nonnull + private String className; + + public Zebra() { + } + + public Zebra type(@jakarta.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @jakarta.annotation.Nullable + + public TypeEnum getType() { + return type; + } + + public void setType(@jakarta.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public Zebra className(@jakarta.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @jakarta.annotation.Nonnull + + public String getClassName() { + return className; + } + + public void setClassName(@jakarta.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Zebra instance itself + */ + public Zebra putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Zebra {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("type", "className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + +} + diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java new file mode 100644 index 000000000000..face3d9b785e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -0,0 +1,73 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AnotherFakeApi + */ +@Disabled +public class AnotherFakeApiTest { + + private final AnotherFakeApi api = new AnotherFakeApi(); + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + * + * @throws ApiException if the Api call fails + */ + @Test + public void call123testSpecialTagsTest() throws ApiException { + Client client = null; + Client response = api.call123testSpecialTags(client); + // TODO: test validations + } + + /** + * parameter array number default value + * + * @throws ApiException if the Api call fails + */ + @Test + public void getParameterArrayNumberTest() throws ApiException { + List array = null; + api.getParameterArrayNumber(array); + // TODO: test validations + } + + /** + * parameter string number + * + * @throws ApiException if the Api call fails + */ + @Test + public void getParameterStringNumberTest() throws ApiException { + BigDecimal stringNumber = null; + api.getParameterStringNumber(stringNumber); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/DefaultApiTest.java new file mode 100644 index 000000000000..9dbc195b0857 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -0,0 +1,78 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.FakeAnyOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FakeOneOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FooGetDefaultResponse; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for DefaultApi + */ +@Disabled +public class DefaultApiTest { + + private final DefaultApi api = new DefaultApi(); + + /** + * Test route, this shouldn't cause a compiler error + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeAnyOfWIthSameErasureGetTest() throws ApiException { + FakeAnyOfWIthSameErasureGet200Response response = api.fakeAnyOfWIthSameErasureGet(); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fakeFreeFormQueryParametersGetTest() throws ApiException { + String fixed = null; + Object freeForm = null; + api.fakeFreeFormQueryParametersGet(fixed, freeForm); + // TODO: test validations + } + + /** + * Test route, this shouldn't cause a compiler error + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOneOfWIthSameErasureGetTest() throws ApiException { + FakeOneOfWIthSameErasureGet200Response response = api.fakeOneOfWIthSameErasureGet(); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fooGetTest() throws ApiException { + FooGetDefaultResponse response = api.fooGet(); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 000000000000..095dfdcd2304 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,395 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import org.openapitools.client.model.FakeRefParameterPetIdParameter; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.FreeFormObjectTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.NullableFieldsMapResponse; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.RequiredNullableBody; +import org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +@Disabled +public class FakeApiTest { + + private final FakeApi api = new FakeApi(); + + /** + * Get a free form object or Json string + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeGetFreeFormObjectGetTest() throws ApiException { + FreeFormObjectTestClass response = api.fakeGetFreeFormObjectGet(); + // TODO: test validations + } + + /** + * Test serialization of outer boolean types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterBooleanSerializeTest() throws ApiException { + Boolean body = null; + Boolean response = api.fakeOuterBooleanSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of object with outer number type + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterCompositeSerializeTest() throws ApiException { + OuterComposite outerComposite = null; + OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite); + // TODO: test validations + } + + /** + * Test serialization of outer number types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterNumberSerializeTest() throws ApiException { + BigDecimal body = null; + BigDecimal response = api.fakeOuterNumberSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of outer string types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterStringSerializeTest() throws ApiException { + String body = null; + String response = api.fakeOuterStringSerialize(body); + // TODO: test validations + } + + /** + * fake reference parameter + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeRefParameterTest() throws ApiException { + FakeRefParameterPetIdParameter petId = null; + api.fakeRefParameter(petId); + // TODO: test validations + } + + /** + * fields in the response body, required and nullable are both true + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeRequiredNullableBodyGetTest() throws ApiException { + RequiredNullableBody response = api.fakeRequiredNullableBodyGet(); + // TODO: test validations + } + + /** + * fake reference parameter + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeUploadRefRequestBodiesTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.fakeUploadRefRequestBodies(petId, additionalMetadata, _file); + // TODO: test validations + } + + /** + * Array of Enums + * + * @throws ApiException if the Api call fails + */ + @Test + public void getFakeArrayofenumsTest() throws ApiException { + List response = api.getFakeArrayofenums(); + // TODO: test validations + } + + /** + * Health check endpoint + * + * @throws ApiException if the Api call fails + */ + @Test + public void getFakeHealthTest() throws ApiException { + HealthCheckResult response = api.getFakeHealth(); + // TODO: test validations + } + + /** + * parameter name mapping test + * + * @throws ApiException if the Api call fails + */ + @Test + public void getParameterNameMappingTest() throws ApiException { + Long underscoreType = null; + String type = null; + String typeWithUnderscore = null; + api.getParameterNameMapping(underscoreType, type, typeWithUnderscore); + // TODO: test validations + } + + /** + * test referenced additionalProperties + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testAdditionalPropertiesReferenceTest() throws ApiException { + Map requestBody = null; + api.testAdditionalPropertiesReference(requestBody); + // TODO: test validations + } + + /** + * For this test, the body for this request much reference a schema named `File`. + * + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithFileSchemaTest() throws ApiException { + FileSchemaTestClass fileSchemaTestClass = null; + api.testBodyWithFileSchema(fileSchemaTestClass); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithQueryParamsTest() throws ApiException { + String query = null; + User user = null; + api.testBodyWithQueryParams(query, user); + // TODO: test validations + } + + /** + * To test \"client\" model + * + * To test \"client\" model + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClientModelTest() throws ApiException { + Client client = null; + Client response = api.testClientModel(client); + // TODO: test validations + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEndpointParametersTest() throws ApiException { + BigDecimal number = null; + Double _double = null; + String patternWithoutDelimiter = null; + byte[] _byte = null; + Integer integer = null; + Integer int32 = null; + Long int64 = null; + Float _float = null; + String string = null; + File binary = null; + LocalDate date = null; + OffsetDateTime dateTime = null; + String password = null; + String paramCallback = null; + api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + // TODO: test validations + } + + /** + * To test enum parameters + * + * To test enum parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEnumParametersTest() throws ApiException { + List enumHeaderStringArray = null; + String enumHeaderString = null; + List enumQueryStringArray = null; + String enumQueryString = null; + Integer enumQueryInteger = null; + Double enumQueryDouble = null; + List enumFormStringArray = null; + String enumFormString = null; + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + // TODO: test validations + } + + /** + * Fake endpoint to test group parameters (optional) + * + * Fake endpoint to test group parameters (optional) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testGroupParametersTest() throws ApiException { + Integer requiredStringGroup = null; + Boolean requiredBooleanGroup = null; + Long requiredInt64Group = null; + Integer stringGroup = null; + Boolean booleanGroup = null; + Long int64Group = null; + api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + // TODO: test validations + } + + /** + * test inline additionalProperties + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testInlineAdditionalPropertiesTest() throws ApiException { + Map requestBody = null; + api.testInlineAdditionalProperties(requestBody); + // TODO: test validations + } + + /** + * test inline free-form additionalProperties + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testInlineFreeformAdditionalPropertiesTest() throws ApiException { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = null; + api.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + // TODO: test validations + } + + /** + * test json serialization of form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testJsonFormDataTest() throws ApiException { + String param = null; + String param2 = null; + api.testJsonFormData(param, param2); + // TODO: test validations + } + + /** + * test anyOf with map of objects containing nullable required fields + * + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testNullableRequiredFieldsAnyOfTest() throws ApiException { + NullableFieldsMapResponse response = api.testNullableRequiredFieldsAnyOf(); + // TODO: test validations + } + + /** + * To test the collection format in query parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryParameterCollectionFormatTest() throws ApiException { + List pipe = null; + List ioutil = null; + List http = null; + List url = null; + List context = null; + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + // TODO: test validations + } + + /** + * test referenced string map + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testStringMapReferenceTest() throws ApiException { + Map requestBody = null; + api.testStringMapReference(requestBody); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 000000000000..aa1b824dd5a2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Client; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Disabled +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + /** + * To test class name in snake case + * + * To test class name in snake case + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + Client client = null; + Client response = api.testClassname(client); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..a1d3d6377d68 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,170 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + api.addPet(pet); + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + api.updatePet(pet); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String contentType = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.uploadFile(petId, contentType, additionalMetadata, _file); + // TODO: test validations + } + + /** + * uploads an image (required) + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileWithRequiredFileTest() throws ApiException { + Long petId = null; + File requiredFile = null; + String additionalMetadata = null; + ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..98354ba10c08 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,89 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = api.getOrderById(orderId); + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order order = null; + Order response = api.placeOrder(order); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..aa9aff49b4df --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,148 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User user = null; + api.createUser(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List user = null; + api.createUsersWithArrayInput(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List user = null; + api.createUsersWithListInput(user); + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + api.deleteUser(username); + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + api.logoutUser(); + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User user = null; + api.updateUser(username, user); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/ValuesApiTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/ValuesApiTest.java new file mode 100644 index 000000000000..89a1ad0febc4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/api/ValuesApiTest.java @@ -0,0 +1,47 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Variable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for ValuesApi + */ +@Disabled +public class ValuesApiTest { + + private final ValuesApi api = new ValuesApi(); + + /** + * Get some primitive variable values + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getSomeValuesTest() throws ApiException { + Variable response = api.getSomeValues(); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..5bbd22fb4e8b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java @@ -0,0 +1,100 @@ +/* + * 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.HashMap; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesClass + */ +public class AdditionalPropertiesClassTest { + private final AdditionalPropertiesClass model = new AdditionalPropertiesClass(); + + /** + * Model tests for AdditionalPropertiesClass + */ + @Test + public void testAdditionalPropertiesClass() { + // TODO: test AdditionalPropertiesClass + } + + /** + * Test the property 'mapProperty' + */ + @Test + public void mapPropertyTest() { + // TODO: test mapProperty + } + + /** + * Test the property 'mapOfMapProperty' + */ + @Test + public void mapOfMapPropertyTest() { + // TODO: test mapOfMapProperty + } + + /** + * Test the property 'anytype1' + */ + @Test + public void anytype1Test() { + // TODO: test anytype1 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype1' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype1Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype1 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype2' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype2Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype2 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype3' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype3Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype3 + } + + /** + * Test the property 'emptyMap' + */ + @Test + public void emptyMapTest() { + // TODO: test emptyMap + } + + /** + * Test the property 'mapWithUndeclaredPropertiesString' + */ + @Test + public void mapWithUndeclaredPropertiesStringTest() { + // TODO: test mapWithUndeclaredPropertiesString + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java new file mode 100644 index 000000000000..8057bfb589b9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java @@ -0,0 +1,121 @@ +/* + * 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.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Order; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfAttributesC + */ +public class AllOfModelArrayAnyOfAllOfAttributesCTest { + private final AllOfModelArrayAnyOfAllOfAttributesC model = new AllOfModelArrayAnyOfAllOfAttributesC(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfAttributesC + */ + @Test + public void testAllOfModelArrayAnyOfAllOfAttributesC() { + // TODO: test AllOfModelArrayAnyOfAllOfAttributesC + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java new file mode 100644 index 000000000000..50a5725e6d7e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java @@ -0,0 +1,42 @@ +/* + * 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.model.AllOfModelArrayAnyOfAllOfAttributesC; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfAttributes + */ +public class AllOfModelArrayAnyOfAllOfAttributesTest { + private final AllOfModelArrayAnyOfAllOfAttributes model = new AllOfModelArrayAnyOfAllOfAttributes(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfAttributes + */ + @Test + public void testAllOfModelArrayAnyOfAllOfAttributes() { + // TODO: test AllOfModelArrayAnyOfAllOfAttributes + } + + /** + * Test the property 'C' + */ + @Test + public void CTest() { + // TODO: test C + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java new file mode 100644 index 000000000000..10f8fef69921 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java @@ -0,0 +1,45 @@ +/* + * 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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1Value; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ +public class AllOfModelArrayAnyOfAllOfLinkListColumn1Test { + private final AllOfModelArrayAnyOfAllOfLinkListColumn1 model = new AllOfModelArrayAnyOfAllOfLinkListColumn1(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ + @Test + public void testAllOfModelArrayAnyOfAllOfLinkListColumn1() { + // TODO: test AllOfModelArrayAnyOfAllOfLinkListColumn1 + } + + /** + * Test the property 'value' + */ + @Test + public void valueTest() { + // TODO: test value + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java new file mode 100644 index 000000000000..c92805131e90 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java @@ -0,0 +1,140 @@ +/* + * 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.model.Tag; +import org.openapitools.client.model.User; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1Value + */ +public class AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest { + private final AllOfModelArrayAnyOfAllOfLinkListColumn1Value model = new AllOfModelArrayAnyOfAllOfLinkListColumn1Value(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1Value + */ + @Test + public void testAllOfModelArrayAnyOfAllOfLinkListColumn1Value() { + // TODO: test AllOfModelArrayAnyOfAllOfLinkListColumn1Value + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + + /** + * Test the property 'objectWithNoDeclaredProps' + */ + @Test + public void objectWithNoDeclaredPropsTest() { + // TODO: test objectWithNoDeclaredProps + } + + /** + * Test the property 'objectWithNoDeclaredPropsNullable' + */ + @Test + public void objectWithNoDeclaredPropsNullableTest() { + // TODO: test objectWithNoDeclaredPropsNullable + } + + /** + * Test the property 'anyTypeProp' + */ + @Test + public void anyTypePropTest() { + // TODO: test anyTypeProp + } + + /** + * Test the property 'anyTypePropNullable' + */ + @Test + public void anyTypePropNullableTest() { + // TODO: test anyTypePropNullable + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java new file mode 100644 index 000000000000..2b38cc462b79 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributes; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOf + */ +public class AllOfModelArrayAnyOfTest { + private final AllOfModelArrayAnyOf model = new AllOfModelArrayAnyOf(); + + /** + * Model tests for AllOfModelArrayAnyOf + */ + @Test + public void testAllOfModelArrayAnyOf() { + // TODO: test AllOfModelArrayAnyOf + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'linkListColumn1' + */ + @Test + public void linkListColumn1Test() { + // TODO: test linkListColumn1 + } + + /** + * Test the property 'attributes' + */ + @Test + public void attributesTest() { + // TODO: test attributes + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java new file mode 100644 index 000000000000..d881638d1c8f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToDouble + */ +public class AllOfRefToDoubleTest { + private final AllOfRefToDouble model = new AllOfRefToDouble(); + + /** + * Model tests for AllOfRefToDouble + */ + @Test + public void testAllOfRefToDouble() { + // TODO: test AllOfRefToDouble + } + + /** + * Test the property 'height' + */ + @Test + public void heightTest() { + // TODO: test height + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java new file mode 100644 index 000000000000..efdf86999114 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToFloat + */ +public class AllOfRefToFloatTest { + private final AllOfRefToFloat model = new AllOfRefToFloat(); + + /** + * Model tests for AllOfRefToFloat + */ + @Test + public void testAllOfRefToFloat() { + // TODO: test AllOfRefToFloat + } + + /** + * Test the property 'weight' + */ + @Test + public void weightTest() { + // TODO: test weight + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java new file mode 100644 index 000000000000..65148202fbc6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToLong + */ +public class AllOfRefToLongTest { + private final AllOfRefToLong model = new AllOfRefToLong(); + + /** + * Model tests for AllOfRefToLong + */ + @Test + public void testAllOfRefToLong() { + // TODO: test AllOfRefToLong + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AnimalTest.java new file mode 100644 index 000000000000..8da0e95590f5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Animal + */ +public class AnimalTest { + private final Animal model = new Animal(); + + /** + * Model tests for Animal + */ + @Test + public void testAnimal() { + // TODO: test Animal + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AppleReqTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AppleReqTest.java new file mode 100644 index 000000000000..c8926998f651 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AppleReqTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AppleReq + */ +public class AppleReqTest { + private final AppleReq model = new AppleReq(); + + /** + * Model tests for AppleReq + */ + @Test + public void testAppleReq() { + // TODO: test AppleReq + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'mealy' + */ + @Test + public void mealyTest() { + // TODO: test mealy + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AppleTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AppleTest.java new file mode 100644 index 000000000000..6a517df1d794 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/AppleTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Apple + */ +public class AppleTest { + private final Apple model = new Apple(); + + /** + * Model tests for Apple + */ + @Test + public void testApple() { + // TODO: test Apple + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java new file mode 100644 index 000000000000..ab635fd6b72f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java @@ -0,0 +1,34 @@ +/* + * 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.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayAnyOf + */ +public class ArrayAnyOfTest { + private final ArrayAnyOf model = new ArrayAnyOf(); + + /** + * Model tests for ArrayAnyOf + */ + @Test + public void testArrayAnyOf() { + // TODO: test ArrayAnyOf + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java new file mode 100644 index 000000000000..254b4cf79bea --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java @@ -0,0 +1,52 @@ +/* + * 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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayDefault + */ +public class ArrayDefaultTest { + private final ArrayDefault model = new ArrayDefault(); + + /** + * Model tests for ArrayDefault + */ + @Test + public void testArrayDefault() { + // TODO: test ArrayDefault + } + + /** + * Test the property 'withDefaultEmptyBracket' + */ + @Test + public void withDefaultEmptyBracketTest() { + // TODO: test withDefaultEmptyBracket + } + + /** + * Test the property 'withoutDefault' + */ + @Test + public void withoutDefaultTest() { + // TODO: test withoutDefault + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..3c271c885dae --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -0,0 +1,45 @@ +/* + * 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.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfArrayOfNumberOnly + */ +public class ArrayOfArrayOfNumberOnlyTest { + private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfArrayOfNumberOnly + */ + @Test + public void testArrayOfArrayOfNumberOnly() { + // TODO: test ArrayOfArrayOfNumberOnly + } + + /** + * Test the property 'arrayArrayNumber' + */ + @Test + public void arrayArrayNumberTest() { + // TODO: test arrayArrayNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java new file mode 100644 index 000000000000..b5ebba504779 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ +public class ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest { + private final ArrayOfInlineAllOfArrayAllofDogPropertyInner model = new ArrayOfInlineAllOfArrayAllofDogPropertyInner(); + + /** + * Model tests for ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ + @Test + public void testArrayOfInlineAllOfArrayAllofDogPropertyInner() { + // TODO: test ArrayOfInlineAllOfArrayAllofDogPropertyInner + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java new file mode 100644 index 000000000000..ccf768187159 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.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.model; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ArrayOfInlineAllOfArrayAllofDogPropertyInner; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfInlineAllOf + */ +public class ArrayOfInlineAllOfTest { + private final ArrayOfInlineAllOf model = new ArrayOfInlineAllOf(); + + /** + * Model tests for ArrayOfInlineAllOf + */ + @Test + public void testArrayOfInlineAllOf() { + // TODO: test ArrayOfInlineAllOf + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'arrayAllofDogProperty' + */ + @Test + public void arrayAllofDogPropertyTest() { + // TODO: test arrayAllofDogProperty + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..623331dfeaa1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java @@ -0,0 +1,45 @@ +/* + * 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.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfNumberOnly + */ +public class ArrayOfNumberOnlyTest { + private final ArrayOfNumberOnly model = new ArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfNumberOnly + */ + @Test + public void testArrayOfNumberOnly() { + // TODO: test ArrayOfNumberOnly + } + + /** + * Test the property 'arrayNumber' + */ + @Test + public void arrayNumberTest() { + // TODO: test arrayNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java new file mode 100644 index 000000000000..7f9af8d893c0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java @@ -0,0 +1,34 @@ +/* + * 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.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOneOf + */ +public class ArrayOneOfTest { + private final ArrayOneOf model = new ArrayOneOf(); + + /** + * Model tests for ArrayOneOf + */ + @Test + public void testArrayOneOf() { + // TODO: test ArrayOneOf + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayTestTest.java new file mode 100644 index 000000000000..06c2ab168701 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ArrayTestTest.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.model; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayTest + */ +public class ArrayTestTest { + private final ArrayTest model = new ArrayTest(); + + /** + * Model tests for ArrayTest + */ + @Test + public void testArrayTest() { + // TODO: test ArrayTest + } + + /** + * Test the property 'arrayOfString' + */ + @Test + public void arrayOfStringTest() { + // TODO: test arrayOfString + } + + /** + * Test the property 'arrayArrayOfInteger' + */ + @Test + public void arrayArrayOfIntegerTest() { + // TODO: test arrayArrayOfInteger + } + + /** + * Test the property 'arrayArrayOfModel' + */ + @Test + public void arrayArrayOfModelTest() { + // TODO: test arrayArrayOfModel + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/BananaReqTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/BananaReqTest.java new file mode 100644 index 000000000000..9b2cf886d8c0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/BananaReqTest.java @@ -0,0 +1,50 @@ +/* + * 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.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BananaReq + */ +public class BananaReqTest { + private final BananaReq model = new BananaReq(); + + /** + * Model tests for BananaReq + */ + @Test + public void testBananaReq() { + // TODO: test BananaReq + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + + /** + * Test the property 'sweet' + */ + @Test + public void sweetTest() { + // TODO: test sweet + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/BananaTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/BananaTest.java new file mode 100644 index 000000000000..dc44e01782de --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/BananaTest.java @@ -0,0 +1,42 @@ +/* + * 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.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Banana + */ +public class BananaTest { + private final Banana model = new Banana(); + + /** + * Model tests for Banana + */ + @Test + public void testBanana() { + // TODO: test Banana + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/BasquePigTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/BasquePigTest.java new file mode 100644 index 000000000000..cee9dbb31ec4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/BasquePigTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BasquePig + */ +public class BasquePigTest { + private final BasquePig model = new BasquePig(); + + /** + * Model tests for BasquePig + */ + @Test + public void testBasquePig() { + // TODO: test BasquePig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/CapitalizationTest.java new file mode 100644 index 000000000000..4cf43ca42492 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/CapitalizationTest.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 org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Capitalization + */ +public class CapitalizationTest { + private final Capitalization model = new Capitalization(); + + /** + * Model tests for Capitalization + */ + @Test + public void testCapitalization() { + // TODO: test Capitalization + } + + /** + * Test the property 'smallCamel' + */ + @Test + public void smallCamelTest() { + // TODO: test smallCamel + } + + /** + * Test the property 'capitalCamel' + */ + @Test + public void capitalCamelTest() { + // TODO: test capitalCamel + } + + /** + * Test the property 'smallSnake' + */ + @Test + public void smallSnakeTest() { + // TODO: test smallSnake + } + + /** + * Test the property 'capitalSnake' + */ + @Test + public void capitalSnakeTest() { + // TODO: test capitalSnake + } + + /** + * Test the property 'scAETHFlowPoints' + */ + @Test + public void scAETHFlowPointsTest() { + // TODO: test scAETHFlowPoints + } + + /** + * Test the property 'ATT_NAME' + */ + @Test + public void ATT_NAMETest() { + // TODO: test ATT_NAME + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/CatTest.java new file mode 100644 index 000000000000..86645837e315 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/CatTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Cat + */ +public class CatTest { + private final Cat model = new Cat(); + + /** + * Model tests for Cat + */ + @Test + public void testCat() { + // TODO: test Cat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..74ed3e42bc69 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ClassModelTest.java new file mode 100644 index 000000000000..799b6c848094 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ClassModelTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ClassModel + */ +public class ClassModelTest { + private final ClassModel model = new ClassModel(); + + /** + * Model tests for ClassModel + */ + @Test + public void testClassModel() { + // TODO: test ClassModel + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ClientTest.java new file mode 100644 index 000000000000..60ec6cc09093 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ClientTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Client + */ +public class ClientTest { + private final Client model = new Client(); + + /** + * Model tests for Client + */ + @Test + public void testClient() { + // TODO: test Client + } + + /** + * Test the property 'client' + */ + @Test + public void clientTest() { + // TODO: test client + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java new file mode 100644 index 000000000000..88acd6f1f749 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ComplexQuadrilateral + */ +public class ComplexQuadrilateralTest { + private final ComplexQuadrilateral model = new ComplexQuadrilateral(); + + /** + * Model tests for ComplexQuadrilateral + */ + @Test + public void testComplexQuadrilateral() { + // TODO: test ComplexQuadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DanishPigTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DanishPigTest.java new file mode 100644 index 000000000000..327d37e158f7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DanishPigTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DanishPig + */ +public class DanishPigTest { + private final DanishPig model = new DanishPig(); + + /** + * Model tests for DanishPig + */ + @Test + public void testDanishPig() { + // TODO: test DanishPig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java new file mode 100644 index 000000000000..b3db962b0727 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DeprecatedObject + */ +public class DeprecatedObjectTest { + private final DeprecatedObject model = new DeprecatedObject(); + + /** + * Model tests for DeprecatedObject + */ + @Test + public void testDeprecatedObject() { + // TODO: test DeprecatedObject + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DogTest.java new file mode 100644 index 000000000000..880d6340fc9f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DogTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Dog + */ +public class DogTest { + private final Dog model = new Dog(); + + /** + * Model tests for Dog + */ + @Test + public void testDog() { + // TODO: test Dog + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DrawingTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DrawingTest.java new file mode 100644 index 000000000000..ad6378016760 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/DrawingTest.java @@ -0,0 +1,73 @@ +/* + * 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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Fruit; +import org.openapitools.client.model.NullableShape; +import org.openapitools.client.model.Shape; +import org.openapitools.client.model.ShapeOrNull; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Drawing + */ +public class DrawingTest { + private final Drawing model = new Drawing(); + + /** + * Model tests for Drawing + */ + @Test + public void testDrawing() { + // TODO: test Drawing + } + + /** + * Test the property 'mainShape' + */ + @Test + public void mainShapeTest() { + // TODO: test mainShape + } + + /** + * Test the property 'shapeOrNull' + */ + @Test + public void shapeOrNullTest() { + // TODO: test shapeOrNull + } + + /** + * Test the property 'nullableShape' + */ + @Test + public void nullableShapeTest() { + // TODO: test nullableShape + } + + /** + * Test the property 'shapes' + */ + @Test + public void shapesTest() { + // TODO: test shapes + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumArraysTest.java new file mode 100644 index 000000000000..9a0d8246b21e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumArraysTest.java @@ -0,0 +1,52 @@ +/* + * 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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumArrays + */ +public class EnumArraysTest { + private final EnumArrays model = new EnumArrays(); + + /** + * Model tests for EnumArrays + */ + @Test + public void testEnumArrays() { + // TODO: test EnumArrays + } + + /** + * Test the property 'justSymbol' + */ + @Test + public void justSymbolTest() { + // TODO: test justSymbol + } + + /** + * Test the property 'arrayEnum' + */ + @Test + public void arrayEnumTest() { + // TODO: test arrayEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumClassTest.java new file mode 100644 index 000000000000..6896bb0a4e90 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumClassTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumClass + */ +public class EnumClassTest { + /** + * Model tests for EnumClass + */ + @Test + public void testEnumClass() { + // TODO: test EnumClass + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java new file mode 100644 index 000000000000..cbd97964fdcf --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumStringDiscriminator + */ +public class EnumStringDiscriminatorTest { + private final EnumStringDiscriminator model = new EnumStringDiscriminator(); + + /** + * Model tests for EnumStringDiscriminator + */ + @Test + public void testEnumStringDiscriminator() { + // TODO: test EnumStringDiscriminator + } + + /** + * Test the property 'enumStrType' + */ + @Test + public void enumStrTypeTest() { + // TODO: test enumStrType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumTestTest.java new file mode 100644 index 000000000000..4b8146ef4550 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EnumTestTest.java @@ -0,0 +1,110 @@ +/* + * 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.model.OuterEnum; +import org.openapitools.client.model.OuterEnumDefaultValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.openapitools.client.model.OuterEnumIntegerDefaultValue; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumTest + */ +public class EnumTestTest { + private final EnumTest model = new EnumTest(); + + /** + * Model tests for EnumTest + */ + @Test + public void testEnumTest() { + // TODO: test EnumTest + } + + /** + * Test the property 'enumString' + */ + @Test + public void enumStringTest() { + // TODO: test enumString + } + + /** + * Test the property 'enumStringRequired' + */ + @Test + public void enumStringRequiredTest() { + // TODO: test enumStringRequired + } + + /** + * Test the property 'enumInteger' + */ + @Test + public void enumIntegerTest() { + // TODO: test enumInteger + } + + /** + * Test the property 'enumIntegerOnly' + */ + @Test + public void enumIntegerOnlyTest() { + // TODO: test enumIntegerOnly + } + + /** + * Test the property 'enumNumber' + */ + @Test + public void enumNumberTest() { + // TODO: test enumNumber + } + + /** + * Test the property 'outerEnum' + */ + @Test + public void outerEnumTest() { + // TODO: test outerEnum + } + + /** + * Test the property 'outerEnumInteger' + */ + @Test + public void outerEnumIntegerTest() { + // TODO: test outerEnumInteger + } + + /** + * Test the property 'outerEnumDefaultValue' + */ + @Test + public void outerEnumDefaultValueTest() { + // TODO: test outerEnumDefaultValue + } + + /** + * Test the property 'outerEnumIntegerDefaultValue' + */ + @Test + public void outerEnumIntegerDefaultValueTest() { + // TODO: test outerEnumIntegerDefaultValue + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java new file mode 100644 index 000000000000..dfb81ec5a9a0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EquilateralTriangle + */ +public class EquilateralTriangleTest { + private final EquilateralTriangle model = new EquilateralTriangle(); + + /** + * Model tests for EquilateralTriangle + */ + @Test + public void testEquilateralTriangle() { + // TODO: test EquilateralTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java new file mode 100644 index 000000000000..22408ad06868 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java @@ -0,0 +1,34 @@ +/* + * 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.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeAnyOfWIthSameErasureGet200Response + */ +public class FakeAnyOfWIthSameErasureGet200ResponseTest { + private final FakeAnyOfWIthSameErasureGet200Response model = new FakeAnyOfWIthSameErasureGet200Response(); + + /** + * Model tests for FakeAnyOfWIthSameErasureGet200Response + */ + @Test + public void testFakeAnyOfWIthSameErasureGet200Response() { + // TODO: test FakeAnyOfWIthSameErasureGet200Response + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java new file mode 100644 index 000000000000..4a0bd78cb384 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java @@ -0,0 +1,34 @@ +/* + * 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.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeOneOfWIthSameErasureGet200Response + */ +public class FakeOneOfWIthSameErasureGet200ResponseTest { + private final FakeOneOfWIthSameErasureGet200Response model = new FakeOneOfWIthSameErasureGet200Response(); + + /** + * Model tests for FakeOneOfWIthSameErasureGet200Response + */ + @Test + public void testFakeOneOfWIthSameErasureGet200Response() { + // TODO: test FakeOneOfWIthSameErasureGet200Response + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java new file mode 100644 index 000000000000..5d6fca30c3e2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.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.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeRefParameterPetIdParameter + */ +public class FakeRefParameterPetIdParameterTest { + private final FakeRefParameterPetIdParameter model = new FakeRefParameterPetIdParameter(); + + /** + * Model tests for FakeRefParameterPetIdParameter + */ + @Test + public void testFakeRefParameterPetIdParameter() { + // TODO: test FakeRefParameterPetIdParameter + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java new file mode 100644 index 000000000000..c4501debc41a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java @@ -0,0 +1,53 @@ +/* + * 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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FileSchemaTestClass + */ +public class FileSchemaTestClassTest { + private final FileSchemaTestClass model = new FileSchemaTestClass(); + + /** + * Model tests for FileSchemaTestClass + */ + @Test + public void testFileSchemaTestClass() { + // TODO: test FileSchemaTestClass + } + + /** + * Test the property '_file' + */ + @Test + public void _fileTest() { + // TODO: test _file + } + + /** + * Test the property 'files' + */ + @Test + public void filesTest() { + // TODO: test files + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java new file mode 100644 index 000000000000..8988ccb35364 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java @@ -0,0 +1,42 @@ +/* + * 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.model.Foo; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FooGetDefaultResponse + */ +public class FooGetDefaultResponseTest { + private final FooGetDefaultResponse model = new FooGetDefaultResponse(); + + /** + * Model tests for FooGetDefaultResponse + */ + @Test + public void testFooGetDefaultResponse() { + // TODO: test FooGetDefaultResponse + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FooTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FooTest.java new file mode 100644 index 000000000000..182c1c09264d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FooTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Foo + */ +public class FooTest { + private final Foo model = new Foo(); + + /** + * Model tests for Foo + */ + @Test + public void testFoo() { + // TODO: test Foo + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FormatTestTest.java new file mode 100644 index 000000000000..71789a2c65af --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -0,0 +1,174 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FormatTest + */ +public class FormatTestTest { + private final FormatTest model = new FormatTest(); + + /** + * Model tests for FormatTest + */ + @Test + public void testFormatTest() { + // TODO: test FormatTest + } + + /** + * Test the property 'integer' + */ + @Test + public void integerTest() { + // TODO: test integer + } + + /** + * Test the property 'int32' + */ + @Test + public void int32Test() { + // TODO: test int32 + } + + /** + * Test the property 'int64' + */ + @Test + public void int64Test() { + // TODO: test int64 + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property '_float' + */ + @Test + public void _floatTest() { + // TODO: test _float + } + + /** + * Test the property '_double' + */ + @Test + public void _doubleTest() { + // TODO: test _double + } + + /** + * Test the property 'decimal' + */ + @Test + public void decimalTest() { + // TODO: test decimal + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + + /** + * Test the property '_byte' + */ + @Test + public void _byteTest() { + // TODO: test _byte + } + + /** + * Test the property 'binary' + */ + @Test + public void binaryTest() { + // TODO: test binary + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'uuidWithDefault' + */ + @Test + public void uuidWithDefaultTest() { + // TODO: test uuidWithDefault + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'patternWithDigits' + */ + @Test + public void patternWithDigitsTest() { + // TODO: test patternWithDigits + } + + /** + * Test the property 'patternWithDigitsAndDelimiter' + */ + @Test + public void patternWithDigitsAndDelimiterTest() { + // TODO: test patternWithDigitsAndDelimiter + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java new file mode 100644 index 000000000000..32a85ee296b7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java @@ -0,0 +1,34 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FreeFormObjectTestClassProperties + */ +public class FreeFormObjectTestClassPropertiesTest { + private final FreeFormObjectTestClassProperties model = new FreeFormObjectTestClassProperties(); + + /** + * Model tests for FreeFormObjectTestClassProperties + */ + @Test + public void testFreeFormObjectTestClassProperties() { + // TODO: test FreeFormObjectTestClassProperties + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java new file mode 100644 index 000000000000..d05451a55e57 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java @@ -0,0 +1,50 @@ +/* + * 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.model.FreeFormObjectTestClassProperties; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FreeFormObjectTestClass + */ +public class FreeFormObjectTestClassTest { + private final FreeFormObjectTestClass model = new FreeFormObjectTestClass(); + + /** + * Model tests for FreeFormObjectTestClass + */ + @Test + public void testFreeFormObjectTestClass() { + // TODO: test FreeFormObjectTestClass + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'properties' + */ + @Test + public void propertiesTest() { + // TODO: test properties + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FruitReqTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FruitReqTest.java new file mode 100644 index 000000000000..36ada57394d4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FruitReqTest.java @@ -0,0 +1,68 @@ +/* + * 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.math.BigDecimal; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FruitReq + */ +public class FruitReqTest { + private final FruitReq model = new FruitReq(); + + /** + * Model tests for FruitReq + */ + @Test + public void testFruitReq() { + // TODO: test FruitReq + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'mealy' + */ + @Test + public void mealyTest() { + // TODO: test mealy + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + + /** + * Test the property 'sweet' + */ + @Test + public void sweetTest() { + // TODO: test sweet + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FruitTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FruitTest.java new file mode 100644 index 000000000000..e6b0c7bea766 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/FruitTest.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.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Fruit + */ +public class FruitTest { + private final Fruit model = new Fruit(); + + /** + * Model tests for Fruit + */ + @Test + public void testFruit() { + // TODO: test Fruit + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/GmFruitTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/GmFruitTest.java new file mode 100644 index 000000000000..b1421958e646 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/GmFruitTest.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.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for GmFruit + */ +public class GmFruitTest { + private final GmFruit model = new GmFruit(); + + /** + * Model tests for GmFruit + */ + @Test + public void testGmFruit() { + // TODO: test GmFruit + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java new file mode 100644 index 000000000000..188613ba5620 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for GrandparentAnimal + */ +public class GrandparentAnimalTest { + private final GrandparentAnimal model = new GrandparentAnimal(); + + /** + * Model tests for GrandparentAnimal + */ + @Test + public void testGrandparentAnimal() { + // TODO: test GrandparentAnimal + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java new file mode 100644 index 000000000000..e4508b243c66 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HasOnlyReadOnly + */ +public class HasOnlyReadOnlyTest { + private final HasOnlyReadOnly model = new HasOnlyReadOnly(); + + /** + * Model tests for HasOnlyReadOnly + */ + @Test + public void testHasOnlyReadOnly() { + // TODO: test HasOnlyReadOnly + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'foo' + */ + @Test + public void fooTest() { + // TODO: test foo + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java new file mode 100644 index 000000000000..ca46dd87b39c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java @@ -0,0 +1,42 @@ +/* + * 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.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HealthCheckResult + */ +public class HealthCheckResultTest { + private final HealthCheckResult model = new HealthCheckResult(); + + /** + * Model tests for HealthCheckResult + */ + @Test + public void testHealthCheckResult() { + // TODO: test HealthCheckResult + } + + /** + * Test the property 'nullableMessage' + */ + @Test + public void nullableMessageTest() { + // TODO: test nullableMessage + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java new file mode 100644 index 000000000000..43b43d6ff121 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for IsoscelesTriangle + */ +public class IsoscelesTriangleTest { + private final IsoscelesTriangle model = new IsoscelesTriangle(); + + /** + * Model tests for IsoscelesTriangle + */ + @Test + public void testIsoscelesTriangle() { + // TODO: test IsoscelesTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MammalAnyofTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MammalAnyofTest.java new file mode 100644 index 000000000000..5f68a418995d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MammalAnyofTest.java @@ -0,0 +1,68 @@ +/* + * 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.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MammalAnyof + */ +public class MammalAnyofTest { + private final MammalAnyof model = new MammalAnyof(); + + /** + * Model tests for MammalAnyof + */ + @Test + public void testMammalAnyof() { + // TODO: test MammalAnyof + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MammalTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MammalTest.java new file mode 100644 index 000000000000..b28e01ebc085 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MammalTest.java @@ -0,0 +1,68 @@ +/* + * 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.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Mammal + */ +public class MammalTest { + private final Mammal model = new Mammal(); + + /** + * Model tests for Mammal + */ + @Test + public void testMammal() { + // TODO: test Mammal + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MapTestTest.java new file mode 100644 index 000000000000..bfb944618637 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MapTestTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MapTest + */ +public class MapTestTest { + private final MapTest model = new MapTest(); + + /** + * Model tests for MapTest + */ + @Test + public void testMapTest() { + // TODO: test MapTest + } + + /** + * Test the property 'mapMapOfString' + */ + @Test + public void mapMapOfStringTest() { + // TODO: test mapMapOfString + } + + /** + * Test the property 'mapOfEnumString' + */ + @Test + public void mapOfEnumStringTest() { + // TODO: test mapOfEnumString + } + + /** + * Test the property 'directMap' + */ + @Test + public void directMapTest() { + // TODO: test directMap + } + + /** + * Test the property 'indirectMap' + */ + @Test + public void indirectMapTest() { + // TODO: test indirectMap + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..774ecdf53017 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.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.model; + +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ +public class MixedPropertiesAndAdditionalPropertiesClassTest { + private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass(); + + /** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ + @Test + public void testMixedPropertiesAndAdditionalPropertiesClass() { + // TODO: test MixedPropertiesAndAdditionalPropertiesClass + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'map' + */ + @Test + public void mapTest() { + // TODO: test map + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/Model200ResponseTest.java new file mode 100644 index 000000000000..14c62bbeb304 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/Model200ResponseTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Model200Response + */ +public class Model200ResponseTest { + private final Model200Response model = new Model200Response(); + + /** + * Model tests for Model200Response + */ + @Test + public void testModel200Response() { + // TODO: test Model200Response + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..7428be140174 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelFileTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelFileTest.java new file mode 100644 index 000000000000..4aebe8858b01 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelFileTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelFile + */ +public class ModelFileTest { + private final ModelFile model = new ModelFile(); + + /** + * Model tests for ModelFile + */ + @Test + public void testModelFile() { + // TODO: test ModelFile + } + + /** + * Test the property 'sourceURI' + */ + @Test + public void sourceURITest() { + // TODO: test sourceURI + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelListTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelListTest.java new file mode 100644 index 000000000000..ee47f2e401a9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelListTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelList + */ +public class ModelListTest { + private final ModelList model = new ModelList(); + + /** + * Model tests for ModelList + */ + @Test + public void testModelList() { + // TODO: test ModelList + } + + /** + * Test the property '_123list' + */ + @Test + public void _123listTest() { + // TODO: test _123list + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelReturnTest.java new file mode 100644 index 000000000000..6cee4f231d50 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelReturnTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelReturn + */ +public class ModelReturnTest { + private final ModelReturn model = new ModelReturn(); + + /** + * Model tests for ModelReturn + */ + @Test + public void testModelReturn() { + // TODO: test ModelReturn + } + + /** + * Test the property '_return' + */ + @Test + public void _returnTest() { + // TODO: test _return + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java new file mode 100644 index 000000000000..40db901d8159 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java @@ -0,0 +1,51 @@ +/* + * 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.model.ArrayAnyOf; +import org.openapitools.client.model.ArrayOneOf; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelWithOneOfAnyOfProperties + */ +public class ModelWithOneOfAnyOfPropertiesTest { + private final ModelWithOneOfAnyOfProperties model = new ModelWithOneOfAnyOfProperties(); + + /** + * Model tests for ModelWithOneOfAnyOfProperties + */ + @Test + public void testModelWithOneOfAnyOfProperties() { + // TODO: test ModelWithOneOfAnyOfProperties + } + + /** + * Test the property 'oneofProp' + */ + @Test + public void oneofPropTest() { + // TODO: test oneofProp + } + + /** + * Test the property 'anyofProp' + */ + @Test + public void anyofPropTest() { + // TODO: test anyofProp + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NameTest.java new file mode 100644 index 000000000000..63847de9baa6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NameTest.java @@ -0,0 +1,65 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Name + */ +public class NameTest { + private final Name model = new Name(); + + /** + * Model tests for Name + */ + @Test + public void testName() { + // TODO: test Name + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'snakeCase' + */ + @Test + public void snakeCaseTest() { + // TODO: test snakeCase + } + + /** + * Test the property 'property' + */ + @Test + public void propertyTest() { + // TODO: test property + } + + /** + * Test the property '_123number' + */ + @Test + public void _123numberTest() { + // TODO: test _123number + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java new file mode 100644 index 000000000000..bb40e150a0ad --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java @@ -0,0 +1,44 @@ +/* + * 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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NestedArrayWithDefaultValues + */ +public class NestedArrayWithDefaultValuesTest { + private final NestedArrayWithDefaultValues model = new NestedArrayWithDefaultValues(); + + /** + * Model tests for NestedArrayWithDefaultValues + */ + @Test + public void testNestedArrayWithDefaultValues() { + // TODO: test NestedArrayWithDefaultValues + } + + /** + * Test the property 'nestedArray' + */ + @Test + public void nestedArrayTest() { + // TODO: test nestedArray + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java new file mode 100644 index 000000000000..25cd4fe4c0cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NewPetCategoryInlineAllofAllOfCategoryTag + */ +public class NewPetCategoryInlineAllofAllOfCategoryTagTest { + private final NewPetCategoryInlineAllofAllOfCategoryTag model = new NewPetCategoryInlineAllofAllOfCategoryTag(); + + /** + * Model tests for NewPetCategoryInlineAllofAllOfCategoryTag + */ + @Test + public void testNewPetCategoryInlineAllofAllOfCategoryTag() { + // TODO: test NewPetCategoryInlineAllofAllOfCategoryTag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java new file mode 100644 index 000000000000..0ad37d84ee0a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.openapitools.client.model.NewPetCategoryInlineAllofAllOfCategoryTag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NewPetCategoryInlineAllof + */ +public class NewPetCategoryInlineAllofTest { + private final NewPetCategoryInlineAllof model = new NewPetCategoryInlineAllof(); + + /** + * Model tests for NewPetCategoryInlineAllof + */ + @Test + public void testNewPetCategoryInlineAllof() { + // TODO: test NewPetCategoryInlineAllof + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'categoryTag' + */ + @Test + public void categoryTagTest() { + // TODO: test categoryTag + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NewPetTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NewPetTest.java new file mode 100644 index 000000000000..9a0c15034010 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NewPetTest.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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.NewPetCategoryInlineAllof; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NewPet + */ +public class NewPetTest { + private final NewPet model = new NewPet(); + + /** + * Model tests for NewPet + */ + @Test + public void testNewPet() { + // TODO: test NewPet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'categoryInlineAllof' + */ + @Test + public void categoryInlineAllofTest() { + // TODO: test categoryInlineAllof + } + + /** + * Test the property 'categoryAllOfRef' + */ + @Test + public void categoryAllOfRefTest() { + // TODO: test categoryAllOfRef + } + + /** + * Test the property 'categoryAllOfRefDescription' + */ + @Test + public void categoryAllOfRefDescriptionTest() { + // TODO: test categoryAllOfRefDescription + } + + /** + * Test the property 'categoryAllOfRefDescriptionReadonly' + */ + @Test + public void categoryAllOfRefDescriptionReadonlyTest() { + // TODO: test categoryAllOfRefDescriptionReadonly + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableClassTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableClassTest.java new file mode 100644 index 000000000000..af2b02168225 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableClassTest.java @@ -0,0 +1,138 @@ +/* + * 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.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableClass + */ +public class NullableClassTest { + private final NullableClass model = new NullableClass(); + + /** + * Model tests for NullableClass + */ + @Test + public void testNullableClass() { + // TODO: test NullableClass + } + + /** + * Test the property 'integerProp' + */ + @Test + public void integerPropTest() { + // TODO: test integerProp + } + + /** + * Test the property 'numberProp' + */ + @Test + public void numberPropTest() { + // TODO: test numberProp + } + + /** + * Test the property 'booleanProp' + */ + @Test + public void booleanPropTest() { + // TODO: test booleanProp + } + + /** + * Test the property 'stringProp' + */ + @Test + public void stringPropTest() { + // TODO: test stringProp + } + + /** + * Test the property 'dateProp' + */ + @Test + public void datePropTest() { + // TODO: test dateProp + } + + /** + * Test the property 'datetimeProp' + */ + @Test + public void datetimePropTest() { + // TODO: test datetimeProp + } + + /** + * Test the property 'arrayNullableProp' + */ + @Test + public void arrayNullablePropTest() { + // TODO: test arrayNullableProp + } + + /** + * Test the property 'arrayAndItemsNullableProp' + */ + @Test + public void arrayAndItemsNullablePropTest() { + // TODO: test arrayAndItemsNullableProp + } + + /** + * Test the property 'arrayItemsNullable' + */ + @Test + public void arrayItemsNullableTest() { + // TODO: test arrayItemsNullable + } + + /** + * Test the property 'objectNullableProp' + */ + @Test + public void objectNullablePropTest() { + // TODO: test objectNullableProp + } + + /** + * Test the property 'objectAndItemsNullableProp' + */ + @Test + public void objectAndItemsNullablePropTest() { + // TODO: test objectAndItemsNullableProp + } + + /** + * Test the property 'objectItemsNullable' + */ + @Test + public void objectItemsNullableTest() { + // TODO: test objectItemsNullable + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableEnumTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableEnumTest.java new file mode 100644 index 000000000000..13f44d4a4e2c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableEnumTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableEnum + */ +public class NullableEnumTest { + /** + * Model tests for NullableEnum + */ + @Test + public void testNullableEnum() { + // TODO: test NullableEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java new file mode 100644 index 000000000000..f8632dca7840 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsMapError + */ +public class NullableFieldsMapErrorTest { + private final NullableFieldsMapError model = new NullableFieldsMapError(); + + /** + * Model tests for NullableFieldsMapError + */ + @Test + public void testNullableFieldsMapError() { + // TODO: test NullableFieldsMapError + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'reason' + */ + @Test + public void reasonTest() { + // TODO: test reason + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java new file mode 100644 index 000000000000..bb723a76289b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.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.model; + +import java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsMapError; +import org.openapitools.client.model.NullableFieldsMapSuccess; +import org.openapitools.client.model.NullableFieldsValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsMapResponse + */ +public class NullableFieldsMapResponseTest { + private final NullableFieldsMapResponse model = new NullableFieldsMapResponse(); + + /** + * Model tests for NullableFieldsMapResponse + */ + @Test + public void testNullableFieldsMapResponse() { + // TODO: test NullableFieldsMapResponse + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'positions' + */ + @Test + public void positionsTest() { + // TODO: test positions + } + + /** + * Test the property 'reason' + */ + @Test + public void reasonTest() { + // TODO: test reason + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java new file mode 100644 index 000000000000..c9f0e262a3b6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java @@ -0,0 +1,52 @@ +/* + * 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.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsMapSuccess + */ +public class NullableFieldsMapSuccessTest { + private final NullableFieldsMapSuccess model = new NullableFieldsMapSuccess(); + + /** + * Model tests for NullableFieldsMapSuccess + */ + @Test + public void testNullableFieldsMapSuccess() { + // TODO: test NullableFieldsMapSuccess + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'positions' + */ + @Test + public void positionsTest() { + // TODO: test positions + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java new file mode 100644 index 000000000000..7a2ad9a1cd9b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsValue + */ +public class NullableFieldsValueTest { + private final NullableFieldsValue model = new NullableFieldsValue(); + + /** + * Model tests for NullableFieldsValue + */ + @Test + public void testNullableFieldsValue() { + // TODO: test NullableFieldsValue + } + + /** + * Test the property 'before' + */ + @Test + public void beforeTest() { + // TODO: test before + } + + /** + * Test the property 'after' + */ + @Test + public void afterTest() { + // TODO: test after + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableShapeTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableShapeTest.java new file mode 100644 index 000000000000..6e763ba29a57 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NullableShapeTest.java @@ -0,0 +1,59 @@ +/* + * 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.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableShape + */ +public class NullableShapeTest { + private final NullableShape model = new NullableShape(); + + /** + * Model tests for NullableShape + */ + @Test + public void testNullableShape() { + // TODO: test NullableShape + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NumberOnlyTest.java new file mode 100644 index 000000000000..5de42fb9e4d7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/NumberOnlyTest.java @@ -0,0 +1,42 @@ +/* + * 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.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NumberOnly + */ +public class NumberOnlyTest { + private final NumberOnly model = new NumberOnly(); + + /** + * Model tests for NumberOnly + */ + @Test + public void testNumberOnly() { + // TODO: test NumberOnly + } + + /** + * Test the property 'justNumber' + */ + @Test + public void justNumberTest() { + // TODO: test justNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java new file mode 100644 index 000000000000..2c05ae22e766 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java @@ -0,0 +1,70 @@ +/* + * 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.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.DeprecatedObject; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ObjectWithDeprecatedFields + */ +public class ObjectWithDeprecatedFieldsTest { + private final ObjectWithDeprecatedFields model = new ObjectWithDeprecatedFields(); + + /** + * Model tests for ObjectWithDeprecatedFields + */ + @Test + public void testObjectWithDeprecatedFields() { + // TODO: test ObjectWithDeprecatedFields + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'deprecatedRef' + */ + @Test + public void deprecatedRefTest() { + // TODO: test deprecatedRef + } + + /** + * Test the property 'bars' + */ + @Test + public void barsTest() { + // TODO: test bars + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..1620b1cd9b8b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,82 @@ +/* + * 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.time.OffsetDateTime; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterCompositeTest.java new file mode 100644 index 000000000000..ee3860d70797 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterCompositeTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterComposite + */ +public class OuterCompositeTest { + private final OuterComposite model = new OuterComposite(); + + /** + * Model tests for OuterComposite + */ + @Test + public void testOuterComposite() { + // TODO: test OuterComposite + } + + /** + * Test the property 'myNumber' + */ + @Test + public void myNumberTest() { + // TODO: test myNumber + } + + /** + * Test the property 'myString' + */ + @Test + public void myStringTest() { + // TODO: test myString + } + + /** + * Test the property 'myBoolean' + */ + @Test + public void myBooleanTest() { + // TODO: test myBoolean + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java new file mode 100644 index 000000000000..26eb0d06704e --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumDefaultValue + */ +public class OuterEnumDefaultValueTest { + /** + * Model tests for OuterEnumDefaultValue + */ + @Test + public void testOuterEnumDefaultValue() { + // TODO: test OuterEnumDefaultValue + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java new file mode 100644 index 000000000000..27eb226577fa --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumIntegerDefaultValue + */ +public class OuterEnumIntegerDefaultValueTest { + /** + * Model tests for OuterEnumIntegerDefaultValue + */ + @Test + public void testOuterEnumIntegerDefaultValue() { + // TODO: test OuterEnumIntegerDefaultValue + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java new file mode 100644 index 000000000000..fe8515c7b371 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumInteger + */ +public class OuterEnumIntegerTest { + /** + * Model tests for OuterEnumInteger + */ + @Test + public void testOuterEnumInteger() { + // TODO: test OuterEnumInteger + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumTest.java new file mode 100644 index 000000000000..3c94c00a1137 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/OuterEnumTest.java @@ -0,0 +1,31 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnum + */ +public class OuterEnumTest { + /** + * Model tests for OuterEnum + */ + @Test + public void testOuterEnum() { + // TODO: test OuterEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ParentPetTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ParentPetTest.java new file mode 100644 index 000000000000..181f92e4e20f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ParentPetTest.java @@ -0,0 +1,42 @@ +/* + * 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.model.GrandparentAnimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ParentPet + */ +public class ParentPetTest { + private final ParentPet model = new ParentPet(); + + /** + * Model tests for ParentPet + */ + @Test + public void testParentPet() { + // TODO: test ParentPet + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetCompositionTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetCompositionTest.java new file mode 100644 index 000000000000..34d3f6e14d29 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetCompositionTest.java @@ -0,0 +1,86 @@ +/* + * 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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetComposition + */ +public class PetCompositionTest { + private final PetComposition model = new PetComposition(); + + /** + * Model tests for PetComposition + */ + @Test + public void testPetComposition() { + // TODO: test PetComposition + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetRefTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetRefTest.java new file mode 100644 index 000000000000..11d9aedf5e24 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetRefTest.java @@ -0,0 +1,86 @@ +/* + * 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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetRef + */ +public class PetRefTest { + private final PetRef model = new PetRef(); + + /** + * Model tests for PetRef + */ + @Test + public void testPetRef() { + // TODO: test PetRef + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..edd0fa462619 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,86 @@ +/* + * 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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java new file mode 100644 index 000000000000..b2f1f02814a7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java @@ -0,0 +1,86 @@ +/* + * 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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetUsingAllOf + */ +public class PetUsingAllOfTest { + private final PetUsingAllOf model = new PetUsingAllOf(); + + /** + * Model tests for PetUsingAllOf + */ + @Test + public void testPetUsingAllOf() { + // TODO: test PetUsingAllOf + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java new file mode 100644 index 000000000000..723af14dd182 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java @@ -0,0 +1,86 @@ +/* + * 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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetWithRequiredTags + */ +public class PetWithRequiredTagsTest { + private final PetWithRequiredTags model = new PetWithRequiredTags(); + + /** + * Model tests for PetWithRequiredTags + */ + @Test + public void testPetWithRequiredTags() { + // TODO: test PetWithRequiredTags + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PigTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PigTest.java new file mode 100644 index 000000000000..c569b42dbc0c --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PigTest.java @@ -0,0 +1,43 @@ +/* + * 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.model.BasquePig; +import org.openapitools.client.model.DanishPig; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pig + */ +public class PigTest { + private final Pig model = new Pig(); + + /** + * Model tests for Pig + */ + @Test + public void testPig() { + // TODO: test Pig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java new file mode 100644 index 000000000000..348ab395230d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PropertyNameCollision + */ +public class PropertyNameCollisionTest { + private final PropertyNameCollision model = new PropertyNameCollision(); + + /** + * Model tests for PropertyNameCollision + */ + @Test + public void testPropertyNameCollision() { + // TODO: test PropertyNameCollision + } + + /** + * Test the property 'underscoreType' + */ + @Test + public void underscoreTypeTest() { + // TODO: test underscoreType + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'typeWithUnderscore' + */ + @Test + public void typeWithUnderscoreTest() { + // TODO: test typeWithUnderscore + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java new file mode 100644 index 000000000000..9034c58f4798 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for QuadrilateralInterface + */ +public class QuadrilateralInterfaceTest { + private final QuadrilateralInterface model = new QuadrilateralInterface(); + + /** + * Model tests for QuadrilateralInterface + */ + @Test + public void testQuadrilateralInterface() { + // TODO: test QuadrilateralInterface + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/QuadrilateralTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/QuadrilateralTest.java new file mode 100644 index 000000000000..d383bbc988b8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/QuadrilateralTest.java @@ -0,0 +1,51 @@ +/* + * 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.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Quadrilateral + */ +public class QuadrilateralTest { + private final Quadrilateral model = new Quadrilateral(); + + /** + * Model tests for Quadrilateral + */ + @Test + public void testQuadrilateral() { + // TODO: test Quadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java new file mode 100644 index 000000000000..c7c8e234d555 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadOnlyFirst + */ +public class ReadOnlyFirstTest { + private final ReadOnlyFirst model = new ReadOnlyFirst(); + + /** + * Model tests for ReadOnlyFirst + */ + @Test + public void testReadOnlyFirst() { + // TODO: test ReadOnlyFirst + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'baz' + */ + @Test + public void bazTest() { + // TODO: test baz + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java new file mode 100644 index 000000000000..3dab782560ce --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java @@ -0,0 +1,154 @@ +/* + * 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.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.client.model.NullableEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for RequiredNullableBody + */ +public class RequiredNullableBodyTest { + private final RequiredNullableBody model = new RequiredNullableBody(); + + /** + * Model tests for RequiredNullableBody + */ + @Test + public void testRequiredNullableBody() { + // TODO: test RequiredNullableBody + } + + /** + * Test the property 'integerProp' + */ + @Test + public void integerPropTest() { + // TODO: test integerProp + } + + /** + * Test the property 'numberProp' + */ + @Test + public void numberPropTest() { + // TODO: test numberProp + } + + /** + * Test the property 'booleanProp' + */ + @Test + public void booleanPropTest() { + // TODO: test booleanProp + } + + /** + * Test the property 'stringProp' + */ + @Test + public void stringPropTest() { + // TODO: test stringProp + } + + /** + * Test the property 'dateProp' + */ + @Test + public void datePropTest() { + // TODO: test dateProp + } + + /** + * Test the property 'datetimeProp' + */ + @Test + public void datetimePropTest() { + // TODO: test datetimeProp + } + + /** + * Test the property 'arrayNullableProp' + */ + @Test + public void arrayNullablePropTest() { + // TODO: test arrayNullableProp + } + + /** + * Test the property 'arrayAndItemsNullableProp' + */ + @Test + public void arrayAndItemsNullablePropTest() { + // TODO: test arrayAndItemsNullableProp + } + + /** + * Test the property 'arrayItemsNullable' + */ + @Test + public void arrayItemsNullableTest() { + // TODO: test arrayItemsNullable + } + + /** + * Test the property 'objectNullableProp' + */ + @Test + public void objectNullablePropTest() { + // TODO: test objectNullableProp + } + + /** + * Test the property 'objectAndItemsNullableProp' + */ + @Test + public void objectAndItemsNullablePropTest() { + // TODO: test objectAndItemsNullableProp + } + + /** + * Test the property 'objectItemsNullable' + */ + @Test + public void objectItemsNullableTest() { + // TODO: test objectItemsNullable + } + + /** + * Test the property 'customRefEnum' + */ + @Test + public void customRefEnumTest() { + // TODO: test customRefEnum + } + + /** + * Test the property 'customEnum' + */ + @Test + public void customEnumTest() { + // TODO: test customEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java new file mode 100644 index 000000000000..bf1d99112e63 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java @@ -0,0 +1,35 @@ +/* + * 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.math.BigDecimal; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ScalarAnyOf + */ +public class ScalarAnyOfTest { + private final ScalarAnyOf model = new ScalarAnyOf(); + + /** + * Model tests for ScalarAnyOf + */ + @Test + public void testScalarAnyOf() { + // TODO: test ScalarAnyOf + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ScalarTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ScalarTest.java new file mode 100644 index 000000000000..e0c971eac8dc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ScalarTest.java @@ -0,0 +1,35 @@ +/* + * 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.math.BigDecimal; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Scalar + */ +public class ScalarTest { + private final Scalar model = new Scalar(); + + /** + * Model tests for Scalar + */ + @Test + public void testScalar() { + // TODO: test Scalar + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java new file mode 100644 index 000000000000..e2115594a251 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ScaleneTriangle + */ +public class ScaleneTriangleTest { + private final ScaleneTriangle model = new ScaleneTriangle(); + + /** + * Model tests for ScaleneTriangle + */ + @Test + public void testScaleneTriangle() { + // TODO: test ScaleneTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java new file mode 100644 index 000000000000..a9d3df83e132 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ShapeInterface + */ +public class ShapeInterfaceTest { + private final ShapeInterface model = new ShapeInterface(); + + /** + * Model tests for ShapeInterface + */ + @Test + public void testShapeInterface() { + // TODO: test ShapeInterface + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java new file mode 100644 index 000000000000..1ce695987e75 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java @@ -0,0 +1,59 @@ +/* + * 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.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ShapeOrNull + */ +public class ShapeOrNullTest { + private final ShapeOrNull model = new ShapeOrNull(); + + /** + * Model tests for ShapeOrNull + */ + @Test + public void testShapeOrNull() { + // TODO: test ShapeOrNull + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ShapeTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ShapeTest.java new file mode 100644 index 000000000000..40b61a61c444 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ShapeTest.java @@ -0,0 +1,59 @@ +/* + * 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.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Shape + */ +public class ShapeTest { + private final Shape model = new Shape(); + + /** + * Model tests for Shape + */ + @Test + public void testShape() { + // TODO: test Shape + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java new file mode 100644 index 000000000000..223afb32c9bc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SimpleQuadrilateral + */ +public class SimpleQuadrilateralTest { + private final SimpleQuadrilateral model = new SimpleQuadrilateral(); + + /** + * Model tests for SimpleQuadrilateral + */ + @Test + public void testSimpleQuadrilateral() { + // TODO: test SimpleQuadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java new file mode 100644 index 000000000000..fd11c3ea318b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SpecialModelName + */ +public class SpecialModelNameTest { + private final SpecialModelName model = new SpecialModelName(); + + /** + * Model tests for SpecialModelName + */ + @Test + public void testSpecialModelName() { + // TODO: test SpecialModelName + } + + /** + * Test the property '$specialPropertyName' + */ + @Test + public void $specialPropertyNameTest() { + // TODO: test $specialPropertyName + } + + /** + * Test the property 'specialModelName' + */ + @Test + public void specialModelNameTest() { + // TODO: test specialModelName + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..627f8916f4cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java new file mode 100644 index 000000000000..24fdcce3b572 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TestInlineFreeformAdditionalPropertiesRequest + */ +public class TestInlineFreeformAdditionalPropertiesRequestTest { + private final TestInlineFreeformAdditionalPropertiesRequest model = new TestInlineFreeformAdditionalPropertiesRequest(); + + /** + * Model tests for TestInlineFreeformAdditionalPropertiesRequest + */ + @Test + public void testTestInlineFreeformAdditionalPropertiesRequest() { + // TODO: test TestInlineFreeformAdditionalPropertiesRequest + } + + /** + * Test the property 'someProperty' + */ + @Test + public void somePropertyTest() { + // TODO: test someProperty + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java new file mode 100644 index 000000000000..084eaa2729ec --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java @@ -0,0 +1,41 @@ +/* + * 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TriangleInterface + */ +public class TriangleInterfaceTest { + private final TriangleInterface model = new TriangleInterface(); + + /** + * Model tests for TriangleInterface + */ + @Test + public void testTriangleInterface() { + // TODO: test TriangleInterface + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TriangleTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TriangleTest.java new file mode 100644 index 000000000000..4fa7fe1a3e47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/TriangleTest.java @@ -0,0 +1,52 @@ +/* + * 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.model.EquilateralTriangle; +import org.openapitools.client.model.IsoscelesTriangle; +import org.openapitools.client.model.ScaleneTriangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Triangle + */ +public class TriangleTest { + private final Triangle model = new Triangle(); + + /** + * Model tests for Triangle + */ + @Test + public void testTriangle() { + // TODO: test Triangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..e99c35254593 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,130 @@ +/* + * 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.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + + /** + * Test the property 'objectWithNoDeclaredProps' + */ + @Test + public void objectWithNoDeclaredPropsTest() { + // TODO: test objectWithNoDeclaredProps + } + + /** + * Test the property 'objectWithNoDeclaredPropsNullable' + */ + @Test + public void objectWithNoDeclaredPropsNullableTest() { + // TODO: test objectWithNoDeclaredPropsNullable + } + + /** + * Test the property 'anyTypeProp' + */ + @Test + public void anyTypePropTest() { + // TODO: test anyTypeProp + } + + /** + * Test the property 'anyTypePropNullable' + */ + @Test + public void anyTypePropNullableTest() { + // TODO: test anyTypePropNullable + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ValueTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ValueTest.java new file mode 100644 index 000000000000..69a85d2116cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ValueTest.java @@ -0,0 +1,35 @@ +/* + * 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.List; +import org.openapitools.client.model.Scalar; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Value + */ +public class ValueTest { + private final Value model = new Value(); + + /** + * Model tests for Value + */ + @Test + public void testValue() { + // TODO: test Value + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/VariableTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/VariableTest.java new file mode 100644 index 000000000000..d22c286c726a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/VariableTest.java @@ -0,0 +1,50 @@ +/* + * 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.model.Value; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Variable + */ +public class VariableTest { + private final Variable model = new Variable(); + + /** + * Model tests for Variable + */ + @Test + public void testVariable() { + // TODO: test Variable + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'value' + */ + @Test + public void valueTest() { + // TODO: test value + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/WhaleTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/WhaleTest.java new file mode 100644 index 000000000000..2b62f2859a7f --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/WhaleTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Whale + */ +public class WhaleTest { + private final Whale model = new Whale(); + + /** + * Model tests for Whale + */ + @Test + public void testWhale() { + // TODO: test Whale + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ZebraTest.java b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ZebraTest.java new file mode 100644 index 000000000000..348d3e406d3d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jsonb/src/test/java/org/openapitools/client/model/ZebraTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Zebra + */ +public class ZebraTest { + private final Zebra model = new Zebra(); + + /** + * Model tests for Zebra + */ + @Test + public void testZebra() { + // TODO: test Zebra + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp-jspecify/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp-jspecify/.github/workflows/maven.yml new file mode 100644 index 000000000000..4cdd3d63e3e4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build jspecify + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp-jspecify/.gitignore b/samples/client/petstore/java/okhttp-jspecify/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/.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/client/petstore/java/okhttp-jspecify/.openapi-generator-ignore b/samples/client/petstore/java/okhttp-jspecify/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/.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/client/petstore/java/okhttp-jspecify/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-jspecify/.openapi-generator/FILES new file mode 100644 index 000000000000..e09edc0a22f5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/.openapi-generator/FILES @@ -0,0 +1,43 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/DefaultApi.md +docs/Foo.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/DefaultApi.java +src/main/java/org/openapitools/client/api/package-info.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/package-info.java +src/main/java/org/openapitools/client/package-info.java +src/test/java/org/openapitools/client/api/DefaultApiTest.java +src/test/java/org/openapitools/client/model/FooTest.java diff --git a/samples/client/petstore/java/okhttp-jspecify/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-jspecify/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-jspecify/.travis.yml b/samples/client/petstore/java/okhttp-jspecify/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/.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/client/petstore/java/okhttp-jspecify/README.md b/samples/client/petstore/java/okhttp-jspecify/README.md new file mode 100644 index 000000000000..16fe287379b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/README.md @@ -0,0 +1,139 @@ +# petstore-okhttp-jspecify + +jspecify +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +test fully qualified name and jspecify + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-okhttp-jspecify + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-okhttp-jspecify' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp-jspecify' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp-jspecify:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/petstore-okhttp-jspecify-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + String id = "id_example"; // String | + try { + apiInstance.fileIdGet(id); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fileIdGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**fileIdGet**](docs/DefaultApi.md#fileIdGet) | **GET** /file/{id} | +*DefaultApi* | [**fooDtParamGet**](docs/DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | +*DefaultApi* | [**uploadPost**](docs/DefaultApi.md#uploadPost) | **POST** /upload | + + +## Documentation for Models + + - [Foo](docs/Foo.md) + + + +## Documentation for Authorization + +Endpoints do not require authorization. + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp-jspecify/api/openapi.yaml b/samples/client/petstore/java/okhttp-jspecify/api/openapi.yaml new file mode 100644 index 000000000000..92970c42deb5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/api/openapi.yaml @@ -0,0 +1,119 @@ +openapi: 3.0.0 +info: + description: test fully qualified name and jspecify + title: jspecify + version: 1.0.0 +servers: +- url: / +paths: + /foo/{dtParam}: + get: + parameters: + - explode: false + in: path + name: dtParam + required: true + schema: + format: date-time + type: string + style: simple + - explode: true + in: query + name: dtQuery + required: false + schema: + format: date-time + type: string + style: form + - explode: true + in: cookie + name: dtCookie + required: false + schema: + format: date-time + type: string + style: form + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/Foo" + description: response + x-accepts: + - application/json + /upload: + post: + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/_upload_post_request" + description: file + responses: + default: + description: ok + x-content-type: multipart/form-data + x-accepts: + - application/json + /file/{id}: + get: + parameters: + - explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + description: ok + x-accepts: + - application/json +components: + schemas: + Foo: + example: + dt: 2000-01-23T04:56:07.000+00:00 + binary: "" + listOfDt: + - 2000-01-23T04:56:07.000+00:00 + - 2000-01-23T04:56:07.000+00:00 + listMinIntems: + - 2000-01-23T04:56:07.000+00:00 + - 2000-01-23T04:56:07.000+00:00 + requiredDt: 2000-01-23T04:56:07.000+00:00 + number: 0.8008281904610115 + properties: + dt: + format: date-time + type: string + binary: + format: binary + type: string + listOfDt: + items: + format: date-time + type: string + type: array + listMinIntems: + items: + format: date-time + type: string + minItems: 1 + type: array + requiredDt: + format: date-time + type: string + number: + type: number + required: + - requiredDt + _upload_post_request: + properties: + file: + format: binary + type: string + type: object + diff --git a/samples/client/petstore/java/okhttp-jspecify/build.gradle b/samples/client/petstore/java/okhttp-jspecify/build.gradle new file mode 100644 index 000000000000..e936c6c57cd7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/build.gradle @@ -0,0 +1,63 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-okhttp-jspecify' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "org.jspecify:jspecify:1.0.0" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp-jspecify/build.sbt b/samples/client/petstore/java/okhttp-jspecify/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp-jspecify/docs/DefaultApi.md b/samples/client/petstore/java/okhttp-jspecify/docs/DefaultApi.md new file mode 100644 index 000000000000..26979aebe7b1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/docs/DefaultApi.md @@ -0,0 +1,193 @@ +# DefaultApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fileIdGet**](DefaultApi.md#fileIdGet) | **GET** /file/{id} | | +| [**fooDtParamGet**](DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | | +| [**uploadPost**](DefaultApi.md#uploadPost) | **POST** /upload | | + + + +# **fileIdGet** +> fileIdGet(id) + + + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + String id = "id_example"; // String | + try { + apiInstance.fileIdGet(id); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fileIdGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **id** | **String**| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | ok | - | + + +# **fooDtParamGet** +> Foo fooDtParamGet(dtParam, dtQuery, dtCookie) + + + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + java.time.Instant dtParam = new java.time.Instant(); // java.time.Instant | + java.time.Instant dtQuery = new java.time.Instant(); // java.time.Instant | + java.time.Instant dtCookie = new java.time.Instant(); // java.time.Instant | + try { + Foo result = apiInstance.fooDtParamGet(dtParam, dtQuery, dtCookie); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fooDtParamGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **dtParam** | **java.time.Instant**| | | +| **dtQuery** | **java.time.Instant**| | [optional] | +| **dtCookie** | **java.time.Instant**| | [optional] | + +### Return type + +[**Foo**](Foo.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + + +# **uploadPost** +> uploadPost(_file) + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + File _file = new File("/path/to/file"); // File | + try { + apiInstance.uploadPost(_file); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#uploadPost"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **_file** | **File**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | ok | - | + diff --git a/samples/client/petstore/java/okhttp-jspecify/docs/Foo.md b/samples/client/petstore/java/okhttp-jspecify/docs/Foo.md new file mode 100644 index 000000000000..d03d21cd097d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/docs/Foo.md @@ -0,0 +1,18 @@ + + +# Foo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dt** | **java.time.Instant** | | [optional] | +|**binary** | **File** | | [optional] | +|**listOfDt** | **List<java.time.Instant>** | | [optional] | +|**listMinIntems** | **List<java.time.Instant>** | | [optional] | +|**requiredDt** | **java.time.Instant** | | | +|**number** | **java.math.BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-jspecify/git_push.sh b/samples/client/petstore/java/okhttp-jspecify/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp-jspecify/gradle.properties b/samples/client/petstore/java/okhttp-jspecify/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-jspecify/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-jspecify/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-jspecify/gradlew.bat b/samples/client/petstore/java/okhttp-jspecify/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp-jspecify/pom.xml b/samples/client/petstore/java/okhttp-jspecify/pom.xml new file mode 100644 index 000000000000..861dfc6d85dd --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/pom.xml @@ -0,0 +1,278 @@ + + 4.0.0 + org.openapitools + petstore-okhttp-jspecify + jar + petstore-okhttp-jspecify + 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 + http://unlicense.org + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + 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-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + org.jspecify + jspecify + 1.0.0 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.10.1 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp-jspecify/settings.gradle b/samples/client/petstore/java/okhttp-jspecify/settings.gradle new file mode 100644 index 000000000000..e0c75485b6a7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-okhttp-jspecify" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-jspecify/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..3aacec9a9401 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..b567dc783cc1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1631 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://localhost"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://localhost) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..e6f66e6f66d7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..14c0a68bd0e1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..346a6c9e5d3d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..4e5babaec24d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,440 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Foo.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..414a027f27b9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..d30e76275524 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..ed5339e4573d --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..eb6154a87dca --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..37a829200ca5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..5f33d5c2fe88 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..6d557ae2c2cf --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,467 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.Foo; +import org.jspecify.annotations.Nullable; +import java.time.OffsetDateTime; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DefaultApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for fileIdGet + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 ok -
+ */ + public okhttp3.Call fileIdGetCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/file/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fileIdGetValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling fileIdGet(Async)"); + } + + return fileIdGetCall(id, _callback); + + } + + /** + * + * + * @param id (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 ok -
+ */ + public void fileIdGet(String id) throws ApiException { + fileIdGetWithHttpInfo(id); + } + + /** + * + * + * @param id (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 ok -
+ */ + public ApiResponse fileIdGetWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = fileIdGetValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 ok -
+ */ + public okhttp3.Call fileIdGetAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fileIdGetValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for fooDtParamGet + * @param dtParam (required) + * @param dtQuery (optional) + * @param dtCookie (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public okhttp3.Call fooDtParamGetCall(java.time.Instant dtParam, java.time.@Nullable Instant dtQuery, java.time.@Nullable Instant dtCookie, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/foo/{dtParam}" + .replace("{" + "dtParam" + "}", localVarApiClient.escapeString(dtParam.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (dtQuery != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("dtQuery", dtQuery)); + } + + if (dtCookie != null) { + localVarCookieParams.put("dtCookie", localVarApiClient.parameterToString(dtCookie)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fooDtParamGetValidateBeforeCall(java.time.Instant dtParam, java.time.@Nullable Instant dtQuery, java.time.@Nullable Instant dtCookie, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'dtParam' is set + if (dtParam == null) { + throw new ApiException("Missing the required parameter 'dtParam' when calling fooDtParamGet(Async)"); + } + + return fooDtParamGetCall(dtParam, dtQuery, dtCookie, _callback); + + } + + /** + * + * + * @param dtParam (required) + * @param dtQuery (optional) + * @param dtCookie (optional) + * @return Foo + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public Foo fooDtParamGet(java.time.Instant dtParam, java.time.@Nullable Instant dtQuery, java.time.@Nullable Instant dtCookie) throws ApiException { + ApiResponse localVarResp = fooDtParamGetWithHttpInfo(dtParam, dtQuery, dtCookie); + return localVarResp.getData(); + } + + /** + * + * + * @param dtParam (required) + * @param dtQuery (optional) + * @param dtCookie (optional) + * @return ApiResponse<Foo> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public ApiResponse fooDtParamGetWithHttpInfo(java.time.Instant dtParam, java.time.@Nullable Instant dtQuery, java.time.@Nullable Instant dtCookie) throws ApiException { + okhttp3.Call localVarCall = fooDtParamGetValidateBeforeCall(dtParam, dtQuery, dtCookie, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param dtParam (required) + * @param dtQuery (optional) + * @param dtCookie (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public okhttp3.Call fooDtParamGetAsync(java.time.Instant dtParam, java.time.@Nullable Instant dtQuery, java.time.@Nullable Instant dtCookie, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fooDtParamGetValidateBeforeCall(dtParam, dtQuery, dtCookie, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for uploadPost + * @param _file (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 ok -
+ */ + public okhttp3.Call uploadPostCall(@Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/upload"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (_file != null) { + localVarFormParams.put("file", _file); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadPostValidateBeforeCall(@Nullable File _file, final ApiCallback _callback) throws ApiException { + return uploadPostCall(_file, _callback); + + } + + /** + * + * + * @param _file (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 ok -
+ */ + public void uploadPost(@Nullable File _file) throws ApiException { + uploadPostWithHttpInfo(_file); + } + + /** + * + * + * @param _file (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 ok -
+ */ + public ApiResponse uploadPostWithHttpInfo(@Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = uploadPostValidateBeforeCall(_file, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param _file (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 ok -
+ */ + public okhttp3.Call uploadPostAsync(@Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadPostValidateBeforeCall(_file, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/api/package-info.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/api/package-info.java new file mode 100644 index 000000000000..6d0d02339408 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/api/package-info.java @@ -0,0 +1,2 @@ +@org.jspecify.annotations.NullMarked +package org.openapitools.client.api; diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..5a774e51a741 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..bbd20697f755 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..8a458fa8cd8a --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..42ab195d76a7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,62 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..5aeec8303388 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,142 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/Foo.java new file mode 100644 index 000000000000..d346b11e1aa7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/Foo.java @@ -0,0 +1,454 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.File; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.jspecify.annotations.Nullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Foo + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Foo { + public static final String SERIALIZED_NAME_DT = "dt"; + @SerializedName(SERIALIZED_NAME_DT) + + private java.time.@Nullable Instant dt; + + public static final String SERIALIZED_NAME_BINARY = "binary"; + @SerializedName(SERIALIZED_NAME_BINARY) + + private @Nullable File binary; + + public static final String SERIALIZED_NAME_LIST_OF_DT = "listOfDt"; + @SerializedName(SERIALIZED_NAME_LIST_OF_DT) + + private List listOfDt; + + public static final String SERIALIZED_NAME_LIST_MIN_INTEMS = "listMinIntems"; + @SerializedName(SERIALIZED_NAME_LIST_MIN_INTEMS) + + private List listMinIntems; + + public static final String SERIALIZED_NAME_REQUIRED_DT = "requiredDt"; + @SerializedName(SERIALIZED_NAME_REQUIRED_DT) + + private java.time.Instant requiredDt; + + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) + + private java.math.@Nullable BigDecimal number; + + public Foo() { + } + + public Foo dt(java.time.@Nullable Instant dt) { + this.dt = dt; + return this; + } + + /** + * Get dt + * @return dt + */ + + + public java.time.@Nullable Instant getDt() { + return dt; + } + + public void setDt(java.time.@Nullable Instant dt) { + this.dt = dt; + } + + + public Foo binary(@Nullable File binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + */ + + + public @Nullable File getBinary() { + return binary; + } + + public void setBinary(@Nullable File binary) { + this.binary = binary; + } + + + public Foo listOfDt(List listOfDt) { + this.listOfDt = listOfDt; + return this; + } + + public Foo addListOfDtItem(java.time.Instant listOfDtItem) { + if (this.listOfDt == null) { + this.listOfDt = new ArrayList<>(); + } + this.listOfDt.add(listOfDtItem); + return this; + } + + /** + * Get listOfDt + * @return listOfDt + */ + + + public List getListOfDt() { + return listOfDt; + } + + public void setListOfDt(List listOfDt) { + this.listOfDt = listOfDt; + } + + + public Foo listMinIntems(List listMinIntems) { + this.listMinIntems = listMinIntems; + return this; + } + + public Foo addListMinIntemsItem(java.time.Instant listMinIntemsItem) { + if (this.listMinIntems == null) { + this.listMinIntems = new ArrayList<>(); + } + this.listMinIntems.add(listMinIntemsItem); + return this; + } + + /** + * Get listMinIntems + * @return listMinIntems + */ + + + public List getListMinIntems() { + return listMinIntems; + } + + public void setListMinIntems(List listMinIntems) { + this.listMinIntems = listMinIntems; + } + + + public Foo requiredDt(java.time.Instant requiredDt) { + this.requiredDt = requiredDt; + return this; + } + + /** + * Get requiredDt + * @return requiredDt + */ + + + public java.time.Instant getRequiredDt() { + return requiredDt; + } + + public void setRequiredDt(java.time.Instant requiredDt) { + this.requiredDt = requiredDt; + } + + + public Foo number(java.math.@Nullable BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * @return number + */ + + + public java.math.@Nullable BigDecimal getNumber() { + return number; + } + + public void setNumber(java.math.@Nullable BigDecimal number) { + this.number = number; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Foo instance itself + */ + public Foo putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Foo foo = (Foo) o; + return Objects.equals(this.dt, foo.dt) && + Objects.equals(this.binary, foo.binary) && + Objects.equals(this.listOfDt, foo.listOfDt) && + Objects.equals(this.listMinIntems, foo.listMinIntems) && + Objects.equals(this.requiredDt, foo.requiredDt) && + Objects.equals(this.number, foo.number)&& + Objects.equals(this.additionalProperties, foo.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(dt, binary, listOfDt, listMinIntems, requiredDt, number, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Foo {\n"); + sb.append(" dt: ").append(toIndentedString(dt)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" listOfDt: ").append(toIndentedString(listOfDt)).append("\n"); + sb.append(" listMinIntems: ").append(toIndentedString(listMinIntems)).append("\n"); + sb.append(" requiredDt: ").append(toIndentedString(requiredDt)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("dt", "binary", "listOfDt", "listMinIntems", "requiredDt", "number")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("requiredDt")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Foo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Foo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Foo is not found in the empty JSON string", Foo.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Foo.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("listOfDt") != null && !jsonObj.get("listOfDt").isJsonNull() && !jsonObj.get("listOfDt").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `listOfDt` to be an array in the JSON string but got `%s`", jsonObj.get("listOfDt").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("listMinIntems") != null && !jsonObj.get("listMinIntems").isJsonNull() && !jsonObj.get("listMinIntems").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `listMinIntems` to be an array in the JSON string but got `%s`", jsonObj.get("listMinIntems").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Foo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Foo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Foo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Foo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Foo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Foo instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Foo given an JSON string + * + * @param jsonString JSON string + * @return An instance of Foo + * @throws IOException if the JSON string is invalid with respect to Foo + */ + public static Foo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Foo.class); + } + + /** + * Convert an instance of Foo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/package-info.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/package-info.java new file mode 100644 index 000000000000..774ca336f509 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/package-info.java @@ -0,0 +1,2 @@ +@org.jspecify.annotations.NullMarked +package org.openapitools.client.model; diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/package-info.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/package-info.java new file mode 100644 index 000000000000..9c547369c362 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/package-info.java @@ -0,0 +1,2 @@ +@org.jspecify.annotations.NullMarked +package org.openapitools.client; diff --git a/samples/client/petstore/java/okhttp-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/okhttp-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java new file mode 100644 index 000000000000..27fe2c4947c3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -0,0 +1,69 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.Foo; +import org.jspecify.annotations.Nullable; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for DefaultApi + */ +@Disabled +public class DefaultApiTest { + + private final DefaultApi api = new DefaultApi(); + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fileIdGetTest() throws ApiException { + String id = null; + api.fileIdGet(id); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fooDtParamGetTest() throws ApiException { + java.time.Instant dtParam = null; + java.time.Instant dtQuery = null; + java.time.Instant dtCookie = null; + Foo response = api.fooDtParamGet(dtParam, dtQuery, dtCookie); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void uploadPostTest() throws ApiException { + File _file = null; + api.uploadPost(_file); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-jspecify/src/test/java/org/openapitools/client/model/FooTest.java b/samples/client/petstore/java/okhttp-jspecify/src/test/java/org/openapitools/client/model/FooTest.java new file mode 100644 index 000000000000..ec6d5f9872b4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-jspecify/src/test/java/org/openapitools/client/model/FooTest.java @@ -0,0 +1,94 @@ +/* + * jspecify + * test fully qualified name and jspecify + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.File; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Foo + */ +public class FooTest { + private final Foo model = new Foo(); + + /** + * Model tests for Foo + */ + @Test + public void testFoo() { + // TODO: test Foo + } + + /** + * Test the property 'dt' + */ + @Test + public void dtTest() { + // TODO: test dt + } + + /** + * Test the property 'binary' + */ + @Test + public void binaryTest() { + // TODO: test binary + } + + /** + * Test the property 'listOfDt' + */ + @Test + public void listOfDtTest() { + // TODO: test listOfDt + } + + /** + * Test the property 'listMinIntems' + */ + @Test + public void listMinIntemsTest() { + // TODO: test listMinIntems + } + + /** + * Test the property 'requiredDt' + */ + @Test + public void requiredDtTest() { + // TODO: test requiredDt + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp-nullable-required/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp-nullable-required/.gitignore b/samples/client/petstore/java/okhttp-nullable-required/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/.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/client/petstore/java/okhttp-nullable-required/.openapi-generator-ignore b/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/.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/client/petstore/java/okhttp-nullable-required/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/FILES new file mode 100644 index 000000000000..98c355b15f63 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/FILES @@ -0,0 +1,71 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/Category.md +docs/ModelApiResponse.md +docs/Order.md +docs/Pet.md +docs/PetApi.md +docs/PetWithRequiredNullableCases1.md +docs/PetWithRequiredNullableCases2.md +docs/StoreApi.md +docs/Tag.md +docs/User.md +docs/UserApi.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases1.java +src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases2.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/User.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/PetWithRequiredNullableCases1Test.java +src/test/java/org/openapitools/client/model/PetWithRequiredNullableCases2Test.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-nullable-required/.travis.yml b/samples/client/petstore/java/okhttp-nullable-required/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/.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/client/petstore/java/okhttp-nullable-required/README.md b/samples/client/petstore/java/okhttp-nullable-required/README.md new file mode 100644 index 000000000000..05f7bd054640 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/README.md @@ -0,0 +1,192 @@ +# nullable-required-okhttp + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + nullable-required-okhttp + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'nullable-required-okhttp' jar has been published to maven central. + mavenLocal() // Needed if the 'nullable-required-okhttp' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:nullable-required-okhttp:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/nullable-required-okhttp-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(pet); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Category](docs/Category.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [PetWithRequiredNullableCases1](docs/PetWithRequiredNullableCases1.md) + - [PetWithRequiredNullableCases2](docs/PetWithRequiredNullableCases2.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### auth_cookie + +- **Type**: API key +- **API key parameter name**: AUTH_KEY +- **Location**: + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp-nullable-required/api/openapi.yaml b/samples/client/petstore/java/okhttp-nullable-required/api/openapi.yaml new file mode 100644 index 000000000000..d6e3b97cf3b8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/api/openapi.yaml @@ -0,0 +1,940 @@ +openapi: 3.0.0 +info: + description: "This is a sample server Petstore server. For this sample, you can\ + \ use the api key `special-key` to test the authorization filters." + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + put: + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: orderId + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `auth_cookie` + apiKey authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - auth_cookie: [] + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + security: + - auth_cookie: [] + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + Order: + description: An order for a pets from the pet store + example: + id: 0 + petId: 6 + quantity: 1 + shipDate: 2000-01-23T04:56:07.000+00:00 + status: placed + complete: false + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object + xml: + name: Order + Category: + description: A category for a pet + example: + id: 6 + name: name + properties: + id: + format: int64 + type: integer + name: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + title: Pet category + type: object + xml: + name: Category + User: + description: A User who is purchasing from the pet store + example: + id: 0 + username: username + firstName: firstName + lastName: lastName + email: email + password: password + phone: phone + userStatus: 6 + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Tag: + description: A tag for a pet + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + Pet: + description: A pet for sale in the pet store + example: + id: 0 + category: + id: 6 + name: name + name: doggie + photoUrls: + - photoUrls + - photoUrls + tags: + - id: 1 + name: name + - id: 1 + name: name + status: available + properties: + id: + format: int64 + type: integer + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + PetWithRequiredNullableCases1: + description: A pet for sale in the pet store + properties: + id: + format: int64 + nullable: true + type: integer + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + nullable: true + type: string + photoUrls: + items: + type: string + nullable: true + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + nullable: true + type: array + xml: + name: tag + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + nullable: true + type: string + required: + - name + - photoUrls + title: a PetWithRequiredNullableCases1 + type: object + xml: + name: Pet + PetWithRequiredNullableCases2: + description: A pet for sale in the pet store + properties: + id: + format: int64 + nullable: false + type: integer + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + nullable: false + type: string + photoUrls: + items: + type: string + nullable: false + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + nullable: false + type: array + xml: + name: tag + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + nullable: false + type: string + required: + - name + - photoUrls + title: a PetWithRequiredNullableCases2 + type: object + xml: + name: Pet + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + auth_cookie: + in: cookie + name: AUTH_KEY + type: apiKey + diff --git a/samples/client/petstore/java/okhttp-nullable-required/build.gradle b/samples/client/petstore/java/okhttp-nullable-required/build.gradle new file mode 100644 index 000000000000..b1dfbdce8b60 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/build.gradle @@ -0,0 +1,64 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'nullable-required-okhttp' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/build.sbt b/samples/client/petstore/java/okhttp-nullable-required/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp-nullable-required/docs/Category.md b/samples/client/petstore/java/okhttp-nullable-required/docs/Category.md new file mode 100644 index 000000000000..a7fc939d252e --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/docs/Category.md @@ -0,0 +1,15 @@ + + +# Category + +A category for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-nullable-required/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-nullable-required/docs/ModelApiResponse.md new file mode 100644 index 000000000000..cd7e3c400be6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/docs/ModelApiResponse.md @@ -0,0 +1,16 @@ + + +# ModelApiResponse + +Describes the result of uploading an image resource + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-nullable-required/docs/Order.md b/samples/client/petstore/java/okhttp-nullable-required/docs/Order.md new file mode 100644 index 000000000000..0c33059b8b6a --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/docs/Order.md @@ -0,0 +1,29 @@ + + +# Order + +An order for a pets from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp-nullable-required/docs/Pet.md b/samples/client/petstore/java/okhttp-nullable-required/docs/Pet.md new file mode 100644 index 000000000000..8bb363301232 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/docs/Pet.md @@ -0,0 +1,29 @@ + + +# Pet + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-nullable-required/docs/PetApi.md b/samples/client/petstore/java/okhttp-nullable-required/docs/PetApi.md new file mode 100644 index 000000000000..780a044bb0af --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/docs/PetApi.md @@ -0,0 +1,566 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | + + + +# **addPet** +> addPet(pet) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(pet); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +# **updatePet** +> updatePet(pet) + +Update an existing pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(pet); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-nullable-required/docs/PetWithRequiredNullableCases1.md b/samples/client/petstore/java/okhttp-nullable-required/docs/PetWithRequiredNullableCases1.md new file mode 100644 index 000000000000..a6f19af21c83 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/docs/PetWithRequiredNullableCases1.md @@ -0,0 +1,29 @@ + + +# PetWithRequiredNullableCases1 + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-nullable-required/docs/PetWithRequiredNullableCases2.md b/samples/client/petstore/java/okhttp-nullable-required/docs/PetWithRequiredNullableCases2.md new file mode 100644 index 000000000000..7bab41033ce9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/docs/PetWithRequiredNullableCases2.md @@ -0,0 +1,29 @@ + + +# PetWithRequiredNullableCases2 + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-nullable-required/docs/StoreApi.md b/samples/client/petstore/java/okhttp-nullable-required/docs/StoreApi.md new file mode 100644 index 000000000000..af54298ffc2e --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/docs/StoreApi.md @@ -0,0 +1,266 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + 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 + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + + + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/okhttp-nullable-required/docs/Tag.md b/samples/client/petstore/java/okhttp-nullable-required/docs/Tag.md new file mode 100644 index 000000000000..abfde4afb501 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/docs/Tag.md @@ -0,0 +1,15 @@ + + +# Tag + +A tag for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-nullable-required/docs/User.md b/samples/client/petstore/java/okhttp-nullable-required/docs/User.md new file mode 100644 index 000000000000..426845227bd3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/docs/User.md @@ -0,0 +1,21 @@ + + +# User + +A User who is purchasing from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-nullable-required/docs/UserApi.md b/samples/client/petstore/java/okhttp-nullable-required/docs/UserApi.md new file mode 100644 index 000000000000..158a852ed3b0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/docs/UserApi.md @@ -0,0 +1,553 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | + + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: auth_cookie + ApiKeyAuth auth_cookie = (ApiKeyAuth) defaultClient.getAuthentication("auth_cookie"); + auth_cookie.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //auth_cookie.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + +null (empty response body) + +### Authorization + +[auth_cookie](../README.md#auth_cookie) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: auth_cookie + ApiKeyAuth auth_cookie = (ApiKeyAuth) defaultClient.getAuthentication("auth_cookie"); + auth_cookie.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //auth_cookie.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +[auth_cookie](../README.md#auth_cookie) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: auth_cookie + ApiKeyAuth auth_cookie = (ApiKeyAuth) defaultClient.getAuthentication("auth_cookie"); + auth_cookie.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //auth_cookie.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +[auth_cookie](../README.md#auth_cookie) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: auth_cookie + ApiKeyAuth auth_cookie = (ApiKeyAuth) defaultClient.getAuthentication("auth_cookie"); + auth_cookie.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //auth_cookie.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +[auth_cookie](../README.md#auth_cookie) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `auth_cookie` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: auth_cookie + ApiKeyAuth auth_cookie = (ApiKeyAuth) defaultClient.getAuthentication("auth_cookie"); + auth_cookie.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //auth_cookie.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + 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 + +null (empty response body) + +### Authorization + +[auth_cookie](../README.md#auth_cookie) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: auth_cookie + ApiKeyAuth auth_cookie = (ApiKeyAuth) defaultClient.getAuthentication("auth_cookie"); + auth_cookie.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //auth_cookie.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + +null (empty response body) + +### Authorization + +[auth_cookie](../README.md#auth_cookie) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/okhttp-nullable-required/git_push.sh b/samples/client/petstore/java/okhttp-nullable-required/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp-nullable-required/gradle.properties b/samples/client/petstore/java/okhttp-nullable-required/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-nullable-required/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-nullable-required/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-nullable-required/gradlew.bat b/samples/client/petstore/java/okhttp-nullable-required/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp-nullable-required/pom.xml b/samples/client/petstore/java/okhttp-nullable-required/pom.xml new file mode 100644 index 000000000000..a75b033de9b7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/pom.xml @@ -0,0 +1,284 @@ + + 4.0.0 + org.openapitools + nullable-required-okhttp + jar + nullable-required-okhttp + 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-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.10.1 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp-nullable-required/settings.gradle b/samples/client/petstore/java/okhttp-nullable-required/settings.gradle new file mode 100644 index 000000000000..36125a2946a2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "nullable-required-okhttp" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-nullable-required/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..e818a511443e --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..7ec2f5af1a76 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1730 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://petstore.swagger.io/v2"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("auth_cookie", new ApiKeyAuth("cookie", "AUTH_KEY")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("auth_cookie", new ApiKeyAuth("cookie", "AUTH_KEY")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = ""; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("auth_cookie", new ApiKeyAuth("cookie", "AUTH_KEY")); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io/v2) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..bbe1b2c8ee33 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..189537deb549 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..ba56d6cab13d --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..8d645a3951e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,447 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Category.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelApiResponse.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Order.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Pet.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.PetWithRequiredNullableCases1.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.PetWithRequiredNullableCases2.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Tag.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.User.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..8b84ab37c82a --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..673ffc4cbb7b --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..10eeda6a297e --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..ae47d8bdb452 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..1b09cdb8d75c --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..a4859da9a700 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..5f58575489c8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1169 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PetApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addPet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call addPetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addPetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling addPet(Async)"); + } + + return addPetCall(pet, _callback); + + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void addPet(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Add a new pet to the store (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call addPetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deletePet + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePetValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); + } + + return deletePetCall(petId, apiKey, _callback); + + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deletes a pet (asynchronously) + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for findPetsByStatus + * @param status Status values that need to be considered for filter (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "status", status)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByStatusValidateBeforeCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + + return findPetsByStatusCall(status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + ApiResponse> localVarResp = findPetsByStatusWithHttpInfo(status); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by status (asynchronously) + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusAsync(@javax.annotation.Nonnull List status, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for findPetsByTags + * @param tags Tags to filter by (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByTagsValidateBeforeCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); + } + + return findPetsByTagsCall(tags, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { + ApiResponse> localVarResp = findPetsByTagsWithHttpInfo(tags); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by tags (asynchronously) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsAsync(@javax.annotation.Nonnull List tags, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPetById + * @param petId ID of pet to return (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + return getPetByIdCall(petId, _callback); + + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + ApiResponse localVarResp = getPetByIdWithHttpInfo(petId); + return localVarResp.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find pet by ID (asynchronously) + * Returns a single pet + * @param petId ID of pet to return (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdAsync(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling updatePet(Async)"); + } + + return updatePetCall(pet, _callback); + + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public void updatePet(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update an existing pet (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updatePetWithForm + * @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) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetWithFormValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); + } + + return updatePetWithFormCall(petId, name, status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updates a pet in the store with form data (asynchronously) + * + * @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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for uploadFile + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); + } + + return uploadFileCall(petId, additionalMetadata, _file, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = uploadFileWithHttpInfo(petId, additionalMetadata, _file); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (asynchronously) + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..ff1582272715 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,593 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Order; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class StoreApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteOrder + * @param orderId ID of the order that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{orderId}" + .replace("{" + "orderId" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOrderValidateBeforeCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); + } + + return deleteOrderCall(orderId, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete purchase order by ID (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderAsync(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getInventory + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getInventoryCall(_callback); + + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Map getInventory() throws ApiException { + ApiResponse> localVarResp = getInventoryWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Returns pet inventories by status (asynchronously) + * Returns a map of status codes to quantities + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderById + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{orderId}" + .replace("{" + "orderId" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderByIdValidateBeforeCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); + } + + return getOrderByIdCall(orderId, _callback); + + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + ApiResponse localVarResp = getOrderByIdWithHttpInfo(orderId); + return localVarResp.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find purchase order by ID (asynchronously) + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdAsync(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for placeOrder + * @param order order placed for purchasing the pet (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = order; + + // create path and map variables + String localVarPath = "/store/order"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException("Missing the required parameter 'order' when calling placeOrder(Async)"); + } + + return placeOrderCall(order, _callback); + + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { + ApiResponse localVarResp = placeOrderWithHttpInfo(order); + return localVarResp.getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Place an order for a pet (asynchronously) + * + * @param order order placed for purchasing the pet (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderAsync(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..20ec3b5fca32 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,1105 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UserApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createUser + * @param user Created user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "auth_cookie" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUserValidateBeforeCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUser(Async)"); + } + + return createUserCall(user, _callback); + + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create user (asynchronously) + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserAsync(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithArrayInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "auth_cookie" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithArrayInput(Async)"); + } + + return createUsersWithArrayInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithListInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithList"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "auth_cookie" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithListInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithListInput(Async)"); + } + + return createUsersWithListInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteUser + * @param username The name that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "auth_cookie" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteUserValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); + } + + return deleteUserCall(username, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete user (asynchronously) + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getUserByName + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByNameValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); + } + + return getUserByNameCall(username, _callback); + + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + ApiResponse localVarResp = getUserByNameWithHttpInfo(username); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get user by user name (asynchronously) + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for loginUser + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `auth_cookie` apiKey authentication.
* 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 okhttp3.Call loginUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (username != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); + } + + if (password != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("password", password)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call loginUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); + } + + return loginUserCall(username, password, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `auth_cookie` apiKey authentication.
* 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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + ApiResponse localVarResp = loginUserWithHttpInfo(username, password); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `auth_cookie` apiKey authentication.
* 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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Logs user into the system (asynchronously) + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `auth_cookie` apiKey authentication.
* 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 okhttp3.Call loginUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for logoutUser + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "auth_cookie" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return logoutUserCall(_callback); + + } + + /** + * Logs out current logged in user session + * + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Logs out current logged in user session (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateUser + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "auth_cookie" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling updateUser(Async)"); + } + + return updateUserCall(username, user, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updated user (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..334ae1f6fd40 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..07839e9966cf --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..85d6556f1f68 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..f728b306c358 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..0b5e71fe6212 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,43 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..0de7ae9fc491 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..57db3963e4f6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..75a1d304801f --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..bdd0ae91976f --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,142 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..1332de3a1697 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,311 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A category for a pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Category { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, category.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Category + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Category.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Category' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Category.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Category value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Category read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Category given an JSON string + * + * @param jsonString JSON string + * @return An instance of Category + * @throws IOException if the JSON string is invalid with respect to Category + */ + public static Category fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Category.class); + } + + /** + * Convert an instance of Category to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..1bc343bd5338 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,341 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Describes the result of uploading an image resource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelApiResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + + public Integer getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, _apiResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("code", "type", "message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelApiResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelApiResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelApiResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelApiResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelApiResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelApiResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelApiResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelApiResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelApiResponse + * @throws IOException if the JSON string is invalid with respect to ModelApiResponse + */ + public static ModelApiResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelApiResponse.class); + } + + /** + * Convert an instance of ModelApiResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..db0571d69be1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,478 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * An order for a pets from the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Order { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_PET_ID = "petId"; + @SerializedName(SERIALIZED_NAME_PET_ID) + @javax.annotation.Nullable + private Long petId; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; + @SerializedName(SERIALIZED_NAME_SHIP_DATE) + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_COMPLETE = "complete"; + @SerializedName(SERIALIZED_NAME_COMPLETE) + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + + public Long getPetId() { + return petId; + } + + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + + public OffsetDateTime getShipDate() { + return shipDate; + } + + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + + public Boolean getComplete() { + return complete; + } + + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, order.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "petId", "quantity", "shipDate", "status", "complete")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Order + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Order.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Order' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Order.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Order value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Order read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Order instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Order given an JSON string + * + * @param jsonString JSON string + * @return An instance of Order + * @throws IOException if the JSON string is invalid with respect to Order + */ + public static Order fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Order.class); + } + + /** + * Convert an instance of Order to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..385b0eb2ad13 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,537 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A pet for sale in the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pet { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @Deprecated + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable 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 + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + @Deprecated + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + @Deprecated + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, pet.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Pet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Pet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Pet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Pet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Pet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Pet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Pet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Pet given an JSON string + * + * @param jsonString JSON string + * @return An instance of Pet + * @throws IOException if the JSON string is invalid with respect to Pet + */ + public static Pet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Pet.class); + } + + /** + * Convert an instance of Pet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases1.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases1.java new file mode 100644 index 000000000000..13c7a7de5ff4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases1.java @@ -0,0 +1,549 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A pet for sale in the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class PetWithRequiredNullableCases1 { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nullable + private List photoUrls; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags; + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @Deprecated + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetWithRequiredNullableCases1() { + } + + public PetWithRequiredNullableCases1 id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetWithRequiredNullableCases1 category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetWithRequiredNullableCases1 name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public PetWithRequiredNullableCases1 photoUrls(@javax.annotation.Nullable List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetWithRequiredNullableCases1 addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nullable + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nullable List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetWithRequiredNullableCases1 tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetWithRequiredNullableCases1 addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + @Deprecated + public PetWithRequiredNullableCases1 status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + @Deprecated + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetWithRequiredNullableCases1 instance itself + */ + public PetWithRequiredNullableCases1 putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PetWithRequiredNullableCases1 petWithRequiredNullableCases1 = (PetWithRequiredNullableCases1) o; + return Objects.equals(this.id, petWithRequiredNullableCases1.id) && + Objects.equals(this.category, petWithRequiredNullableCases1.category) && + Objects.equals(this.name, petWithRequiredNullableCases1.name) && + Objects.equals(this.photoUrls, petWithRequiredNullableCases1.photoUrls) && + Objects.equals(this.tags, petWithRequiredNullableCases1.tags) && + Objects.equals(this.status, petWithRequiredNullableCases1.status)&& + Objects.equals(this.additionalProperties, petWithRequiredNullableCases1.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetWithRequiredNullableCases1 {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PetWithRequiredNullableCases1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PetWithRequiredNullableCases1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in PetWithRequiredNullableCases1 is not found in the empty JSON string", PetWithRequiredNullableCases1.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PetWithRequiredNullableCases1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray() && !jsonObj.get("photoUrls").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PetWithRequiredNullableCases1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PetWithRequiredNullableCases1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PetWithRequiredNullableCases1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PetWithRequiredNullableCases1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PetWithRequiredNullableCases1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PetWithRequiredNullableCases1 instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PetWithRequiredNullableCases1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of PetWithRequiredNullableCases1 + * @throws IOException if the JSON string is invalid with respect to PetWithRequiredNullableCases1 + */ + public static PetWithRequiredNullableCases1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PetWithRequiredNullableCases1.class); + } + + /** + * Convert an instance of PetWithRequiredNullableCases1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases2.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases2.java new file mode 100644 index 000000000000..32bdf8ba0d06 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases2.java @@ -0,0 +1,537 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A pet for sale in the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class PetWithRequiredNullableCases2 { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @Deprecated + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetWithRequiredNullableCases2() { + } + + public PetWithRequiredNullableCases2 id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetWithRequiredNullableCases2 category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetWithRequiredNullableCases2 name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PetWithRequiredNullableCases2 photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetWithRequiredNullableCases2 addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetWithRequiredNullableCases2 tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetWithRequiredNullableCases2 addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + @Deprecated + public PetWithRequiredNullableCases2 status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + @Deprecated + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetWithRequiredNullableCases2 instance itself + */ + public PetWithRequiredNullableCases2 putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PetWithRequiredNullableCases2 petWithRequiredNullableCases2 = (PetWithRequiredNullableCases2) o; + return Objects.equals(this.id, petWithRequiredNullableCases2.id) && + Objects.equals(this.category, petWithRequiredNullableCases2.category) && + Objects.equals(this.name, petWithRequiredNullableCases2.name) && + Objects.equals(this.photoUrls, petWithRequiredNullableCases2.photoUrls) && + Objects.equals(this.tags, petWithRequiredNullableCases2.tags) && + Objects.equals(this.status, petWithRequiredNullableCases2.status)&& + Objects.equals(this.additionalProperties, petWithRequiredNullableCases2.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetWithRequiredNullableCases2 {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PetWithRequiredNullableCases2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PetWithRequiredNullableCases2.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in PetWithRequiredNullableCases2 is not found in the empty JSON string", PetWithRequiredNullableCases2.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PetWithRequiredNullableCases2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PetWithRequiredNullableCases2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PetWithRequiredNullableCases2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PetWithRequiredNullableCases2.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PetWithRequiredNullableCases2 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PetWithRequiredNullableCases2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PetWithRequiredNullableCases2 instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PetWithRequiredNullableCases2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of PetWithRequiredNullableCases2 + * @throws IOException if the JSON string is invalid with respect to PetWithRequiredNullableCases2 + */ + public static PetWithRequiredNullableCases2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PetWithRequiredNullableCases2.class); + } + + /** + * Convert an instance of PetWithRequiredNullableCases2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..de14a3aee9b3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,311 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A tag for a pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Tag { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Tag + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Tag.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Tag' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Tag value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Tag read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Tag given an JSON string + * + * @param jsonString JSON string + * @return An instance of Tag + * @throws IOException if the JSON string is invalid with respect to Tag + */ + public static Tag fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Tag.class); + } + + /** + * Convert an instance of Tag to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..01d7a093236a --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,488 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A User who is purchasing from the pet store + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class User { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nullable + private String username; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nullable + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nullable + private String lastName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nullable + private String password; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nullable + private String phone; + + public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; + @SerializedName(SERIALIZED_NAME_USER_STATUS) + @javax.annotation.Nullable + private Integer userStatus; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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.additionalProperties, user.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to User + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) && !jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!User.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'User' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(User.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, User value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public User read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of User given an JSON string + * + * @param jsonString JSON string + * @return An instance of User + * @throws IOException if the JSON string is invalid with respect to User + */ + public static User fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, User.class); + } + + /** + * Convert an instance of User to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..0b99fe9d3414 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,153 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + api.addPet(pet); + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + api.updatePet(pet); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.uploadFile(petId, additionalMetadata, _file); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..3ca20d0b210b --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,89 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = api.getOrderById(orderId); + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order order = null; + Order response = api.placeOrder(order); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..a46743c4435d --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,148 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User user = null; + api.createUser(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List user = null; + api.createUsersWithArrayInput(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List user = null; + api.createUsersWithListInput(user); + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + api.deleteUser(username); + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + api.logoutUser(); + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User user = null; + api.updateUser(username, user); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..5bf64f190609 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..91f7c6e7b08b --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..68d51864f2e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..1dbb74a230c4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/PetWithRequiredNullableCases1Test.java b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/PetWithRequiredNullableCases1Test.java new file mode 100644 index 000000000000..22d6e60cebd1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/PetWithRequiredNullableCases1Test.java @@ -0,0 +1,93 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetWithRequiredNullableCases1 + */ +public class PetWithRequiredNullableCases1Test { + private final PetWithRequiredNullableCases1 model = new PetWithRequiredNullableCases1(); + + /** + * Model tests for PetWithRequiredNullableCases1 + */ + @Test + public void testPetWithRequiredNullableCases1() { + // TODO: test PetWithRequiredNullableCases1 + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/PetWithRequiredNullableCases2Test.java b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/PetWithRequiredNullableCases2Test.java new file mode 100644 index 000000000000..c2db3ed6f9c2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/PetWithRequiredNullableCases2Test.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetWithRequiredNullableCases2 + */ +public class PetWithRequiredNullableCases2Test { + private final PetWithRequiredNullableCases2 model = new PetWithRequiredNullableCases2(); + + /** + * Model tests for PetWithRequiredNullableCases2 + */ + @Test + public void testPetWithRequiredNullableCases2() { + // TODO: test PetWithRequiredNullableCases2 + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..baef6f40d3a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..1be6c73e32cd --- /dev/null +++ b/samples/client/petstore/java/okhttp-nullable-required/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp-parcelableModel/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp-parcelableModel/.gitignore b/samples/client/petstore/java/okhttp-parcelableModel/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/.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/client/petstore/java/okhttp-parcelableModel/.openapi-generator-ignore b/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/.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/client/petstore/java/okhttp-parcelableModel/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/FILES new file mode 100644 index 000000000000..4d513a032b3c --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/FILES @@ -0,0 +1,191 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/AdditionalPropertiesAnyType.md +docs/AdditionalPropertiesArray.md +docs/AdditionalPropertiesBoolean.md +docs/AdditionalPropertiesClass.md +docs/AdditionalPropertiesInteger.md +docs/AdditionalPropertiesNumber.md +docs/AdditionalPropertiesObject.md +docs/AdditionalPropertiesString.md +docs/Animal.md +docs/AnotherFakeApi.md +docs/ArrayOfArrayOfNumberOnly.md +docs/ArrayOfNumberOnly.md +docs/ArrayTest.md +docs/BigCat.md +docs/Capitalization.md +docs/Cat.md +docs/Category.md +docs/ClassModel.md +docs/Client.md +docs/Dog.md +docs/EnumArrays.md +docs/EnumClass.md +docs/EnumTest.md +docs/FakeApi.md +docs/FakeClassnameTags123Api.md +docs/FileSchemaTestClass.md +docs/FormatTest.md +docs/HasOnlyReadOnly.md +docs/MapTest.md +docs/MixedPropertiesAndAdditionalPropertiesClass.md +docs/Model200Response.md +docs/ModelApiResponse.md +docs/ModelFile.md +docs/ModelList.md +docs/ModelReturn.md +docs/Name.md +docs/NumberOnly.md +docs/Order.md +docs/OuterComposite.md +docs/OuterEnum.md +docs/Pet.md +docs/PetApi.md +docs/ReadOnlyFirst.md +docs/SpecialModelName.md +docs/StoreApi.md +docs/Tag.md +docs/TypeHolderDefault.md +docs/TypeHolderExample.md +docs/User.md +docs/UserApi.md +docs/XmlItem.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/AnotherFakeApi.java +src/main/java/org/openapitools/client/api/FakeApi.java +src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +src/main/java/org/openapitools/client/model/Animal.java +src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayTest.java +src/main/java/org/openapitools/client/model/BigCat.java +src/main/java/org/openapitools/client/model/Capitalization.java +src/main/java/org/openapitools/client/model/Cat.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ClassModel.java +src/main/java/org/openapitools/client/model/Client.java +src/main/java/org/openapitools/client/model/Dog.java +src/main/java/org/openapitools/client/model/EnumArrays.java +src/main/java/org/openapitools/client/model/EnumClass.java +src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +src/main/java/org/openapitools/client/model/FormatTest.java +src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +src/main/java/org/openapitools/client/model/MapTest.java +src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/Model200Response.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/ModelFile.java +src/main/java/org/openapitools/client/model/ModelList.java +src/main/java/org/openapitools/client/model/ModelReturn.java +src/main/java/org/openapitools/client/model/Name.java +src/main/java/org/openapitools/client/model/NumberOnly.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/OuterComposite.java +src/main/java/org/openapitools/client/model/OuterEnum.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +src/main/java/org/openapitools/client/model/SpecialModelName.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/TypeHolderDefault.java +src/main/java/org/openapitools/client/model/TypeHolderExample.java +src/main/java/org/openapitools/client/model/User.java +src/main/java/org/openapitools/client/model/XmlItem.java +src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java +src/test/java/org/openapitools/client/api/FakeApiTest.java +src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java +src/test/java/org/openapitools/client/model/AnimalTest.java +src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayTestTest.java +src/test/java/org/openapitools/client/model/BigCatTest.java +src/test/java/org/openapitools/client/model/CapitalizationTest.java +src/test/java/org/openapitools/client/model/CatTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ClassModelTest.java +src/test/java/org/openapitools/client/model/ClientTest.java +src/test/java/org/openapitools/client/model/DogTest.java +src/test/java/org/openapitools/client/model/EnumArraysTest.java +src/test/java/org/openapitools/client/model/EnumClassTest.java +src/test/java/org/openapitools/client/model/EnumTestTest.java +src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java +src/test/java/org/openapitools/client/model/FormatTestTest.java +src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java +src/test/java/org/openapitools/client/model/MapTestTest.java +src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java +src/test/java/org/openapitools/client/model/Model200ResponseTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/ModelFileTest.java +src/test/java/org/openapitools/client/model/ModelListTest.java +src/test/java/org/openapitools/client/model/ModelReturnTest.java +src/test/java/org/openapitools/client/model/NameTest.java +src/test/java/org/openapitools/client/model/NumberOnlyTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/OuterCompositeTest.java +src/test/java/org/openapitools/client/model/OuterEnumTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java +src/test/java/org/openapitools/client/model/SpecialModelNameTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java +src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java +src/test/java/org/openapitools/client/model/UserTest.java +src/test/java/org/openapitools/client/model/XmlItemTest.java diff --git a/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-parcelableModel/.travis.yml b/samples/client/petstore/java/okhttp-parcelableModel/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/.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/client/petstore/java/okhttp-parcelableModel/README.md b/samples/client/petstore/java/okhttp-parcelableModel/README.md new file mode 100644 index 000000000000..0810e597b2c8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/README.md @@ -0,0 +1,248 @@ +# petstore-okhttp-parcelableModel + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-okhttp-parcelableModel + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-okhttp-parcelableModel' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp-parcelableModel' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp-parcelableModel:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/petstore-okhttp-parcelableModel-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + UUID uuidTest = UUID.randomUUID(); // UUID | to test uuid example value + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(uuidTest, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +*FakeApi* | [**createXmlItem**](docs/FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem +*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +*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* | [**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 +*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | +*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md) + - [AdditionalPropertiesArray](docs/AdditionalPropertiesArray.md) + - [AdditionalPropertiesBoolean](docs/AdditionalPropertiesBoolean.md) + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AdditionalPropertiesInteger](docs/AdditionalPropertiesInteger.md) + - [AdditionalPropertiesNumber](docs/AdditionalPropertiesNumber.md) + - [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md) + - [AdditionalPropertiesString](docs/AdditionalPropertiesString.md) + - [Animal](docs/Animal.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayTest](docs/ArrayTest.md) + - [BigCat](docs/BigCat.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [Category](docs/Category.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [Dog](docs/Dog.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumTest](docs/EnumTest.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [FormatTest](docs/FormatTest.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [ModelFile](docs/ModelFile.md) + - [ModelList](docs/ModelList.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [NumberOnly](docs/NumberOnly.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [Pet](docs/Pet.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [TypeHolderDefault](docs/TypeHolderDefault.md) + - [TypeHolderExample](docs/TypeHolderExample.md) + - [User](docs/User.md) + - [XmlItem](docs/XmlItem.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/api/openapi.yaml b/samples/client/petstore/java/okhttp-parcelableModel/api/openapi.yaml new file mode 100644 index 000000000000..426145d1685a --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/api/openapi.yaml @@ -0,0 +1,2255 @@ +openapi: 3.0.1 +info: + description: "This spec is mainly for testing Petstore server and contains fake\ + \ endpoints, models. Please do not use this for any other purpose. Special characters:\ + \ \" \\" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- url: http://petstore.swagger.io:80/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + responses: + "200": + content: {} + description: successful operation + "405": + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + put: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + responses: + "200": + content: {} + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Pet not found + "405": + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + uniqueItems: true + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + uniqueItems: true + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + uniqueItems: true + description: successful operation + "400": + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + "200": + content: {} + description: successful operation + "400": + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + operationId: placeOrder + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - application/json + - application/xml + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: order_id + required: true + schema: + type: string + responses: + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - application/json + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + content: + '*/*': + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - application/json + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + content: + '*/*': + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - application/json + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + "400": + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + operationId: logoutUser + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + content: {} + description: Invalid user supplied + "404": + content: {} + description: User not found + summary: Updated user + tags: + - user + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - application/json + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + in: query + name: required_string_group + required: true + schema: + type: integer + - description: Required Boolean in group parameters + in: header + name: required_boolean_group + required: true + schema: + type: boolean + - description: Required Integer in group parameters + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + - description: String in group parameters + in: query + name: string_group + schema: + type: integer + - description: Boolean in group parameters + in: header + name: boolean_group + schema: + type: boolean + - description: Integer in group parameters + in: query + name: int64_group + schema: + format: int64 + type: integer + responses: + "400": + content: {} + description: Something wrong + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + x-accepts: + - application/json + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + in: header + name: enum_header_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (string array) + explode: false + in: query + name: enum_query_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + in: query + name: enum_query_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (double) + in: query + name: enum_query_integer + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + - description: Query parameter enum test (double) + in: query + name: enum_query_double + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEnumParameters_request" + responses: + "400": + content: {} + description: Invalid request + "404": + content: {} + description: Not found + summary: To test enum parameters + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test "client" model + tags: + - fake + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + post: + description: |- + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEndpointParameters_request" + required: true + responses: + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + security: + - http_basic_test: [] + summary: |- + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterNumber" + description: Input number as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterNumber" + description: Output number + tags: + - fake + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - '*/*' + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterString" + description: Input string as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterString" + description: Output string + tags: + - fake + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - '*/*' + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Input boolean as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Output boolean + tags: + - fake + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - '*/*' + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterComposite" + description: Input composite as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterComposite" + description: Output composite + tags: + - fake + x-codegen-request-body-name: body + x-content-type: '*/*' + x-accepts: + - '*/*' + /fake/jsonFormData: + get: + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testJsonFormData_request" + required: true + responses: + "200": + content: {} + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/inline-additionalProperties: + post: + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + "200": + content: {} + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-codegen-request-body-name: param + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - in: query + name: query + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + required: true + responses: + "200": + content: {} + description: Success + tags: + - fake + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + /fake/create_xml_item: + post: + description: this route creates an XmlItem + operationId: createXmlItem + requestBody: + content: + application/xml: + schema: + $ref: "#/components/schemas/XmlItem" + application/xml; charset=utf-8: + schema: + $ref: "#/components/schemas/XmlItem" + application/xml; charset=utf-16: + schema: + $ref: "#/components/schemas/XmlItem" + text/xml: + schema: + $ref: "#/components/schemas/XmlItem" + text/xml; charset=utf-8: + schema: + $ref: "#/components/schemas/XmlItem" + text/xml; charset=utf-16: + schema: + $ref: "#/components/schemas/XmlItem" + description: XmlItem Body + required: true + responses: + "200": + content: {} + description: successful operation + summary: creates an XmlItem + tags: + - fake + x-codegen-request-body-name: XmlItem + x-content-type: application/xml + x-accepts: + - application/json + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + parameters: + - description: to test uuid example value + in: header + name: uuid_test + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-file-schema: + put: + description: "For this test, the body for this request much reference a schema\ + \ named `File`." + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FileSchemaTestClass" + required: true + responses: + "200": + content: {} + description: Success + tags: + - fake + x-codegen-request-body-name: body + x-content-type: application/json + x-accepts: + - application/json + /fake/test-query-parameters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: false + in: query + name: pipe + required: true + schema: + items: + type: string + type: array + style: form + - in: query + name: ioutil + required: true + schema: + items: + type: string + type: array + - in: query + name: http + required: true + schema: + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: {} + description: Success + tags: + - fake + x-accepts: + - application/json + /fake/{petId}/uploadImageWithRequiredFile: + post: + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFileWithRequiredFile_request" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json +components: + schemas: + Order: + example: + id: 0 + petId: 6 + quantity: 1 + shipDate: 2000-01-23T04:56:07.000+00:00 + status: placed + complete: false + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + id: 6 + name: default-name + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + id: 0 + username: username + firstName: firstName + lastName: lastName + email: email + password: password + phone: phone + userStatus: 6 + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + Tag: + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + id: 0 + category: + id: 6 + name: default-name + name: doggie + photoUrls: + - photoUrls + - photoUrls + tags: + - id: 1 + name: name + - id: 1 + name: name + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + uniqueItems: true + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + $special[model.name]: + properties: + $special[property.name]: + format: int64 + type: integer + type: object + xml: + name: "$special[model.name]" + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + type: object + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + "123Number": + readOnly: true + type: integer + required: + - name + type: object + xml: + name: Name + "200_response": + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + type: object + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + type: object + Dog: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + declawed: + type: boolean + type: object + BigCat: + allOf: + - $ref: "#/components/schemas/Cat" + - properties: + kind: + enum: + - lions + - tigers + - leopards + - jaguars + type: string + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: "#/components/schemas/Animal" + type: array + format_test: + properties: + integer: + maximum: 100 + minimum: 10 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + pattern: "/[a-z]/i" + type: string + byte: + format: byte + pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + BigDecimal: + format: number + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: "#/components/schemas/OuterEnum" + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_string: + additionalProperties: + type: string + type: object + map_number: + additionalProperties: + type: number + type: object + map_integer: + additionalProperties: + type: integer + type: object + map_boolean: + additionalProperties: + type: boolean + type: object + map_array_integer: + additionalProperties: + items: + type: integer + type: array + type: object + map_array_anytype: + additionalProperties: + items: + properties: {} + type: object + type: array + type: object + map_map_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_map_anytype: + additionalProperties: + additionalProperties: + properties: {} + type: object + type: object + type: object + anytype_1: + properties: {} + type: object + anytype_2: + type: object + anytype_3: + properties: {} + type: object + type: object + AdditionalPropertiesString: + additionalProperties: + type: string + properties: + name: + type: string + type: object + AdditionalPropertiesInteger: + additionalProperties: + type: integer + properties: + name: + type: string + type: object + AdditionalPropertiesNumber: + additionalProperties: + type: number + properties: + name: + type: string + type: object + AdditionalPropertiesBoolean: + additionalProperties: + type: boolean + properties: + name: + type: string + type: object + AdditionalPropertiesArray: + additionalProperties: + items: + properties: {} + type: object + type: array + properties: + name: + type: string + type: object + AdditionalPropertiesObject: + additionalProperties: + additionalProperties: + properties: {} + type: object + type: object + properties: + name: + type: string + type: object + AdditionalPropertiesAnyType: + additionalProperties: + properties: {} + type: object + properties: + name: + type: string + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: "#/components/schemas/Animal" + type: object + type: object + List: + properties: + "123-list": + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + type: object + ArrayTest: + properties: + array_of_string: + items: + type: string + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: "#/components/schemas/ReadOnlyFirst" + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + type: string + OuterComposite: + example: + my_number: 0.8008281904610115 + my_string: my_string + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: "#/components/schemas/File" + files: + items: + $ref: "#/components/schemas/File" + type: array + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + TypeHolderDefault: + properties: + string_item: + default: what + type: string + number_item: + type: number + integer_item: + type: integer + bool_item: + default: true + type: boolean + array_item: + items: + type: integer + type: array + required: + - array_item + - bool_item + - integer_item + - number_item + - string_item + type: object + TypeHolderExample: + properties: + string_item: + example: what + type: string + number_item: + example: 1.234 + type: number + float_item: + example: 1.234 + format: float + type: number + integer_item: + example: -2 + type: integer + bool_item: + example: true + type: boolean + array_item: + example: + - 0 + - 1 + - 2 + - 3 + items: + type: integer + type: array + required: + - array_item + - bool_item + - float_item + - integer_item + - number_item + - string_item + type: object + XmlItem: + properties: + attribute_string: + example: string + type: string + xml: + attribute: true + attribute_number: + example: 1.234 + type: number + xml: + attribute: true + attribute_integer: + example: -2 + type: integer + xml: + attribute: true + attribute_boolean: + example: true + type: boolean + xml: + attribute: true + wrapped_array: + items: + type: integer + type: array + xml: + wrapped: true + name_string: + example: string + type: string + xml: + name: xml_name_string + name_number: + example: 1.234 + type: number + xml: + name: xml_name_number + name_integer: + example: -2 + type: integer + xml: + name: xml_name_integer + name_boolean: + example: true + type: boolean + xml: + name: xml_name_boolean + name_array: + items: + type: integer + xml: + name: xml_name_array_item + type: array + name_wrapped_array: + items: + type: integer + xml: + name: xml_name_wrapped_array_item + type: array + xml: + name: xml_name_wrapped_array + wrapped: true + prefix_string: + example: string + type: string + xml: + prefix: ab + prefix_number: + example: 1.234 + type: number + xml: + prefix: cd + prefix_integer: + example: -2 + type: integer + xml: + prefix: ef + prefix_boolean: + example: true + type: boolean + xml: + prefix: gh + prefix_array: + items: + type: integer + xml: + prefix: ij + type: array + prefix_wrapped_array: + items: + type: integer + xml: + prefix: mn + type: array + xml: + prefix: kl + wrapped: true + namespace_string: + example: string + type: string + xml: + namespace: http://a.com/schema + namespace_number: + example: 1.234 + type: number + xml: + namespace: http://b.com/schema + namespace_integer: + example: -2 + type: integer + xml: + namespace: http://c.com/schema + namespace_boolean: + example: true + type: boolean + xml: + namespace: http://d.com/schema + namespace_array: + items: + type: integer + xml: + namespace: http://e.com/schema + type: array + namespace_wrapped_array: + items: + type: integer + xml: + namespace: http://g.com/schema + type: array + xml: + namespace: http://f.com/schema + wrapped: true + prefix_ns_string: + example: string + type: string + xml: + namespace: http://a.com/schema + prefix: a + prefix_ns_number: + example: 1.234 + type: number + xml: + namespace: http://b.com/schema + prefix: b + prefix_ns_integer: + example: -2 + type: integer + xml: + namespace: http://c.com/schema + prefix: c + prefix_ns_boolean: + example: true + type: boolean + xml: + namespace: http://d.com/schema + prefix: d + prefix_ns_array: + items: + type: integer + xml: + namespace: http://e.com/schema + prefix: e + type: array + prefix_ns_wrapped_array: + items: + type: integer + xml: + namespace: http://g.com/schema + prefix: g + type: array + xml: + namespace: http://f.com/schema + prefix: f + wrapped: true + type: object + xml: + namespace: http://a.com/schema + prefix: pre + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + testEndpointParameters_request: + properties: + integer: + description: None + format: int32 + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: "/[a-z]/i" + type: string + pattern_without_delimiter: + description: None + pattern: "^[A-Z].*" + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http +x-original-swagger-version: "2.0" + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/build.gradle b/samples/client/petstore/java/okhttp-parcelableModel/build.gradle new file mode 100644 index 000000000000..29d0cc22785b --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/build.gradle @@ -0,0 +1,64 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-okhttp-parcelableModel' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/build.sbt b/samples/client/petstore/java/okhttp-parcelableModel/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesAnyType.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesAnyType.md new file mode 100644 index 000000000000..c82a93daa893 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesAnyType.md @@ -0,0 +1,17 @@ + + +# AdditionalPropertiesAnyType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesArray.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesArray.md new file mode 100644 index 000000000000..e9d5836db7c2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesArray.md @@ -0,0 +1,17 @@ + + +# AdditionalPropertiesArray + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesBoolean.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesBoolean.md new file mode 100644 index 000000000000..0e757ef23361 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesBoolean.md @@ -0,0 +1,17 @@ + + +# AdditionalPropertiesBoolean + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..3a11068b8e7c --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesClass.md @@ -0,0 +1,27 @@ + + +# AdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapString** | **Map<String, String>** | | [optional] | +|**mapNumber** | **Map<String, BigDecimal>** | | [optional] | +|**mapInteger** | **Map<String, Integer>** | | [optional] | +|**mapBoolean** | **Map<String, Boolean>** | | [optional] | +|**mapArrayInteger** | **Map<String, List<Integer>>** | | [optional] | +|**mapArrayAnytype** | **Map<String, List<Object>>** | | [optional] | +|**mapMapString** | **Map<String, Map<String, String>>** | | [optional] | +|**mapMapAnytype** | **Map<String, Map<String, Object>>** | | [optional] | +|**anytype1** | **Object** | | [optional] | +|**anytype2** | **Object** | | [optional] | +|**anytype3** | **Object** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesInteger.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesInteger.md new file mode 100644 index 000000000000..4d1104b4a736 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesInteger.md @@ -0,0 +1,17 @@ + + +# AdditionalPropertiesInteger + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesNumber.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesNumber.md new file mode 100644 index 000000000000..f6bfc6846e82 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesNumber.md @@ -0,0 +1,17 @@ + + +# AdditionalPropertiesNumber + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesObject.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesObject.md new file mode 100644 index 000000000000..5c707b35628b --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesObject.md @@ -0,0 +1,17 @@ + + +# AdditionalPropertiesObject + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesString.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesString.md new file mode 100644 index 000000000000..c5aad6be6b85 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/AdditionalPropertiesString.md @@ -0,0 +1,17 @@ + + +# AdditionalPropertiesString + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/Animal.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/Animal.md new file mode 100644 index 000000000000..ae2ce0126db9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/Animal.md @@ -0,0 +1,18 @@ + + +# Animal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | +|**color** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/AnotherFakeApi.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/AnotherFakeApi.md new file mode 100644 index 000000000000..3b390ea25a0c --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/AnotherFakeApi.md @@ -0,0 +1,73 @@ +# AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags | + + + +# **call123testSpecialTags** +> Client call123testSpecialTags(uuidTest, body) + +To test special tags + +To test special tags and operation ID starting with number + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + UUID uuidTest = UUID.randomUUID(); // UUID | to test uuid example value + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(uuidTest, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **uuidTest** | **UUID**| to test uuid example value | | +| **body** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..35d3ea269859 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,17 @@ + + +# ArrayOfArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayArrayNumber** | **List<List<BigDecimal>>** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..8eaf38152c1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/ArrayOfNumberOnly.md @@ -0,0 +1,17 @@ + + +# ArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayNumber** | **List<BigDecimal>** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/ArrayTest.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/ArrayTest.md new file mode 100644 index 000000000000..8f89f5362701 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/ArrayTest.md @@ -0,0 +1,19 @@ + + +# ArrayTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayOfString** | **List<String>** | | [optional] | +|**arrayArrayOfInteger** | **List<List<Long>>** | | [optional] | +|**arrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/BigCat.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/BigCat.md new file mode 100644 index 000000000000..64a96ad74aeb --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/BigCat.md @@ -0,0 +1,28 @@ + + +# BigCat + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**kind** | [**KindEnum**](#KindEnum) | | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| LIONS | "lions" | +| TIGERS | "tigers" | +| LEOPARDS | "leopards" | +| JAGUARS | "jaguars" | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/Capitalization.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/Capitalization.md new file mode 100644 index 000000000000..7d9872100808 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/Capitalization.md @@ -0,0 +1,22 @@ + + +# Capitalization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**smallCamel** | **String** | | [optional] | +|**capitalCamel** | **String** | | [optional] | +|**smallSnake** | **String** | | [optional] | +|**capitalSnake** | **String** | | [optional] | +|**scAETHFlowPoints** | **String** | | [optional] | +|**ATT_NAME** | **String** | Name of the pet | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/Cat.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/Cat.md new file mode 100644 index 000000000000..a4b8360402b3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/Cat.md @@ -0,0 +1,17 @@ + + +# Cat + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**declawed** | **Boolean** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/Category.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/Category.md new file mode 100644 index 000000000000..b5b119606f4f --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/Category.md @@ -0,0 +1,18 @@ + + +# Category + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/ClassModel.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/ClassModel.md new file mode 100644 index 000000000000..67edef34a0ae --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/ClassModel.md @@ -0,0 +1,18 @@ + + +# ClassModel + +Model for testing model with \"_class\" property + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**propertyClass** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/Client.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/Client.md new file mode 100644 index 000000000000..ee5a735c5696 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/Client.md @@ -0,0 +1,17 @@ + + +# Client + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**client** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/Dog.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/Dog.md new file mode 100644 index 000000000000..fd803e576b95 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/Dog.md @@ -0,0 +1,17 @@ + + +# Dog + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/EnumArrays.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/EnumArrays.md new file mode 100644 index 000000000000..80c93235108d --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/EnumArrays.md @@ -0,0 +1,36 @@ + + +# EnumArrays + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] | +|**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] | + + + +## Enum: JustSymbolEnum + +| Name | Value | +|---- | -----| +| GREATER_THAN_OR_EQUAL_TO | ">=" | +| DOLLAR | "$" | + + + +## Enum: List<ArrayEnumEnum> + +| Name | Value | +|---- | -----| +| FISH | "fish" | +| CRAB | "crab" | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/EnumClass.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/EnumClass.md new file mode 100644 index 000000000000..b314590a7591 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/EnumClass.md @@ -0,0 +1,15 @@ + + +# EnumClass + +## Enum + + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/EnumTest.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/EnumTest.md new file mode 100644 index 000000000000..f1c7b26f3776 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/EnumTest.md @@ -0,0 +1,59 @@ + + +# EnumTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] | +|**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | | +|**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] | +|**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] | +|**outerEnum** | **OuterEnum** | | [optional] | + + + +## Enum: EnumStringEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumStringRequiredEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumIntegerEnum + +| Name | Value | +|---- | -----| +| NUMBER_1 | 1 | +| NUMBER_MINUS_1 | -1 | + + + +## Enum: EnumNumberEnum + +| Name | Value | +|---- | -----| +| NUMBER_1_DOT_1 | 1.1 | +| NUMBER_MINUS_1_DOT_2 | -1.2 | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/FakeApi.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/FakeApi.md new file mode 100644 index 000000000000..98f0b0098b8b --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/FakeApi.md @@ -0,0 +1,949 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createXmlItem**](FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem | +| [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | +| [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | | +| [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | | +| [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | | +| [**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 | +| [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 | +| [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters | +| [**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) | +| [**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties | +| [**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data | +| [**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | | + + + +# **createXmlItem** +> createXmlItem(xmlItem) + +creates an XmlItem + +this route creates an XmlItem + +### 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); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### 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); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **Boolean**| Input boolean as post body | [optional] | + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### 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); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] | + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### 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); + BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **BigDecimal**| Input number as post body | [optional] | + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### 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); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **String**| Input string as post body | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(body) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +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); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(query, body) + + + +### 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); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **query** | **String**| | | +| **body** | [**User**](User.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testClientModel** +> Client testClientModel(body) + +To test \"client\" model + +To test \"client\" model + +### 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); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testEndpointParameters** +> testEndpointParameters(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 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(78); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = LocalDate.now(); // LocalDate | None + OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **number** | **BigDecimal**| None | | +| **_double** | **Double**| None | | +| **patternWithoutDelimiter** | **String**| None | | +| **_byte** | **byte[]**| None | | +| **integer** | **Integer**| None | [optional] | +| **int32** | **Integer**| None | [optional] | +| **int64** | **Long**| None | [optional] | +| **_float** | **Float**| None | [optional] | +| **string** | **String**| None | [optional] | +| **binary** | **File**| None | [optional] | +| **date** | **LocalDate**| None | [optional] | +| **dateTime** | **OffsetDateTime**| None | [optional] | +| **password** | **String**| None | [optional] | +| **paramCallback** | **String**| None | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **testEnumParameters** +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### 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); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "_abc"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "_abc"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 1; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 1.1D; // Double | Query parameter enum test (double) + List enumFormStringArray = Arrays.asList("$"); // List | Form parameter enum test (string array) + String enumFormString = "_abc"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] | +| **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] | +| **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] | +| **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] | +| **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] | +| **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + + +# **testGroupParameters** +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group).stringGroup(stringGroup).booleanGroup(booleanGroup).int64Group(int64Group).execute(); + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### 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); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requiredStringGroup** | **Integer**| Required String in group parameters | | +| **requiredBooleanGroup** | **Boolean**| Required Boolean in group parameters | | +| **requiredInt64Group** | **Long**| Required Integer in group parameters | | +| **stringGroup** | **Integer**| String in group parameters | [optional] | +| **booleanGroup** | **Boolean**| Boolean in group parameters | [optional] | +| **int64Group** | **Long**| Integer in group parameters | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Something wrong | - | + + +# **testInlineAdditionalProperties** +> testInlineAdditionalProperties(param) + +test inline additionalProperties + +### 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); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **param** | [**Map<String, String>**](String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + +### 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); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **param** | **String**| field1 | | +| **param2** | **String**| field2 | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + + +To test the collection format in query parameters + +### 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); + List pipe = Arrays.asList(); // List | + List ioutil = Arrays.asList(); // List | + List http = Arrays.asList(); // List | + List url = Arrays.asList(); // List | + List context = Arrays.asList(); // List | + try { + apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pipe** | [**List<String>**](String.md)| | | +| **ioutil** | [**List<String>**](String.md)| | | +| **http** | [**List<String>**](String.md)| | | +| **url** | [**List<String>**](String.md)| | | +| **context** | [**List<String>**](String.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..e9f04dd15e3a --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/FakeClassnameTags123Api.md @@ -0,0 +1,78 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case | + + + +# **testClassname** +> Client testClassname(body) + +To test class name in snake case + +To test class name in snake case + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); + + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/FileSchemaTestClass.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..4fa3d346ea5e --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/FileSchemaTestClass.md @@ -0,0 +1,18 @@ + + +# FileSchemaTestClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_file** | [**ModelFile**](ModelFile.md) | | [optional] | +|**files** | [**List<ModelFile>**](ModelFile.md) | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/FormatTest.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/FormatTest.md new file mode 100644 index 000000000000..453c512d6107 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/FormatTest.md @@ -0,0 +1,30 @@ + + +# FormatTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integer** | **Integer** | | [optional] | +|**int32** | **Integer** | | [optional] | +|**int64** | **Long** | | [optional] | +|**number** | **BigDecimal** | | | +|**_float** | **Float** | | [optional] | +|**_double** | **Double** | | [optional] | +|**string** | **String** | | [optional] | +|**_byte** | **byte[]** | | | +|**binary** | **File** | | [optional] | +|**date** | **LocalDate** | | | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**uuid** | **UUID** | | [optional] | +|**password** | **String** | | | +|**bigDecimal** | **BigDecimal** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/HasOnlyReadOnly.md new file mode 100644 index 000000000000..4cf8211cfd48 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/HasOnlyReadOnly.md @@ -0,0 +1,18 @@ + + +# HasOnlyReadOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**foo** | **String** | | [optional] [readonly] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/MapTest.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/MapTest.md new file mode 100644 index 000000000000..cf7ce3afb579 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/MapTest.md @@ -0,0 +1,29 @@ + + +# MapTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapMapOfString** | **Map<String, Map<String, String>>** | | [optional] | +|**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] | +|**directMap** | **Map<String, Boolean>** | | [optional] | +|**indirectMap** | **Map<String, Boolean>** | | [optional] | + + + +## Enum: Map<String, InnerEnum> + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..67a556da124d --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,19 @@ + + +# MixedPropertiesAndAdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **UUID** | | [optional] | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**map** | [**Map<String, Animal>**](Animal.md) | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/Model200Response.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/Model200Response.md new file mode 100644 index 000000000000..20aaf612db6f --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/Model200Response.md @@ -0,0 +1,19 @@ + + +# Model200Response + +Model for testing model name starting with number + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | [optional] | +|**propertyClass** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/ModelApiResponse.md new file mode 100644 index 000000000000..6d5387f9a58c --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/ModelApiResponse.md @@ -0,0 +1,19 @@ + + +# ModelApiResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/ModelFile.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/ModelFile.md new file mode 100644 index 000000000000..a78cce44adb0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/ModelFile.md @@ -0,0 +1,18 @@ + + +# ModelFile + +Must be named `File` for test. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**sourceURI** | **String** | Test capitalization | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/ModelList.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/ModelList.md new file mode 100644 index 000000000000..c922ba375a64 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/ModelList.md @@ -0,0 +1,17 @@ + + +# ModelList + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_123list** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/ModelReturn.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/ModelReturn.md new file mode 100644 index 000000000000..1467e52330b4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/ModelReturn.md @@ -0,0 +1,18 @@ + + +# ModelReturn + +Model for testing reserved words + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_return** | **Integer** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/Name.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/Name.md new file mode 100644 index 000000000000..9b98abb758ef --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/Name.md @@ -0,0 +1,21 @@ + + +# Name + +Model for testing model name same as property name + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | | +|**snakeCase** | **Integer** | | [optional] [readonly] | +|**property** | **String** | | [optional] | +|**_123number** | **Integer** | | [optional] [readonly] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/NumberOnly.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/NumberOnly.md new file mode 100644 index 000000000000..36003207de17 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/NumberOnly.md @@ -0,0 +1,17 @@ + + +# NumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justNumber** | **BigDecimal** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/Order.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/Order.md new file mode 100644 index 000000000000..04a1f5b3c7e0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/Order.md @@ -0,0 +1,32 @@ + + +# Order + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/OuterComposite.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/OuterComposite.md new file mode 100644 index 000000000000..9117d2e6300d --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/OuterComposite.md @@ -0,0 +1,19 @@ + + +# OuterComposite + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**myNumber** | **BigDecimal** | | [optional] | +|**myString** | **String** | | [optional] | +|**myBoolean** | **Boolean** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/OuterEnum.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/OuterEnum.md new file mode 100644 index 000000000000..1f9b723eb8e7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/OuterEnum.md @@ -0,0 +1,15 @@ + + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/Pet.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/Pet.md new file mode 100644 index 000000000000..701df9201543 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/Pet.md @@ -0,0 +1,32 @@ + + +# Pet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **Set<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/PetApi.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/PetApi.md new file mode 100644 index 000000000000..7e992889a380 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/PetApi.md @@ -0,0 +1,629 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | +| [**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) | + + + +# **addPet** +> addPet(body) + +Add a new pet to the store + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +# **findPetsByTags** +> Set<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Set tags = new LinkedHashSet<>(); // Set | Tags to filter by + try { + Set result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**Set<String>**](String.md)| Tags to filter by | | + +### Return type + +[**Set<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +# **updatePet** +> updatePet(body) + +Update an existing pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **uploadFileWithRequiredFile** +> ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **requiredFile** | **File**| file to upload | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/ReadOnlyFirst.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/ReadOnlyFirst.md new file mode 100644 index 000000000000..fc0e46cab35e --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/ReadOnlyFirst.md @@ -0,0 +1,18 @@ + + +# ReadOnlyFirst + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**baz** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/SpecialModelName.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/SpecialModelName.md new file mode 100644 index 000000000000..43985e5171f5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/SpecialModelName.md @@ -0,0 +1,17 @@ + + +# SpecialModelName + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**$specialPropertyName** | **Long** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/StoreApi.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/StoreApi.md new file mode 100644 index 000000000000..0995ac3a2d8b --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/StoreApi.md @@ -0,0 +1,264 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + 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 + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **placeOrder** +> Order placeOrder(body) + +Place an order for a pet + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/Tag.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/Tag.md new file mode 100644 index 000000000000..690656ea89d2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/Tag.md @@ -0,0 +1,18 @@ + + +# Tag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/TypeHolderDefault.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/TypeHolderDefault.md new file mode 100644 index 000000000000..e0caa9c40357 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/TypeHolderDefault.md @@ -0,0 +1,21 @@ + + +# TypeHolderDefault + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**stringItem** | **String** | | | +|**numberItem** | **BigDecimal** | | | +|**integerItem** | **Integer** | | | +|**boolItem** | **Boolean** | | | +|**arrayItem** | **List<Integer>** | | | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/TypeHolderExample.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/TypeHolderExample.md new file mode 100644 index 000000000000..cc076efe9d94 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/TypeHolderExample.md @@ -0,0 +1,22 @@ + + +# TypeHolderExample + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**stringItem** | **String** | | | +|**numberItem** | **BigDecimal** | | | +|**floatItem** | **Float** | | | +|**integerItem** | **Integer** | | | +|**boolItem** | **Boolean** | | | +|**arrayItem** | **List<Integer>** | | | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/User.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/User.md new file mode 100644 index 000000000000..d79a69484fd6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/User.md @@ -0,0 +1,24 @@ + + +# User + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/UserApi.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/UserApi.md new file mode 100644 index 000000000000..cbf7dd74a09e --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/UserApi.md @@ -0,0 +1,501 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | + + + +# **createUser** +> createUser(body) + +Create user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**User**](User.md)| Created user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(body) + +Creates list of users with given input array + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithListInput** +> createUsersWithListInput(body) + +Creates list of users with given input array + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### 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 | - | + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + 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 + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **updateUser** +> updateUser(username, body) + +Updated user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **body** | [**User**](User.md)| Updated user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/docs/XmlItem.md b/samples/client/petstore/java/okhttp-parcelableModel/docs/XmlItem.md new file mode 100644 index 000000000000..cd8cf1ac26ec --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/docs/XmlItem.md @@ -0,0 +1,45 @@ + + +# XmlItem + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**attributeString** | **String** | | [optional] | +|**attributeNumber** | **BigDecimal** | | [optional] | +|**attributeInteger** | **Integer** | | [optional] | +|**attributeBoolean** | **Boolean** | | [optional] | +|**wrappedArray** | **List<Integer>** | | [optional] | +|**nameString** | **String** | | [optional] | +|**nameNumber** | **BigDecimal** | | [optional] | +|**nameInteger** | **Integer** | | [optional] | +|**nameBoolean** | **Boolean** | | [optional] | +|**nameArray** | **List<Integer>** | | [optional] | +|**nameWrappedArray** | **List<Integer>** | | [optional] | +|**prefixString** | **String** | | [optional] | +|**prefixNumber** | **BigDecimal** | | [optional] | +|**prefixInteger** | **Integer** | | [optional] | +|**prefixBoolean** | **Boolean** | | [optional] | +|**prefixArray** | **List<Integer>** | | [optional] | +|**prefixWrappedArray** | **List<Integer>** | | [optional] | +|**namespaceString** | **String** | | [optional] | +|**namespaceNumber** | **BigDecimal** | | [optional] | +|**namespaceInteger** | **Integer** | | [optional] | +|**namespaceBoolean** | **Boolean** | | [optional] | +|**namespaceArray** | **List<Integer>** | | [optional] | +|**namespaceWrappedArray** | **List<Integer>** | | [optional] | +|**prefixNsString** | **String** | | [optional] | +|**prefixNsNumber** | **BigDecimal** | | [optional] | +|**prefixNsInteger** | **Integer** | | [optional] | +|**prefixNsBoolean** | **Boolean** | | [optional] | +|**prefixNsArray** | **List<Integer>** | | [optional] | +|**prefixNsWrappedArray** | **List<Integer>** | | [optional] | + + +## Implemented Interfaces + +* Parcelable + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/git_push.sh b/samples/client/petstore/java/okhttp-parcelableModel/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp-parcelableModel/gradle.properties b/samples/client/petstore/java/okhttp-parcelableModel/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-parcelableModel/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-parcelableModel/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-parcelableModel/gradlew.bat b/samples/client/petstore/java/okhttp-parcelableModel/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp-parcelableModel/pom.xml b/samples/client/petstore/java/okhttp-parcelableModel/pom.xml new file mode 100644 index 000000000000..180fd5b8aba3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/pom.xml @@ -0,0 +1,284 @@ + + 4.0.0 + org.openapitools + petstore-okhttp-parcelableModel + jar + petstore-okhttp-parcelableModel + 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-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.10.1 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/settings.gradle b/samples/client/petstore/java/okhttp-parcelableModel/settings.gradle new file mode 100644 index 000000000000..2acf776ba8b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-okhttp-parcelableModel" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-parcelableModel/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..e9ab7a8d7a60 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiCallback.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; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..676b1fcc4a8c --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1733 @@ +/* + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://petstore.swagger.io:80/v2"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io:80/v2", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = ""; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io:80/v2) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..0c0f52846910 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..fb13945bd775 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..79955372fb33 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..75ddfa07d2cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,520 @@ +/* + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Animal.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BigCat", org.openapitools.client.model.BigCat.class); + classByDiscriminatorValue.put("Cat", org.openapitools.client.model.Cat.class); + classByDiscriminatorValue.put("Dog", org.openapitools.client.model.Dog.class); + classByDiscriminatorValue.put("Animal", org.openapitools.client.model.Animal.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.BigCat.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BigCat", org.openapitools.client.model.BigCat.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Cat.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BigCat", org.openapitools.client.model.BigCat.class); + classByDiscriminatorValue.put("Cat", org.openapitools.client.model.Cat.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Dog.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Dog", org.openapitools.client.model.Dog.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesAnyType.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesArray.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesBoolean.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesClass.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesInteger.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesNumber.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesObject.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesString.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayOfArrayOfNumberOnly.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayOfNumberOnly.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayTest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.BigCat.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Capitalization.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Category.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ClassModel.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Client.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Dog.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.EnumArrays.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.EnumTest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FileSchemaTestClass.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FormatTest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.HasOnlyReadOnly.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.MapTest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.MixedPropertiesAndAdditionalPropertiesClass.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Model200Response.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelApiResponse.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelFile.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelList.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelReturn.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Name.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NumberOnly.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Order.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.OuterComposite.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Pet.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ReadOnlyFirst.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.SpecialModelName.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Tag.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.TypeHolderDefault.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.TypeHolderExample.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.User.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.XmlItem.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..505e6f786f4c --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..924dd8668973 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..eee56669a4a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..1787a231e76b --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..bc81f54d83a6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..6473166843d5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java new file mode 100644 index 000000000000..ddca121402d2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -0,0 +1,220 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Client; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AnotherFakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AnotherFakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public AnotherFakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for call123testSpecialTags + * @param uuidTest to test uuid example value (required) + * @param body client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsCall(@javax.annotation.Nonnull UUID uuidTest, @javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/another-fake/dummy"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (uuidTest != null) { + localVarHeaderParams.put("uuid_test", localVarApiClient.parameterToString(uuidTest)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call call123testSpecialTagsValidateBeforeCall(@javax.annotation.Nonnull UUID uuidTest, @javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'uuidTest' is set + if (uuidTest == null) { + throw new ApiException("Missing the required parameter 'uuidTest' when calling call123testSpecialTags(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling call123testSpecialTags(Async)"); + } + + return call123testSpecialTagsCall(uuidTest, body, _callback); + + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param uuidTest to test uuid example value (required) + * @param body client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client call123testSpecialTags(@javax.annotation.Nonnull UUID uuidTest, @javax.annotation.Nonnull Client body) throws ApiException { + ApiResponse localVarResp = call123testSpecialTagsWithHttpInfo(uuidTest, body); + return localVarResp.getData(); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param uuidTest to test uuid example value (required) + * @param body client model (required) + * @return ApiResponse<Client> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull UUID uuidTest, @javax.annotation.Nonnull Client body) throws ApiException { + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(uuidTest, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test special tags (asynchronously) + * To test special tags and operation ID starting with number + * @param uuidTest to test uuid example value (required) + * @param body client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsAsync(@javax.annotation.Nonnull UUID uuidTest, @javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(uuidTest, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 000000000000..3140e3bd76a5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,2191 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.User; +import org.openapitools.client.model.XmlItem; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createXmlItem + * @param xmlItem XmlItem Body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call createXmlItemCall(@javax.annotation.Nonnull XmlItem xmlItem, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = xmlItem; + + // create path and map variables + String localVarPath = "/fake/create_xml_item"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/xml", + "application/xml; charset=utf-8", + "application/xml; charset=utf-16", + "text/xml", + "text/xml; charset=utf-8", + "text/xml; charset=utf-16" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createXmlItemValidateBeforeCall(@javax.annotation.Nonnull XmlItem xmlItem, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'xmlItem' is set + if (xmlItem == null) { + throw new ApiException("Missing the required parameter 'xmlItem' when calling createXmlItem(Async)"); + } + + return createXmlItemCall(xmlItem, _callback); + + } + + /** + * creates an XmlItem + * this route creates an XmlItem + * @param xmlItem XmlItem Body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void createXmlItem(@javax.annotation.Nonnull XmlItem xmlItem) throws ApiException { + createXmlItemWithHttpInfo(xmlItem); + } + + /** + * creates an XmlItem + * this route creates an XmlItem + * @param xmlItem XmlItem Body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse createXmlItemWithHttpInfo(@javax.annotation.Nonnull XmlItem xmlItem) throws ApiException { + okhttp3.Call localVarCall = createXmlItemValidateBeforeCall(xmlItem, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * creates an XmlItem (asynchronously) + * this route creates an XmlItem + * @param xmlItem XmlItem Body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call createXmlItemAsync(@javax.annotation.Nonnull XmlItem xmlItem, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createXmlItemValidateBeforeCall(xmlItem, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterBooleanSerialize + * @param body Input boolean as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeCall(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterBooleanSerializeValidateBeforeCall(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + return fakeOuterBooleanSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public Boolean fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body) throws ApiException { + ApiResponse localVarResp = fakeOuterBooleanSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return ApiResponse<Boolean> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(@javax.annotation.Nullable Boolean body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterBooleanSerializeValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeAsync(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterBooleanSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterCompositeSerialize + * @param body Input composite as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeCall(@javax.annotation.Nullable OuterComposite body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterCompositeSerializeValidateBeforeCall(@javax.annotation.Nullable OuterComposite body, final ApiCallback _callback) throws ApiException { + return fakeOuterCompositeSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public OuterComposite fakeOuterCompositeSerialize(@javax.annotation.Nullable OuterComposite body) throws ApiException { + ApiResponse localVarResp = fakeOuterCompositeSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return ApiResponse<OuterComposite> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(@javax.annotation.Nullable OuterComposite body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterCompositeSerializeValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeAsync(@javax.annotation.Nullable OuterComposite body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterCompositeSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterNumberSerialize + * @param body Input number as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeCall(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterNumberSerializeValidateBeforeCall(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + return fakeOuterNumberSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public BigDecimal fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal body) throws ApiException { + ApiResponse localVarResp = fakeOuterNumberSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return ApiResponse<BigDecimal> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public ApiResponse fakeOuterNumberSerializeWithHttpInfo(@javax.annotation.Nullable BigDecimal body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterNumberSerializeValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeAsync(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterNumberSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterStringSerialize + * @param body Input string as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeCall(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterStringSerializeValidateBeforeCall(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + return fakeOuterStringSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public String fakeOuterStringSerialize(@javax.annotation.Nullable String body) throws ApiException { + ApiResponse localVarResp = fakeOuterStringSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public ApiResponse fakeOuterStringSerializeWithHttpInfo(@javax.annotation.Nullable String body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterStringSerializeValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeAsync(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterStringSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testBodyWithFileSchema + * @param body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaCall(@javax.annotation.Nonnull FileSchemaTestClass body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/body-with-file-schema"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithFileSchemaValidateBeforeCall(@javax.annotation.Nonnull FileSchemaTestClass body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling testBodyWithFileSchema(Async)"); + } + + return testBodyWithFileSchemaCall(body, _callback); + + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithFileSchema(@javax.annotation.Nonnull FileSchemaTestClass body) throws ApiException { + testBodyWithFileSchemaWithHttpInfo(body); + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithFileSchemaWithHttpInfo(@javax.annotation.Nonnull FileSchemaTestClass body) throws ApiException { + okhttp3.Call localVarCall = testBodyWithFileSchemaValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * For this test, the body for this request much reference a schema named `File`. + * @param body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaAsync(@javax.annotation.Nonnull FileSchemaTestClass body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyWithFileSchemaValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testBodyWithQueryParams + * @param query (required) + * @param body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsCall(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (query != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithQueryParamsValidateBeforeCall(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException("Missing the required parameter 'query' when calling testBodyWithQueryParams(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling testBodyWithQueryParams(Async)"); + } + + return testBodyWithQueryParamsCall(query, body, _callback); + + } + + /** + * + * + * @param query (required) + * @param body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithQueryParams(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User body) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(query, body); + } + + /** + * + * + * @param query (required) + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User body) throws ApiException { + okhttp3.Call localVarCall = testBodyWithQueryParamsValidateBeforeCall(query, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param query (required) + * @param body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsAsync(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyWithQueryParamsValidateBeforeCall(query, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testClientModel + * @param body client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelCall(@javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClientModelValidateBeforeCall(@javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling testClientModel(Async)"); + } + + return testClientModelCall(body, _callback); + + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param body client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClientModel(@javax.annotation.Nonnull Client body) throws ApiException { + ApiResponse localVarResp = testClientModelWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param body client model (required) + * @return ApiResponse<Client> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClientModelWithHttpInfo(@javax.annotation.Nonnull Client body) throws ApiException { + okhttp3.Call localVarCall = testClientModelValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test \"client\" model (asynchronously) + * To test \"client\" model + * @param body client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelAsync(@javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testClientModelValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testEndpointParameters + * @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) + * @param password None (optional) + * @param paramCallback None (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersCall(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "http_basic_test" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEndpointParametersValidateBeforeCall(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException("Missing the required parameter 'number' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException("Missing the required parameter '_double' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) { + throw new ApiException("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException("Missing the required parameter '_byte' when calling testEndpointParameters(Async)"); + } + + return testEndpointParametersCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, _callback); + + } + + /** + * 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) + * @param password None (optional) + * @param paramCallback None (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable 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) + * @param password None (optional) + * @param paramCallback None (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse testEndpointParametersWithHttpInfo(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { + okhttp3.Call localVarCall = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 (asynchronously) + * 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) + * @param password None (optional) + * @param paramCallback None (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersAsync(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testEnumParameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersCall(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (enumFormStringArray != null) { + localVarFormParams.put("enum_form_string_array", enumFormStringArray); + } + + if (enumFormString != null) { + localVarFormParams.put("enum_form_string", enumFormString); + } + + if (enumQueryStringArray != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray)); + } + + if (enumQueryString != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_string", enumQueryString)); + } + + if (enumQueryInteger != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_integer", enumQueryInteger)); + } + + if (enumQueryDouble != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_double", enumQueryDouble)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (enumHeaderStringArray != null) { + localVarHeaderParams.put("enum_header_string_array", localVarApiClient.parameterToString(enumHeaderStringArray)); + } + + + if (enumHeaderString != null) { + localVarHeaderParams.put("enum_header_string", localVarApiClient.parameterToString(enumHeaderString)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEnumParametersValidateBeforeCall(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + return testEnumParametersCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, _callback); + + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public void testEnumParameters(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable 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) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public ApiResponse testEnumParametersWithHttpInfo(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString) throws ApiException { + okhttp3.Call localVarCall = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * To test enum parameters (asynchronously) + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersAsync(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + private okhttp3.Call testGroupParametersCall(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (requiredStringGroup != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("required_string_group", requiredStringGroup)); + } + + if (requiredInt64Group != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("required_int64_group", requiredInt64Group)); + } + + if (stringGroup != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("string_group", stringGroup)); + } + + if (int64Group != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("int64_group", int64Group)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (requiredBooleanGroup != null) { + localVarHeaderParams.put("required_boolean_group", localVarApiClient.parameterToString(requiredBooleanGroup)); + } + + + if (booleanGroup != null) { + localVarHeaderParams.put("boolean_group", localVarApiClient.parameterToString(booleanGroup)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testGroupParametersValidateBeforeCall(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requiredStringGroup' is set + if (requiredStringGroup == null) { + throw new ApiException("Missing the required parameter 'requiredStringGroup' when calling testGroupParameters(Async)"); + } + + // verify the required parameter 'requiredBooleanGroup' is set + if (requiredBooleanGroup == null) { + throw new ApiException("Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters(Async)"); + } + + // verify the required parameter 'requiredInt64Group' is set + if (requiredInt64Group == null) { + throw new ApiException("Missing the required parameter 'requiredInt64Group' when calling testGroupParameters(Async)"); + } + + return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + + } + + + private ApiResponse testGroupParametersWithHttpInfo(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { + okhttp3.Call localVarCall = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call testGroupParametersAsync(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APItestGroupParametersRequest { + @javax.annotation.Nonnull + private final Integer requiredStringGroup; + @javax.annotation.Nonnull + private final Boolean requiredBooleanGroup; + @javax.annotation.Nonnull + private final Long requiredInt64Group; + @javax.annotation.Nullable + private Integer stringGroup; + @javax.annotation.Nullable + private Boolean booleanGroup; + @javax.annotation.Nullable + private Long int64Group; + + private APItestGroupParametersRequest(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group) { + this.requiredStringGroup = requiredStringGroup; + this.requiredBooleanGroup = requiredBooleanGroup; + this.requiredInt64Group = requiredInt64Group; + } + + /** + * Set stringGroup + * @param stringGroup String in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest stringGroup(@javax.annotation.Nullable Integer stringGroup) { + this.stringGroup = stringGroup; + return this; + } + + /** + * Set booleanGroup + * @param booleanGroup Boolean in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest booleanGroup(@javax.annotation.Nullable Boolean booleanGroup) { + this.booleanGroup = booleanGroup; + return this; + } + + /** + * Set int64Group + * @param int64Group Integer in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest int64Group(@javax.annotation.Nullable Long int64Group) { + this.int64Group = int64Group; + return this; + } + + /** + * Build call for testGroupParameters + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + } + + /** + * Execute testGroupParameters request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public void execute() throws ApiException { + testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /** + * Execute testGroupParameters request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /** + * Execute testGroupParameters request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return testGroupParametersAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + } + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @return APItestGroupParametersRequest + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public APItestGroupParametersRequest testGroupParameters(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group) { + return new APItestGroupParametersRequest(requiredStringGroup, requiredBooleanGroup, requiredInt64Group); + } + /** + * Build call for testInlineAdditionalProperties + * @param param request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineAdditionalPropertiesCall(@javax.annotation.Nonnull Map param, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = param; + + // create path and map variables + String localVarPath = "/fake/inline-additionalProperties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testInlineAdditionalPropertiesValidateBeforeCall(@javax.annotation.Nonnull Map param, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'param' is set + if (param == null) { + throw new ApiException("Missing the required parameter 'param' when calling testInlineAdditionalProperties(Async)"); + } + + return testInlineAdditionalPropertiesCall(param, _callback); + + } + + /** + * test inline additionalProperties + * + * @param param request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testInlineAdditionalProperties(@javax.annotation.Nonnull Map param) throws ApiException { + testInlineAdditionalPropertiesWithHttpInfo(param); + } + + /** + * test inline additionalProperties + * + * @param param request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull Map param) throws ApiException { + okhttp3.Call localVarCall = testInlineAdditionalPropertiesValidateBeforeCall(param, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test inline additionalProperties (asynchronously) + * + * @param param request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineAdditionalPropertiesAsync(@javax.annotation.Nonnull Map param, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testInlineAdditionalPropertiesValidateBeforeCall(param, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testJsonFormData + * @param param field1 (required) + * @param param2 field2 (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testJsonFormDataCall(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/jsonFormData"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testJsonFormDataValidateBeforeCall(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'param' is set + if (param == null) { + throw new ApiException("Missing the required parameter 'param' when calling testJsonFormData(Async)"); + } + + // verify the required parameter 'param2' is set + if (param2 == null) { + throw new ApiException("Missing the required parameter 'param2' when calling testJsonFormData(Async)"); + } + + return testJsonFormDataCall(param, param2, _callback); + + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testJsonFormData(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testJsonFormDataWithHttpInfo(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { + okhttp3.Call localVarCall = testJsonFormDataValidateBeforeCall(param, param2, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test json serialization of form data (asynchronously) + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testJsonFormDataAsync(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testJsonFormDataValidateBeforeCall(param, param2, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testQueryParameterCollectionFormat + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testQueryParameterCollectionFormatCall(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/test-query-parameters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pipe != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "pipe", pipe)); + } + + if (ioutil != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "ioutil", ioutil)); + } + + if (http != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("ssv", "http", http)); + } + + if (url != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "url", url)); + } + + if (context != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "context", context)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryParameterCollectionFormatValidateBeforeCall(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pipe' is set + if (pipe == null) { + throw new ApiException("Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) { + throw new ApiException("Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'http' is set + if (http == null) { + throw new ApiException("Missing the required parameter 'http' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'url' is set + if (url == null) { + throw new ApiException("Missing the required parameter 'url' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'context' is set + if (context == null) { + throw new ApiException("Missing the required parameter 'context' when calling testQueryParameterCollectionFormat(Async)"); + } + + return testQueryParameterCollectionFormatCall(pipe, ioutil, http, url, context, _callback); + + } + + /** + * + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testQueryParameterCollectionFormat(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testQueryParameterCollectionFormatAsync(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java new file mode 100644 index 000000000000..0629423851c3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,205 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Client; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeClassnameTags123Api { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for testClassname + * @param body client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameCall(@javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake_classname_test"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key_query" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClassnameValidateBeforeCall(@javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling testClassname(Async)"); + } + + return testClassnameCall(body, _callback); + + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param body client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClassname(@javax.annotation.Nonnull Client body) throws ApiException { + ApiResponse localVarResp = testClassnameWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param body client model (required) + * @return ApiResponse<Client> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClassnameWithHttpInfo(@javax.annotation.Nonnull Client body) throws ApiException { + okhttp3.Call localVarCall = testClassnameValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test class name in snake case (asynchronously) + * To test class name in snake case + * @param body client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameAsync(@javax.annotation.Nonnull Client body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testClassnameValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..4799999a9d8a --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1333 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import java.util.Set; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PetApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addPet + * @param body Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call addPetCall(@javax.annotation.Nonnull Pet body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addPetValidateBeforeCall(@javax.annotation.Nonnull Pet body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling addPet(Async)"); + } + + return addPetCall(body, _callback); + + } + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public void addPet(@javax.annotation.Nonnull Pet body) throws ApiException { + addPetWithHttpInfo(body); + } + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet body) throws ApiException { + okhttp3.Call localVarCall = addPetValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Add a new pet to the store (asynchronously) + * + * @param body Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call addPetAsync(@javax.annotation.Nonnull Pet body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addPetValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deletePet + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePetValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); + } + + return deletePetCall(petId, apiKey, _callback); + + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
+ */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deletes a pet (asynchronously) + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for findPetsByStatus + * @param status Status values that need to be considered for filter (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "status", status)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByStatusValidateBeforeCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + + return findPetsByStatusCall(status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + ApiResponse> localVarResp = findPetsByStatusWithHttpInfo(status); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by status (asynchronously) + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusAsync(@javax.annotation.Nonnull List status, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for findPetsByTags + * @param tags Tags to filter by (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsCall(@javax.annotation.Nonnull Set tags, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByTagsValidateBeforeCall(@javax.annotation.Nonnull Set tags, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); + } + + return findPetsByTagsCall(tags, _callback); + + } + + /** + * 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 Set<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public Set findPetsByTags(@javax.annotation.Nonnull Set tags) throws ApiException { + ApiResponse> localVarResp = findPetsByTagsWithHttpInfo(tags); + return localVarResp.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<Set<Pet>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull Set tags) throws ApiException { + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by tags (asynchronously) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsAsync(@javax.annotation.Nonnull Set tags, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPetById + * @param petId ID of pet to return (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + return getPetByIdCall(petId, _callback); + + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + ApiResponse localVarResp = getPetByIdWithHttpInfo(petId); + return localVarResp.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find pet by ID (asynchronously) + * Returns a single pet + * @param petId ID of pet to return (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdAsync(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePet + * @param body Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetCall(@javax.annotation.Nonnull Pet body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetValidateBeforeCall(@javax.annotation.Nonnull Pet body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updatePet(Async)"); + } + + return updatePetCall(body, _callback); + + } + + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public void updatePet(@javax.annotation.Nonnull Pet body) throws ApiException { + updatePetWithHttpInfo(body); + } + + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet body) throws ApiException { + okhttp3.Call localVarCall = updatePetValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update an existing pet (asynchronously) + * + * @param body Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetAsync(@javax.annotation.Nonnull Pet body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updatePetWithForm + * @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) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetWithFormValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); + } + + return updatePetWithFormCall(petId, name, status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updates a pet in the store with form data (asynchronously) + * + * @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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for uploadFile + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); + } + + return uploadFileCall(petId, additionalMetadata, _file, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = uploadFileWithHttpInfo(petId, additionalMetadata, _file); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (asynchronously) + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for uploadFileWithRequiredFile + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileWithRequiredFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFileWithRequiredFile(Async)"); + } + + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) { + throw new ApiException("Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile(Async)"); + } + + return uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + ApiResponse localVarResp = uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (required) (asynchronously) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..1143e0666a4b --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,592 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Order; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class StoreApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteOrder + * @param orderId ID of the order that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replace("{" + "order_id" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOrderValidateBeforeCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); + } + + return deleteOrderCall(orderId, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete purchase order by ID (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderAsync(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getInventory + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getInventoryCall(_callback); + + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Map getInventory() throws ApiException { + ApiResponse> localVarResp = getInventoryWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Returns pet inventories by status (asynchronously) + * Returns a map of status codes to quantities + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderById + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replace("{" + "order_id" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderByIdValidateBeforeCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); + } + + return getOrderByIdCall(orderId, _callback); + + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + ApiResponse localVarResp = getOrderByIdWithHttpInfo(orderId); + return localVarResp.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find purchase order by ID (asynchronously) + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdAsync(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for placeOrder + * @param body order placed for purchasing the pet (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderCall(@javax.annotation.Nonnull Order body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/store/order"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(@javax.annotation.Nonnull Order body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling placeOrder(Async)"); + } + + return placeOrderCall(body, _callback); + + } + + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(@javax.annotation.Nonnull Order body) throws ApiException { + ApiResponse localVarResp = placeOrderWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order body) throws ApiException { + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Place an order for a pet (asynchronously) + * + * @param body order placed for purchasing the pet (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderAsync(@javax.annotation.Nonnull Order body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..f7449549241e --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,1101 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UserApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createUser + * @param body Created user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserCall(@javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/user"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUserValidateBeforeCall(@javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling createUser(Async)"); + } + + return createUserCall(body, _callback); + + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(@javax.annotation.Nonnull User body) throws ApiException { + createUserWithHttpInfo(body); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User body) throws ApiException { + okhttp3.Call localVarCall = createUserValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create user (asynchronously) + * This can only be done by the logged in user. + * @param body Created user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserAsync(@javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUserValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithArrayInput + * @param body List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputCall(@javax.annotation.Nonnull List body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(@javax.annotation.Nonnull List body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling createUsersWithArrayInput(Async)"); + } + + return createUsersWithArrayInputCall(body, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull List body) throws ApiException { + createUsersWithArrayInputWithHttpInfo(body); + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List body) throws ApiException { + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param body List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputAsync(@javax.annotation.Nonnull List body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithListInput + * @param body List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputCall(@javax.annotation.Nonnull List body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/user/createWithList"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithListInputValidateBeforeCall(@javax.annotation.Nonnull List body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling createUsersWithListInput(Async)"); + } + + return createUsersWithListInputCall(body, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(@javax.annotation.Nonnull List body) throws ApiException { + createUsersWithListInputWithHttpInfo(body); + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List body) throws ApiException { + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param body List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputAsync(@javax.annotation.Nonnull List body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteUser + * @param username The name that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteUserValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); + } + + return deleteUserCall(username, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete user (asynchronously) + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getUserByName + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByNameValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); + } + + return getUserByNameCall(username, _callback); + + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + ApiResponse localVarResp = getUserByNameWithHttpInfo(username); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get user by user name (asynchronously) + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for loginUser + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
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 okhttp3.Call loginUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (username != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); + } + + if (password != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("password", password)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call loginUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); + } + + return loginUserCall(username, password, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + ApiResponse localVarResp = loginUserWithHttpInfo(username, password); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Logs user into the system (asynchronously) + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
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 okhttp3.Call loginUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for logoutUser + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return logoutUserCall(_callback); + + } + + /** + * Logs out current logged in user session + * + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Logs out current logged in user session (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateUser + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updateUser(Async)"); + } + + return updateUserCall(username, body, _callback); + + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User body) throws ApiException { + updateUserWithHttpInfo(username, body); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User body) throws ApiException { + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updated user (asynchronously) + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..ed5f5fbc16ef --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..bd5e463d0b42 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..f655936f3a78 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..5aff174aff81 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..6f945f45ed46 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,43 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..59009502c11e --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * 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; + +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..cefbf4af907b --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * 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 okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..5521ee31599c --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * 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.ApiException; +import org.openapitools.client.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..fc0f2c973b8d --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.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 org.openapitools.client.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java new file mode 100644 index 000000000000..602900e9389e --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -0,0 +1,307 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesAnyType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesAnyType implements Parcelable { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesAnyType() { + } + + public AdditionalPropertiesAnyType name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesAnyType instance itself + */ + public AdditionalPropertiesAnyType putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o; + return Objects.equals(this.name, additionalPropertiesAnyType.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesAnyType.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesAnyType {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(name); + } + + AdditionalPropertiesAnyType(Parcel in) { + name = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public AdditionalPropertiesAnyType createFromParcel(Parcel in) { + return new AdditionalPropertiesAnyType(in); + } + public AdditionalPropertiesAnyType[] newArray(int size) { + return new AdditionalPropertiesAnyType[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesAnyType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesAnyType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesAnyType is not found in the empty JSON string", AdditionalPropertiesAnyType.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesAnyType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesAnyType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesAnyType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesAnyType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesAnyType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesAnyType instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesAnyType given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesAnyType + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesAnyType + */ + public static AdditionalPropertiesAnyType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesAnyType.class); + } + + /** + * Convert an instance of AdditionalPropertiesAnyType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java new file mode 100644 index 000000000000..6b6996931b92 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -0,0 +1,308 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesArray + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesArray implements Parcelable { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesArray() { + } + + public AdditionalPropertiesArray name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesArray instance itself + */ + public AdditionalPropertiesArray putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesArray additionalPropertiesArray = (AdditionalPropertiesArray) o; + return Objects.equals(this.name, additionalPropertiesArray.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesArray.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesArray {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(name); + } + + AdditionalPropertiesArray(Parcel in) { + name = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public AdditionalPropertiesArray createFromParcel(Parcel in) { + return new AdditionalPropertiesArray(in); + } + public AdditionalPropertiesArray[] newArray(int size) { + return new AdditionalPropertiesArray[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesArray + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesArray.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesArray is not found in the empty JSON string", AdditionalPropertiesArray.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesArray.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesArray' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesArray.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesArray value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesArray read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesArray instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesArray given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesArray + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesArray + */ + public static AdditionalPropertiesArray fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesArray.class); + } + + /** + * Convert an instance of AdditionalPropertiesArray to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java new file mode 100644 index 000000000000..4ffc837355f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -0,0 +1,307 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesBoolean + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesBoolean implements Parcelable { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesBoolean() { + } + + public AdditionalPropertiesBoolean name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesBoolean instance itself + */ + public AdditionalPropertiesBoolean putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesBoolean additionalPropertiesBoolean = (AdditionalPropertiesBoolean) o; + return Objects.equals(this.name, additionalPropertiesBoolean.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesBoolean.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesBoolean {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(name); + } + + AdditionalPropertiesBoolean(Parcel in) { + name = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public AdditionalPropertiesBoolean createFromParcel(Parcel in) { + return new AdditionalPropertiesBoolean(in); + } + public AdditionalPropertiesBoolean[] newArray(int size) { + return new AdditionalPropertiesBoolean[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesBoolean + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesBoolean.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesBoolean is not found in the empty JSON string", AdditionalPropertiesBoolean.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesBoolean.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesBoolean' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesBoolean.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesBoolean value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesBoolean read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesBoolean instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesBoolean given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesBoolean + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesBoolean + */ + public static AdditionalPropertiesBoolean fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesBoolean.class); + } + + /** + * Convert an instance of AdditionalPropertiesBoolean to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..d50efcbfdca2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,662 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesClass implements Parcelable { + public static final String SERIALIZED_NAME_MAP_STRING = "map_string"; + @SerializedName(SERIALIZED_NAME_MAP_STRING) + @javax.annotation.Nullable + private Map mapString = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_NUMBER = "map_number"; + @SerializedName(SERIALIZED_NAME_MAP_NUMBER) + @javax.annotation.Nullable + private Map mapNumber = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_INTEGER = "map_integer"; + @SerializedName(SERIALIZED_NAME_MAP_INTEGER) + @javax.annotation.Nullable + private Map mapInteger = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_BOOLEAN = "map_boolean"; + @SerializedName(SERIALIZED_NAME_MAP_BOOLEAN) + @javax.annotation.Nullable + private Map mapBoolean = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_ARRAY_INTEGER = "map_array_integer"; + @SerializedName(SERIALIZED_NAME_MAP_ARRAY_INTEGER) + @javax.annotation.Nullable + private Map> mapArrayInteger = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_ARRAY_ANYTYPE = "map_array_anytype"; + @SerializedName(SERIALIZED_NAME_MAP_ARRAY_ANYTYPE) + @javax.annotation.Nullable + private Map> mapArrayAnytype = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_MAP_STRING = "map_map_string"; + @SerializedName(SERIALIZED_NAME_MAP_MAP_STRING) + @javax.annotation.Nullable + private Map> mapMapString = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_MAP_ANYTYPE = "map_map_anytype"; + @SerializedName(SERIALIZED_NAME_MAP_MAP_ANYTYPE) + @javax.annotation.Nullable + private Map> mapMapAnytype = new HashMap<>(); + + public static final String SERIALIZED_NAME_ANYTYPE1 = "anytype_1"; + @SerializedName(SERIALIZED_NAME_ANYTYPE1) + @javax.annotation.Nullable + private Object anytype1; + + public static final String SERIALIZED_NAME_ANYTYPE2 = "anytype_2"; + @SerializedName(SERIALIZED_NAME_ANYTYPE2) + @javax.annotation.Nullable + private Object anytype2; + + public static final String SERIALIZED_NAME_ANYTYPE3 = "anytype_3"; + @SerializedName(SERIALIZED_NAME_ANYTYPE3) + @javax.annotation.Nullable + private Object anytype3; + + public AdditionalPropertiesClass() { + } + + public AdditionalPropertiesClass mapString(@javax.annotation.Nullable Map mapString) { + this.mapString = mapString; + return this; + } + + public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { + if (this.mapString == null) { + this.mapString = new HashMap<>(); + } + this.mapString.put(key, mapStringItem); + return this; + } + + /** + * Get mapString + * @return mapString + */ + @javax.annotation.Nullable + + public Map getMapString() { + return mapString; + } + + public void setMapString(@javax.annotation.Nullable Map mapString) { + this.mapString = mapString; + } + + + public AdditionalPropertiesClass mapNumber(@javax.annotation.Nullable Map mapNumber) { + this.mapNumber = mapNumber; + return this; + } + + public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { + if (this.mapNumber == null) { + this.mapNumber = new HashMap<>(); + } + this.mapNumber.put(key, mapNumberItem); + return this; + } + + /** + * Get mapNumber + * @return mapNumber + */ + @javax.annotation.Nullable + + public Map getMapNumber() { + return mapNumber; + } + + public void setMapNumber(@javax.annotation.Nullable Map mapNumber) { + this.mapNumber = mapNumber; + } + + + public AdditionalPropertiesClass mapInteger(@javax.annotation.Nullable Map mapInteger) { + this.mapInteger = mapInteger; + return this; + } + + public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { + if (this.mapInteger == null) { + this.mapInteger = new HashMap<>(); + } + this.mapInteger.put(key, mapIntegerItem); + return this; + } + + /** + * Get mapInteger + * @return mapInteger + */ + @javax.annotation.Nullable + + public Map getMapInteger() { + return mapInteger; + } + + public void setMapInteger(@javax.annotation.Nullable Map mapInteger) { + this.mapInteger = mapInteger; + } + + + public AdditionalPropertiesClass mapBoolean(@javax.annotation.Nullable Map mapBoolean) { + this.mapBoolean = mapBoolean; + return this; + } + + public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { + if (this.mapBoolean == null) { + this.mapBoolean = new HashMap<>(); + } + this.mapBoolean.put(key, mapBooleanItem); + return this; + } + + /** + * Get mapBoolean + * @return mapBoolean + */ + @javax.annotation.Nullable + + public Map getMapBoolean() { + return mapBoolean; + } + + public void setMapBoolean(@javax.annotation.Nullable Map mapBoolean) { + this.mapBoolean = mapBoolean; + } + + + public AdditionalPropertiesClass mapArrayInteger(@javax.annotation.Nullable Map> mapArrayInteger) { + this.mapArrayInteger = mapArrayInteger; + return this; + } + + public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { + if (this.mapArrayInteger == null) { + this.mapArrayInteger = new HashMap<>(); + } + this.mapArrayInteger.put(key, mapArrayIntegerItem); + return this; + } + + /** + * Get mapArrayInteger + * @return mapArrayInteger + */ + @javax.annotation.Nullable + + public Map> getMapArrayInteger() { + return mapArrayInteger; + } + + public void setMapArrayInteger(@javax.annotation.Nullable Map> mapArrayInteger) { + this.mapArrayInteger = mapArrayInteger; + } + + + public AdditionalPropertiesClass mapArrayAnytype(@javax.annotation.Nullable Map> mapArrayAnytype) { + this.mapArrayAnytype = mapArrayAnytype; + return this; + } + + public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { + if (this.mapArrayAnytype == null) { + this.mapArrayAnytype = new HashMap<>(); + } + this.mapArrayAnytype.put(key, mapArrayAnytypeItem); + return this; + } + + /** + * Get mapArrayAnytype + * @return mapArrayAnytype + */ + @javax.annotation.Nullable + + public Map> getMapArrayAnytype() { + return mapArrayAnytype; + } + + public void setMapArrayAnytype(@javax.annotation.Nullable Map> mapArrayAnytype) { + this.mapArrayAnytype = mapArrayAnytype; + } + + + public AdditionalPropertiesClass mapMapString(@javax.annotation.Nullable Map> mapMapString) { + this.mapMapString = mapMapString; + return this; + } + + public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { + if (this.mapMapString == null) { + this.mapMapString = new HashMap<>(); + } + this.mapMapString.put(key, mapMapStringItem); + return this; + } + + /** + * Get mapMapString + * @return mapMapString + */ + @javax.annotation.Nullable + + public Map> getMapMapString() { + return mapMapString; + } + + public void setMapMapString(@javax.annotation.Nullable Map> mapMapString) { + this.mapMapString = mapMapString; + } + + + public AdditionalPropertiesClass mapMapAnytype(@javax.annotation.Nullable Map> mapMapAnytype) { + this.mapMapAnytype = mapMapAnytype; + return this; + } + + public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { + if (this.mapMapAnytype == null) { + this.mapMapAnytype = new HashMap<>(); + } + this.mapMapAnytype.put(key, mapMapAnytypeItem); + return this; + } + + /** + * Get mapMapAnytype + * @return mapMapAnytype + */ + @javax.annotation.Nullable + + public Map> getMapMapAnytype() { + return mapMapAnytype; + } + + public void setMapMapAnytype(@javax.annotation.Nullable Map> mapMapAnytype) { + this.mapMapAnytype = mapMapAnytype; + } + + + public AdditionalPropertiesClass anytype1(@javax.annotation.Nullable Object anytype1) { + this.anytype1 = anytype1; + return this; + } + + /** + * Get anytype1 + * @return anytype1 + */ + @javax.annotation.Nullable + + public Object getAnytype1() { + return anytype1; + } + + public void setAnytype1(@javax.annotation.Nullable Object anytype1) { + this.anytype1 = anytype1; + } + + + public AdditionalPropertiesClass anytype2(@javax.annotation.Nullable Object anytype2) { + this.anytype2 = anytype2; + return this; + } + + /** + * Get anytype2 + * @return anytype2 + */ + @javax.annotation.Nullable + + public Object getAnytype2() { + return anytype2; + } + + public void setAnytype2(@javax.annotation.Nullable Object anytype2) { + this.anytype2 = anytype2; + } + + + public AdditionalPropertiesClass anytype3(@javax.annotation.Nullable Object anytype3) { + this.anytype3 = anytype3; + return this; + } + + /** + * Get anytype3 + * @return anytype3 + */ + @javax.annotation.Nullable + + public Object getAnytype3() { + return anytype3; + } + + public void setAnytype3(@javax.annotation.Nullable Object anytype3) { + this.anytype3 = anytype3; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesClass instance itself + */ + public AdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapString, additionalPropertiesClass.mapString) && + Objects.equals(this.mapNumber, additionalPropertiesClass.mapNumber) && + Objects.equals(this.mapInteger, additionalPropertiesClass.mapInteger) && + Objects.equals(this.mapBoolean, additionalPropertiesClass.mapBoolean) && + Objects.equals(this.mapArrayInteger, additionalPropertiesClass.mapArrayInteger) && + Objects.equals(this.mapArrayAnytype, additionalPropertiesClass.mapArrayAnytype) && + Objects.equals(this.mapMapString, additionalPropertiesClass.mapMapString) && + Objects.equals(this.mapMapAnytype, additionalPropertiesClass.mapMapAnytype) && + Objects.equals(this.anytype1, additionalPropertiesClass.anytype1) && + Objects.equals(this.anytype2, additionalPropertiesClass.anytype2) && + Objects.equals(this.anytype3, additionalPropertiesClass.anytype3)&& + Objects.equals(this.additionalProperties, additionalPropertiesClass.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + sb.append(" mapString: ").append(toIndentedString(mapString)).append("\n"); + sb.append(" mapNumber: ").append(toIndentedString(mapNumber)).append("\n"); + sb.append(" mapInteger: ").append(toIndentedString(mapInteger)).append("\n"); + sb.append(" mapBoolean: ").append(toIndentedString(mapBoolean)).append("\n"); + sb.append(" mapArrayInteger: ").append(toIndentedString(mapArrayInteger)).append("\n"); + sb.append(" mapArrayAnytype: ").append(toIndentedString(mapArrayAnytype)).append("\n"); + sb.append(" mapMapString: ").append(toIndentedString(mapMapString)).append("\n"); + sb.append(" mapMapAnytype: ").append(toIndentedString(mapMapAnytype)).append("\n"); + sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n"); + sb.append(" anytype2: ").append(toIndentedString(anytype2)).append("\n"); + sb.append(" anytype3: ").append(toIndentedString(anytype3)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(mapString); + out.writeValue(mapNumber); + out.writeValue(mapInteger); + out.writeValue(mapBoolean); + out.writeValue(mapArrayInteger); + out.writeValue(mapArrayAnytype); + out.writeValue(mapMapString); + out.writeValue(mapMapAnytype); + out.writeValue(anytype1); + out.writeValue(anytype2); + out.writeValue(anytype3); + } + + AdditionalPropertiesClass(Parcel in) { + mapString = (Map)in.readValue(null); + mapNumber = (Map)in.readValue(BigDecimal.class.getClassLoader()); + mapInteger = (Map)in.readValue(null); + mapBoolean = (Map)in.readValue(null); + mapArrayInteger = (Map>)in.readValue(List.class.getClassLoader()); + mapArrayAnytype = (Map>)in.readValue(List.class.getClassLoader()); + mapMapString = (Map>)in.readValue(Map.class.getClassLoader()); + mapMapAnytype = (Map>)in.readValue(Map.class.getClassLoader()); + anytype1 = (Object)in.readValue(null); + anytype2 = (Object)in.readValue(null); + anytype3 = (Object)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public AdditionalPropertiesClass createFromParcel(Parcel in) { + return new AdditionalPropertiesClass(in); + } + public AdditionalPropertiesClass[] newArray(int size) { + return new AdditionalPropertiesClass[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("map_string", "map_number", "map_integer", "map_boolean", "map_array_integer", "map_array_anytype", "map_map_string", "map_map_anytype", "anytype_1", "anytype_2", "anytype_3")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesClass + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesClass is not found in the empty JSON string", AdditionalPropertiesClass.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesClass.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesClass value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesClass read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesClass + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesClass + */ + public static AdditionalPropertiesClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesClass.class); + } + + /** + * Convert an instance of AdditionalPropertiesClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java new file mode 100644 index 000000000000..a22b2f4510ea --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -0,0 +1,307 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesInteger + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesInteger implements Parcelable { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesInteger() { + } + + public AdditionalPropertiesInteger name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesInteger instance itself + */ + public AdditionalPropertiesInteger putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesInteger additionalPropertiesInteger = (AdditionalPropertiesInteger) o; + return Objects.equals(this.name, additionalPropertiesInteger.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesInteger.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesInteger {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(name); + } + + AdditionalPropertiesInteger(Parcel in) { + name = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public AdditionalPropertiesInteger createFromParcel(Parcel in) { + return new AdditionalPropertiesInteger(in); + } + public AdditionalPropertiesInteger[] newArray(int size) { + return new AdditionalPropertiesInteger[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesInteger + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesInteger.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesInteger is not found in the empty JSON string", AdditionalPropertiesInteger.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesInteger.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesInteger' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesInteger.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesInteger value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesInteger read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesInteger instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesInteger given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesInteger + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesInteger + */ + public static AdditionalPropertiesInteger fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesInteger.class); + } + + /** + * Convert an instance of AdditionalPropertiesInteger to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java new file mode 100644 index 000000000000..70d30227ed49 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -0,0 +1,308 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesNumber + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesNumber implements Parcelable { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesNumber() { + } + + public AdditionalPropertiesNumber name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesNumber instance itself + */ + public AdditionalPropertiesNumber putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesNumber additionalPropertiesNumber = (AdditionalPropertiesNumber) o; + return Objects.equals(this.name, additionalPropertiesNumber.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesNumber.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesNumber {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(name); + } + + AdditionalPropertiesNumber(Parcel in) { + name = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public AdditionalPropertiesNumber createFromParcel(Parcel in) { + return new AdditionalPropertiesNumber(in); + } + public AdditionalPropertiesNumber[] newArray(int size) { + return new AdditionalPropertiesNumber[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesNumber + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesNumber.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesNumber is not found in the empty JSON string", AdditionalPropertiesNumber.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesNumber.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesNumber' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesNumber.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesNumber value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesNumber read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesNumber instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesNumber given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesNumber + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesNumber + */ + public static AdditionalPropertiesNumber fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesNumber.class); + } + + /** + * Convert an instance of AdditionalPropertiesNumber to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java new file mode 100644 index 000000000000..cb6f990496b6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -0,0 +1,308 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Map; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesObject + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesObject implements Parcelable { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesObject() { + } + + public AdditionalPropertiesObject name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesObject instance itself + */ + public AdditionalPropertiesObject putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesObject additionalPropertiesObject = (AdditionalPropertiesObject) o; + return Objects.equals(this.name, additionalPropertiesObject.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesObject.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesObject {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(name); + } + + AdditionalPropertiesObject(Parcel in) { + name = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public AdditionalPropertiesObject createFromParcel(Parcel in) { + return new AdditionalPropertiesObject(in); + } + public AdditionalPropertiesObject[] newArray(int size) { + return new AdditionalPropertiesObject[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesObject + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesObject.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesObject is not found in the empty JSON string", AdditionalPropertiesObject.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesObject.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesObject' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesObject.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesObject value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesObject read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesObject instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesObject given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesObject + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesObject + */ + public static AdditionalPropertiesObject fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesObject.class); + } + + /** + * Convert an instance of AdditionalPropertiesObject to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java new file mode 100644 index 000000000000..7906ac1c747f --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -0,0 +1,307 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesString + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesString implements Parcelable { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AdditionalPropertiesString() { + } + + public AdditionalPropertiesString name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesString instance itself + */ + public AdditionalPropertiesString putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesString additionalPropertiesString = (AdditionalPropertiesString) o; + return Objects.equals(this.name, additionalPropertiesString.name)&& + Objects.equals(this.additionalProperties, additionalPropertiesString.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesString {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(name); + } + + AdditionalPropertiesString(Parcel in) { + name = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public AdditionalPropertiesString createFromParcel(Parcel in) { + return new AdditionalPropertiesString(in); + } + public AdditionalPropertiesString[] newArray(int size) { + return new AdditionalPropertiesString[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesString + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesString.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesString is not found in the empty JSON string", AdditionalPropertiesString.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesString.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesString' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesString.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesString value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesString read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesString instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesString given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesString + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesString + */ + public static AdditionalPropertiesString fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesString.class); + } + + /** + * Convert an instance of AdditionalPropertiesString to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 000000000000..94188920b996 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java @@ -0,0 +1,277 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Animal + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Animal implements Parcelable { + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @SerializedName(SERIALIZED_NAME_CLASS_NAME) + @javax.annotation.Nonnull + protected String className; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + @javax.annotation.Nullable + private String color = "red"; + + public Animal() { + this.className = this.getClass().getSimpleName(); + } + + public Animal className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + + public String getClassName() { + return className; + } + + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + + public Animal color(@javax.annotation.Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @javax.annotation.Nullable + + public String getColor() { + return color; + } + + public void setColor(@javax.annotation.Nullable String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Animal instance itself + */ + public Animal putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, animal.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(className, color, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(className); + out.writeValue(color); + } + + Animal(Parcel in) { + className = (String)in.readValue(null); + color = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Animal createFromParcel(Parcel in) { + return new Animal(in); + } + public Animal[] newArray(int size) { + return new Animal[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Animal + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Animal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Animal is not found in the empty JSON string", Animal.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("className").getAsString(); + switch (discriminatorValue) { + case "BigCat": + BigCat.validateJsonElement(jsonElement); + break; + case "Cat": + Cat.validateJsonElement(jsonElement); + break; + case "Dog": + Dog.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The value of the `className` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Animal given an JSON string + * + * @param jsonString JSON string + * @return An instance of Animal + * @throws IOException if the JSON string is invalid with respect to Animal + */ + public static Animal fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Animal.class); + } + + /** + * Convert an instance of Animal to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..74bc2f563440 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,320 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfArrayOfNumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOfArrayOfNumberOnly implements Parcelable { + public static final String SERIALIZED_NAME_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_NUMBER) + @javax.annotation.Nullable + private List> arrayArrayNumber = new ArrayList<>(); + + public ArrayOfArrayOfNumberOnly() { + } + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(@javax.annotation.Nullable 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 + + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + public void setArrayArrayNumber(@javax.annotation.Nullable List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfArrayOfNumberOnly instance itself + */ + public ArrayOfArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, arrayOfArrayOfNumberOnly.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(arrayArrayNumber); + } + + ArrayOfArrayOfNumberOnly(Parcel in) { + arrayArrayNumber = (List>)in.readValue(List.class.getClassLoader()); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ArrayOfArrayOfNumberOnly createFromParcel(Parcel in) { + return new ArrayOfArrayOfNumberOnly(in); + } + public ArrayOfArrayOfNumberOnly[] newArray(int size) { + return new ArrayOfArrayOfNumberOnly[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ArrayArrayNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayOfArrayOfNumberOnly + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayOfArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayOfArrayOfNumberOnly is not found in the empty JSON string", ArrayOfArrayOfNumberOnly.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("ArrayArrayNumber") != null && !jsonObj.get("ArrayArrayNumber").isJsonNull() && !jsonObj.get("ArrayArrayNumber").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `ArrayArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayArrayNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayOfArrayOfNumberOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayOfArrayOfNumberOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayOfArrayOfNumberOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayOfArrayOfNumberOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ArrayOfArrayOfNumberOnly read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayOfArrayOfNumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayOfArrayOfNumberOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayOfArrayOfNumberOnly + * @throws IOException if the JSON string is invalid with respect to ArrayOfArrayOfNumberOnly + */ + public static ArrayOfArrayOfNumberOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayOfArrayOfNumberOnly.class); + } + + /** + * Convert an instance of ArrayOfArrayOfNumberOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..f94c3fffb59c --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -0,0 +1,320 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfNumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOfNumberOnly implements Parcelable { + public static final String SERIALIZED_NAME_ARRAY_NUMBER = "ArrayNumber"; + @SerializedName(SERIALIZED_NAME_ARRAY_NUMBER) + @javax.annotation.Nullable + private List arrayNumber = new ArrayList<>(); + + public ArrayOfNumberOnly() { + } + + public ArrayOfNumberOnly arrayNumber(@javax.annotation.Nullable 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 + + public List getArrayNumber() { + return arrayNumber; + } + + public void setArrayNumber(@javax.annotation.Nullable List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfNumberOnly instance itself + */ + public ArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, arrayOfNumberOnly.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(arrayNumber); + } + + ArrayOfNumberOnly(Parcel in) { + arrayNumber = (List)in.readValue(BigDecimal.class.getClassLoader()); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ArrayOfNumberOnly createFromParcel(Parcel in) { + return new ArrayOfNumberOnly(in); + } + public ArrayOfNumberOnly[] newArray(int size) { + return new ArrayOfNumberOnly[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ArrayNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayOfNumberOnly + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayOfNumberOnly is not found in the empty JSON string", ArrayOfNumberOnly.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("ArrayNumber") != null && !jsonObj.get("ArrayNumber").isJsonNull() && !jsonObj.get("ArrayNumber").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `ArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayOfNumberOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayOfNumberOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayOfNumberOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayOfNumberOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ArrayOfNumberOnly read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayOfNumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayOfNumberOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayOfNumberOnly + * @throws IOException if the JSON string is invalid with respect to ArrayOfNumberOnly + */ + public static ArrayOfNumberOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayOfNumberOnly.class); + } + + /** + * Convert an instance of ArrayOfNumberOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java new file mode 100644 index 000000000000..0df50c70cedc --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -0,0 +1,402 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayTest implements Parcelable { + public static final String SERIALIZED_NAME_ARRAY_OF_STRING = "array_of_string"; + @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRING) + @javax.annotation.Nullable + private List arrayOfString = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_OF_INTEGER) + @javax.annotation.Nullable + private List> arrayArrayOfInteger = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL) + @javax.annotation.Nullable + private List> arrayArrayOfModel = new ArrayList<>(); + + public ArrayTest() { + } + + public ArrayTest arrayOfString(@javax.annotation.Nullable 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 + + public List getArrayOfString() { + return arrayOfString; + } + + public void setArrayOfString(@javax.annotation.Nullable List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + + public ArrayTest arrayArrayOfInteger(@javax.annotation.Nullable 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 + + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + public void setArrayArrayOfInteger(@javax.annotation.Nullable List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + + public ArrayTest arrayArrayOfModel(@javax.annotation.Nullable 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 + + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + public void setArrayArrayOfModel(@javax.annotation.Nullable List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayTest instance itself + */ + public ArrayTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, arrayTest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(arrayOfString); + out.writeValue(arrayArrayOfInteger); + out.writeValue(arrayArrayOfModel); + } + + ArrayTest(Parcel in) { + arrayOfString = (List)in.readValue(null); + arrayArrayOfInteger = (List>)in.readValue(List.class.getClassLoader()); + arrayArrayOfModel = (List>)in.readValue(List.class.getClassLoader()); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ArrayTest createFromParcel(Parcel in) { + return new ArrayTest(in); + } + public ArrayTest[] newArray(int size) { + return new ArrayTest[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("array_of_string", "array_array_of_integer", "array_array_of_model")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayTest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayTest is not found in the empty JSON string", ArrayTest.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("array_of_string") != null && !jsonObj.get("array_of_string").isJsonNull() && !jsonObj.get("array_of_string").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_of_string` to be an array in the JSON string but got `%s`", jsonObj.get("array_of_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_array_of_integer") != null && !jsonObj.get("array_array_of_integer").isJsonNull() && !jsonObj.get("array_array_of_integer").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_array_of_integer` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_integer").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_array_of_model") != null && !jsonObj.get("array_array_of_model").isJsonNull() && !jsonObj.get("array_array_of_model").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_array_of_model` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_model").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayTest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayTest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayTest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayTest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ArrayTest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayTest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayTest + * @throws IOException if the JSON string is invalid with respect to ArrayTest + */ + public static ArrayTest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayTest.class); + } + + /** + * Convert an instance of ArrayTest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 000000000000..d9d79ee3199f --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,373 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Cat; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BigCat + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class BigCat extends Cat implements Parcelable { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nullable + private KindEnum kind; + + public BigCat() { + super(); + this.className = this.getClass().getSimpleName(); + } + + public BigCat kind(@javax.annotation.Nullable KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nullable + + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nullable KindEnum kind) { + this.kind = kind; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BigCat instance itself + */ + public BigCat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind)&& + Objects.equals(this.additionalProperties, bigCat.additionalProperties) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode(), additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + super.writeToParcel(out, flags); + out.writeValue(kind); + } + + BigCat(Parcel in) { + super(in); + kind = (KindEnum)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public BigCat createFromParcel(Parcel in) { + return new BigCat(in); + } + public BigCat[] newArray(int size) { + return new BigCat[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "declawed", "kind")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BigCat + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BigCat.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in BigCat is not found in the empty JSON string", BigCat.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BigCat.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BigCat.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BigCat' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BigCat.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BigCat value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BigCat read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BigCat instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BigCat given an JSON string + * + * @param jsonString JSON string + * @return An instance of BigCat + * @throws IOException if the JSON string is invalid with respect to BigCat + */ + public static BigCat fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BigCat.class); + } + + /** + * Convert an instance of BigCat to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java new file mode 100644 index 000000000000..2c22a0756006 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java @@ -0,0 +1,467 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Capitalization + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Capitalization implements Parcelable { + public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; + @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) + @javax.annotation.Nullable + private String smallCamel; + + public static final String SERIALIZED_NAME_CAPITAL_CAMEL = "CapitalCamel"; + @SerializedName(SERIALIZED_NAME_CAPITAL_CAMEL) + @javax.annotation.Nullable + private String capitalCamel; + + public static final String SERIALIZED_NAME_SMALL_SNAKE = "small_Snake"; + @SerializedName(SERIALIZED_NAME_SMALL_SNAKE) + @javax.annotation.Nullable + private String smallSnake; + + public static final String SERIALIZED_NAME_CAPITAL_SNAKE = "Capital_Snake"; + @SerializedName(SERIALIZED_NAME_CAPITAL_SNAKE) + @javax.annotation.Nullable + private String capitalSnake; + + public static final String SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + @SerializedName(SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS) + @javax.annotation.Nullable + private String scAETHFlowPoints; + + public static final String SERIALIZED_NAME_A_T_T_N_A_M_E = "ATT_NAME"; + @SerializedName(SERIALIZED_NAME_A_T_T_N_A_M_E) + @javax.annotation.Nullable + private String ATT_NAME; + + public Capitalization() { + } + + public Capitalization smallCamel(@javax.annotation.Nullable String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + */ + @javax.annotation.Nullable + + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(@javax.annotation.Nullable String smallCamel) { + this.smallCamel = smallCamel; + } + + + public Capitalization capitalCamel(@javax.annotation.Nullable String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + */ + @javax.annotation.Nullable + + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(@javax.annotation.Nullable String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + + public Capitalization smallSnake(@javax.annotation.Nullable String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + */ + @javax.annotation.Nullable + + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(@javax.annotation.Nullable String smallSnake) { + this.smallSnake = smallSnake; + } + + + public Capitalization capitalSnake(@javax.annotation.Nullable String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + */ + @javax.annotation.Nullable + + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(@javax.annotation.Nullable String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + + public Capitalization scAETHFlowPoints(@javax.annotation.Nullable String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + */ + @javax.annotation.Nullable + + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(@javax.annotation.Nullable String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + + public Capitalization ATT_NAME(@javax.annotation.Nullable String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + */ + @javax.annotation.Nullable + + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(@javax.annotation.Nullable String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Capitalization instance itself + */ + public Capitalization putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, capitalization.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(smallCamel); + out.writeValue(capitalCamel); + out.writeValue(smallSnake); + out.writeValue(capitalSnake); + out.writeValue(scAETHFlowPoints); + out.writeValue(ATT_NAME); + } + + Capitalization(Parcel in) { + smallCamel = (String)in.readValue(null); + capitalCamel = (String)in.readValue(null); + smallSnake = (String)in.readValue(null); + capitalSnake = (String)in.readValue(null); + scAETHFlowPoints = (String)in.readValue(null); + ATT_NAME = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Capitalization createFromParcel(Parcel in) { + return new Capitalization(in); + } + public Capitalization[] newArray(int size) { + return new Capitalization[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Capitalization + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Capitalization.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Capitalization is not found in the empty JSON string", Capitalization.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("smallCamel") != null && !jsonObj.get("smallCamel").isJsonNull()) && !jsonObj.get("smallCamel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `smallCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("smallCamel").toString())); + } + if ((jsonObj.get("CapitalCamel") != null && !jsonObj.get("CapitalCamel").isJsonNull()) && !jsonObj.get("CapitalCamel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `CapitalCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("CapitalCamel").toString())); + } + if ((jsonObj.get("small_Snake") != null && !jsonObj.get("small_Snake").isJsonNull()) && !jsonObj.get("small_Snake").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `small_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("small_Snake").toString())); + } + if ((jsonObj.get("Capital_Snake") != null && !jsonObj.get("Capital_Snake").isJsonNull()) && !jsonObj.get("Capital_Snake").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `Capital_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Capital_Snake").toString())); + } + if ((jsonObj.get("SCA_ETH_Flow_Points") != null && !jsonObj.get("SCA_ETH_Flow_Points").isJsonNull()) && !jsonObj.get("SCA_ETH_Flow_Points").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `SCA_ETH_Flow_Points` to be a primitive type in the JSON string but got `%s`", jsonObj.get("SCA_ETH_Flow_Points").toString())); + } + if ((jsonObj.get("ATT_NAME") != null && !jsonObj.get("ATT_NAME").isJsonNull()) && !jsonObj.get("ATT_NAME").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `ATT_NAME` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ATT_NAME").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Capitalization.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Capitalization' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Capitalization.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Capitalization value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Capitalization read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Capitalization instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Capitalization given an JSON string + * + * @param jsonString JSON string + * @return An instance of Capitalization + * @throws IOException if the JSON string is invalid with respect to Capitalization + */ + public static Capitalization fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Capitalization.class); + } + + /** + * Convert an instance of Capitalization to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 000000000000..72ee935334e2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,248 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Cat + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Cat extends Animal implements Parcelable { + public static final String SERIALIZED_NAME_DECLAWED = "declawed"; + @SerializedName(SERIALIZED_NAME_DECLAWED) + @javax.annotation.Nullable + private Boolean declawed; + + public Cat() { + super(); + this.className = this.getClass().getSimpleName(); + } + + public Cat declawed(@javax.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + */ + @javax.annotation.Nullable + + public Boolean getDeclawed() { + return declawed; + } + + public void setDeclawed(@javax.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Cat instance itself + */ + public Cat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, cat.additionalProperties) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode(), additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + super.writeToParcel(out, flags); + out.writeValue(declawed); + } + + Cat(Parcel in) { + super(in); + declawed = (Boolean)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Cat createFromParcel(Parcel in) { + return new Cat(in); + } + public Cat[] newArray(int size) { + return new Cat[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "declawed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Cat + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Cat.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Cat is not found in the empty JSON string", Cat.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("className").getAsString(); + switch (discriminatorValue) { + case "BigCat": + BigCat.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The value of the `className` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Cat given an JSON string + * + * @param jsonString JSON string + * @return An instance of Cat + * @throws IOException if the JSON string is invalid with respect to Cat + */ + public static Cat fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Cat.class); + } + + /** + * Convert an instance of Cat to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..bf6b9f5ca0eb --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,343 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Category + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Category implements Parcelable { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name = "default-name"; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, category.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(id); + out.writeValue(name); + } + + Category(Parcel in) { + id = (Long)in.readValue(null); + name = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Category createFromParcel(Parcel in) { + return new Category(in); + } + public Category[] newArray(int size) { + return new Category[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Category + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Category.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Category.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Category' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Category.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Category value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Category read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Category given an JSON string + * + * @param jsonString JSON string + * @return An instance of Category + * @throws IOException if the JSON string is invalid with respect to Category + */ + public static Category fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Category.class); + } + + /** + * Convert an instance of Category to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java new file mode 100644 index 000000000000..451250be39a9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java @@ -0,0 +1,307 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model with \"_class\" property + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ClassModel implements Parcelable { + public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; + @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) + @javax.annotation.Nullable + private String propertyClass; + + public ClassModel() { + } + + public ClassModel propertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @javax.annotation.Nullable + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ClassModel instance itself + */ + public ClassModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, classModel.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(propertyClass); + } + + ClassModel(Parcel in) { + propertyClass = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ClassModel createFromParcel(Parcel in) { + return new ClassModel(in); + } + public ClassModel[] newArray(int size) { + return new ClassModel[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("_class")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ClassModel is not found in the empty JSON string", ClassModel.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("_class") != null && !jsonObj.get("_class").isJsonNull()) && !jsonObj.get("_class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `_class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_class").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ClassModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ClassModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassModel + * @throws IOException if the JSON string is invalid with respect to ClassModel + */ + public static ClassModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassModel.class); + } + + /** + * Convert an instance of ClassModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Client.java new file mode 100644 index 000000000000..44eee7933cb2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Client.java @@ -0,0 +1,307 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Client implements Parcelable { + public static final String SERIALIZED_NAME_CLIENT = "client"; + @SerializedName(SERIALIZED_NAME_CLIENT) + @javax.annotation.Nullable + private String client; + + public Client() { + } + + public Client client(@javax.annotation.Nullable String client) { + this.client = client; + return this; + } + + /** + * Get client + * @return client + */ + @javax.annotation.Nullable + + public String getClient() { + return client; + } + + public void setClient(@javax.annotation.Nullable String client) { + this.client = client; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Client instance itself + */ + public Client putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, client.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(client, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(client); + } + + Client(Parcel in) { + client = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Client createFromParcel(Parcel in) { + return new Client(in); + } + public Client[] newArray(int size) { + return new Client[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("client")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Client + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Client.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Client is not found in the empty JSON string", Client.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("client") != null && !jsonObj.get("client").isJsonNull()) && !jsonObj.get("client").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `client` to be a primitive type in the JSON string but got `%s`", jsonObj.get("client").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Client.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Client' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Client.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Client value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Client read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Client instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Client given an JSON string + * + * @param jsonString JSON string + * @return An instance of Client + * @throws IOException if the JSON string is invalid with respect to Client + */ + public static Client fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Client.class); + } + + /** + * Convert an instance of Client to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 000000000000..1522e8fd7680 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,317 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Dog + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Dog extends Animal implements Parcelable { + public static final String SERIALIZED_NAME_BREED = "breed"; + @SerializedName(SERIALIZED_NAME_BREED) + @javax.annotation.Nullable + private String breed; + + public Dog() { + super(); + this.className = this.getClass().getSimpleName(); + } + + public Dog breed(@javax.annotation.Nullable String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + */ + @javax.annotation.Nullable + + public String getBreed() { + return breed; + } + + public void setBreed(@javax.annotation.Nullable String breed) { + this.breed = breed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Dog instance itself + */ + public Dog putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, dog.additionalProperties) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode(), additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + super.writeToParcel(out, flags); + out.writeValue(breed); + } + + Dog(Parcel in) { + super(in); + breed = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Dog createFromParcel(Parcel in) { + return new Dog(in); + } + public Dog[] newArray(int size) { + return new Dog[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "breed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Dog + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Dog.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Dog is not found in the empty JSON string", Dog.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Dog.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Dog.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Dog' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Dog.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Dog value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Dog read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Dog instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Dog given an JSON string + * + * @param jsonString JSON string + * @return An instance of Dog + * @throws IOException if the JSON string is invalid with respect to Dog + */ + public static Dog fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Dog.class); + } + + /** + * Convert an instance of Dog to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java new file mode 100644 index 000000000000..e9bc1ed7ae57 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -0,0 +1,459 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EnumArrays + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class EnumArrays implements Parcelable { + /** + * Gets or Sets justSymbol + */ + @JsonAdapter(JustSymbolEnum.Adapter.class) + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final JustSymbolEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public JustSymbolEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return JustSymbolEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + JustSymbolEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_JUST_SYMBOL = "just_symbol"; + @SerializedName(SERIALIZED_NAME_JUST_SYMBOL) + @javax.annotation.Nullable + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + @JsonAdapter(ArrayEnumEnum.Adapter.class) + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ArrayEnumEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ArrayEnumEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ArrayEnumEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ArrayEnumEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ARRAY_ENUM = "array_enum"; + @SerializedName(SERIALIZED_NAME_ARRAY_ENUM) + @javax.annotation.Nullable + private List arrayEnum = new ArrayList<>(); + + public EnumArrays() { + } + + public EnumArrays justSymbol(@javax.annotation.Nullable JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + */ + @javax.annotation.Nullable + + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + public void setJustSymbol(@javax.annotation.Nullable JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + + public EnumArrays arrayEnum(@javax.annotation.Nullable 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 + + public List getArrayEnum() { + return arrayEnum; + } + + public void setArrayEnum(@javax.annotation.Nullable List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumArrays instance itself + */ + public EnumArrays putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, enumArrays.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(justSymbol); + out.writeValue(arrayEnum); + } + + EnumArrays(Parcel in) { + justSymbol = (JustSymbolEnum)in.readValue(null); + arrayEnum = (List)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public EnumArrays createFromParcel(Parcel in) { + return new EnumArrays(in); + } + public EnumArrays[] newArray(int size) { + return new EnumArrays[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("just_symbol", "array_enum")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EnumArrays + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EnumArrays.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in EnumArrays is not found in the empty JSON string", EnumArrays.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonNull()) && !jsonObj.get("just_symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `just_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("just_symbol").toString())); + } + // validate the optional field `just_symbol` + if (jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonNull()) { + JustSymbolEnum.validateJsonElement(jsonObj.get("just_symbol")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_enum") != null && !jsonObj.get("array_enum").isJsonNull() && !jsonObj.get("array_enum").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_enum` to be an array in the JSON string but got `%s`", jsonObj.get("array_enum").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EnumArrays.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EnumArrays' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EnumArrays.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EnumArrays value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EnumArrays read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EnumArrays instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EnumArrays given an JSON string + * + * @param jsonString JSON string + * @return An instance of EnumArrays + * @throws IOException if the JSON string is invalid with respect to EnumArrays + */ + public static EnumArrays fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EnumArrays.class); + } + + /** + * Convert an instance of EnumArrays to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumClass.java new file mode 100644 index 000000000000..5668c62bebe2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumClass.java @@ -0,0 +1,82 @@ +/* + * 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 com.google.gson.annotations.SerializedName; +import android.os.Parcelable; +import android.os.Parcel; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets EnumClass + */ +@JsonAdapter(EnumClass.Adapter.class) +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EnumClass fromValue(String value) { + for (EnumClass b : EnumClass.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumClass enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumClass read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumClass.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EnumClass.fromValue(value); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java new file mode 100644 index 000000000000..af5e51713762 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java @@ -0,0 +1,664 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.OuterEnum; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EnumTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class EnumTest implements Parcelable { + /** + * Gets or Sets enumString + */ + @JsonAdapter(EnumStringEnum.Adapter.class) + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumStringEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumStringEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumStringEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EnumStringEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_STRING = "enum_string"; + @SerializedName(SERIALIZED_NAME_ENUM_STRING) + @javax.annotation.Nullable + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + @JsonAdapter(EnumStringRequiredEnum.Adapter.class) + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumStringRequiredEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumStringRequiredEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumStringRequiredEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EnumStringRequiredEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_STRING_REQUIRED = "enum_string_required"; + @SerializedName(SERIALIZED_NAME_ENUM_STRING_REQUIRED) + @javax.annotation.Nonnull + private EnumStringRequiredEnum enumStringRequired; + + /** + * Gets or Sets enumInteger + */ + @JsonAdapter(EnumIntegerEnum.Adapter.class) + public enum EnumIntegerEnum { + NUMBER_1(1), + + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumIntegerEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumIntegerEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return EnumIntegerEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + EnumIntegerEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_INTEGER = "enum_integer"; + @SerializedName(SERIALIZED_NAME_ENUM_INTEGER) + @javax.annotation.Nullable + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumNumber + */ + @JsonAdapter(EnumNumberEnum.Adapter.class) + 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; + } + + public Double getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumNumberEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumNumberEnum read(final JsonReader jsonReader) throws IOException { + Double value = jsonReader.nextDouble(); + return EnumNumberEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Double value = jsonElement.getAsDouble(); + EnumNumberEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_NUMBER = "enum_number"; + @SerializedName(SERIALIZED_NAME_ENUM_NUMBER) + @javax.annotation.Nullable + private EnumNumberEnum enumNumber; + + public static final String SERIALIZED_NAME_OUTER_ENUM = "outerEnum"; + @SerializedName(SERIALIZED_NAME_OUTER_ENUM) + @javax.annotation.Nullable + private OuterEnum outerEnum; + + public EnumTest() { + } + + public EnumTest enumString(@javax.annotation.Nullable EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + */ + @javax.annotation.Nullable + + public EnumStringEnum getEnumString() { + return enumString; + } + + public void setEnumString(@javax.annotation.Nullable EnumStringEnum enumString) { + this.enumString = enumString; + } + + + public EnumTest enumStringRequired(@javax.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + */ + @javax.annotation.Nonnull + + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(@javax.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + + public EnumTest enumInteger(@javax.annotation.Nullable EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + */ + @javax.annotation.Nullable + + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + public void setEnumInteger(@javax.annotation.Nullable EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + public EnumTest enumNumber(@javax.annotation.Nullable EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + */ + @javax.annotation.Nullable + + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + public void setEnumNumber(@javax.annotation.Nullable EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + public EnumTest outerEnum(@javax.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + */ + @javax.annotation.Nullable + + public OuterEnum getOuterEnum() { + return outerEnum; + } + + public void setOuterEnum(@javax.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumTest instance itself + */ + public EnumTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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.additionalProperties, enumTest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(enumString); + out.writeValue(enumStringRequired); + out.writeValue(enumInteger); + out.writeValue(enumNumber); + out.writeValue(outerEnum); + } + + EnumTest(Parcel in) { + enumString = (EnumStringEnum)in.readValue(null); + enumStringRequired = (EnumStringRequiredEnum)in.readValue(null); + enumInteger = (EnumIntegerEnum)in.readValue(null); + enumNumber = (EnumNumberEnum)in.readValue(null); + outerEnum = (OuterEnum)in.readValue(OuterEnum.class.getClassLoader()); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public EnumTest createFromParcel(Parcel in) { + return new EnumTest(in); + } + public EnumTest[] newArray(int size) { + return new EnumTest[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("enum_string", "enum_string_required", "enum_integer", "enum_number", "outerEnum")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("enum_string_required")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EnumTest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EnumTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in EnumTest is not found in the empty JSON string", EnumTest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EnumTest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonNull()) && !jsonObj.get("enum_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `enum_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string").toString())); + } + // validate the optional field `enum_string` + if (jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonNull()) { + EnumStringEnum.validateJsonElement(jsonObj.get("enum_string")); + } + if (!jsonObj.get("enum_string_required").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `enum_string_required` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string_required").toString())); + } + // validate the required field `enum_string_required` + EnumStringRequiredEnum.validateJsonElement(jsonObj.get("enum_string_required")); + // validate the optional field `enum_integer` + if (jsonObj.get("enum_integer") != null && !jsonObj.get("enum_integer").isJsonNull()) { + EnumIntegerEnum.validateJsonElement(jsonObj.get("enum_integer")); + } + // validate the optional field `enum_number` + if (jsonObj.get("enum_number") != null && !jsonObj.get("enum_number").isJsonNull()) { + EnumNumberEnum.validateJsonElement(jsonObj.get("enum_number")); + } + // validate the optional field `outerEnum` + if (jsonObj.get("outerEnum") != null && !jsonObj.get("outerEnum").isJsonNull()) { + OuterEnum.validateJsonElement(jsonObj.get("outerEnum")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EnumTest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EnumTest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EnumTest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EnumTest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EnumTest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EnumTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EnumTest given an JSON string + * + * @param jsonString JSON string + * @return An instance of EnumTest + * @throws IOException if the JSON string is invalid with respect to EnumTest + */ + public static EnumTest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EnumTest.class); + } + + /** + * Convert an instance of EnumTest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..0369a55a0cee --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,363 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FileSchemaTestClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FileSchemaTestClass implements Parcelable { + public static final String SERIALIZED_NAME_FILE = "file"; + @SerializedName(SERIALIZED_NAME_FILE) + @javax.annotation.Nullable + private ModelFile _file; + + public static final String SERIALIZED_NAME_FILES = "files"; + @SerializedName(SERIALIZED_NAME_FILES) + @javax.annotation.Nullable + private List files = new ArrayList<>(); + + public FileSchemaTestClass() { + } + + public FileSchemaTestClass _file(@javax.annotation.Nullable ModelFile _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + @javax.annotation.Nullable + + public ModelFile getFile() { + return _file; + } + + public void setFile(@javax.annotation.Nullable ModelFile _file) { + this._file = _file; + } + + + public FileSchemaTestClass files(@javax.annotation.Nullable List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(ModelFile filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + */ + @javax.annotation.Nullable + + public List getFiles() { + return files; + } + + public void setFiles(@javax.annotation.Nullable List files) { + this.files = files; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FileSchemaTestClass instance itself + */ + public FileSchemaTestClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, fileSchemaTestClass.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(_file, files, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(_file); + out.writeValue(files); + } + + FileSchemaTestClass(Parcel in) { + _file = (ModelFile)in.readValue(ModelFile.class.getClassLoader()); + files = (List)in.readValue(ModelFile.class.getClassLoader()); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public FileSchemaTestClass createFromParcel(Parcel in) { + return new FileSchemaTestClass(in); + } + public FileSchemaTestClass[] newArray(int size) { + return new FileSchemaTestClass[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("file", "files")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FileSchemaTestClass + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FileSchemaTestClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FileSchemaTestClass is not found in the empty JSON string", FileSchemaTestClass.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `file` + if (jsonObj.get("file") != null && !jsonObj.get("file").isJsonNull()) { + ModelFile.validateJsonElement(jsonObj.get("file")); + } + if (jsonObj.get("files") != null && !jsonObj.get("files").isJsonNull()) { + JsonArray jsonArrayfiles = jsonObj.getAsJsonArray("files"); + if (jsonArrayfiles != null) { + // ensure the json data is an array + if (!jsonObj.get("files").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `files` to be an array in the JSON string but got `%s`", jsonObj.get("files").toString())); + } + + // validate the optional field `files` (array) + for (int i = 0; i < jsonArrayfiles.size(); i++) { + ModelFile.validateJsonElement(jsonArrayfiles.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FileSchemaTestClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FileSchemaTestClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FileSchemaTestClass.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FileSchemaTestClass value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FileSchemaTestClass read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FileSchemaTestClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FileSchemaTestClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of FileSchemaTestClass + * @throws IOException if the JSON string is invalid with respect to FileSchemaTestClass + */ + public static FileSchemaTestClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FileSchemaTestClass.class); + } + + /** + * Convert an instance of FileSchemaTestClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java new file mode 100644 index 000000000000..b4430e0d982b --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java @@ -0,0 +1,712 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.File; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FormatTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FormatTest implements Parcelable { + public static final String SERIALIZED_NAME_INTEGER = "integer"; + @SerializedName(SERIALIZED_NAME_INTEGER) + @javax.annotation.Nullable + private Integer integer; + + public static final String SERIALIZED_NAME_INT32 = "int32"; + @SerializedName(SERIALIZED_NAME_INT32) + @javax.annotation.Nullable + private Integer int32; + + public static final String SERIALIZED_NAME_INT64 = "int64"; + @SerializedName(SERIALIZED_NAME_INT64) + @javax.annotation.Nullable + private Long int64; + + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) + @javax.annotation.Nonnull + private BigDecimal number; + + public static final String SERIALIZED_NAME_FLOAT = "float"; + @SerializedName(SERIALIZED_NAME_FLOAT) + @javax.annotation.Nullable + private Float _float; + + public static final String SERIALIZED_NAME_DOUBLE = "double"; + @SerializedName(SERIALIZED_NAME_DOUBLE) + @javax.annotation.Nullable + private Double _double; + + public static final String SERIALIZED_NAME_STRING = "string"; + @SerializedName(SERIALIZED_NAME_STRING) + @javax.annotation.Nullable + private String string; + + public static final String SERIALIZED_NAME_BYTE = "byte"; + @SerializedName(SERIALIZED_NAME_BYTE) + @javax.annotation.Nonnull + private byte[] _byte; + + public static final String SERIALIZED_NAME_BINARY = "binary"; + @SerializedName(SERIALIZED_NAME_BINARY) + @javax.annotation.Nullable + private File binary; + + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) + @javax.annotation.Nonnull + private LocalDate date; + + public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; + @SerializedName(SERIALIZED_NAME_DATE_TIME) + @javax.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String SERIALIZED_NAME_UUID = "uuid"; + @SerializedName(SERIALIZED_NAME_UUID) + @javax.annotation.Nullable + private UUID uuid; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nonnull + private String password; + + public static final String SERIALIZED_NAME_BIG_DECIMAL = "BigDecimal"; + @SerializedName(SERIALIZED_NAME_BIG_DECIMAL) + @javax.annotation.Nullable + private BigDecimal bigDecimal; + + public FormatTest() { + } + + public FormatTest integer(@javax.annotation.Nullable Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + */ + @javax.annotation.Nullable + + public Integer getInteger() { + return integer; + } + + public void setInteger(@javax.annotation.Nullable Integer integer) { + this.integer = integer; + } + + + public FormatTest int32(@javax.annotation.Nullable Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + */ + @javax.annotation.Nullable + + public Integer getInt32() { + return int32; + } + + public void setInt32(@javax.annotation.Nullable Integer int32) { + this.int32 = int32; + } + + + public FormatTest int64(@javax.annotation.Nullable Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + */ + @javax.annotation.Nullable + + public Long getInt64() { + return int64; + } + + public void setInt64(@javax.annotation.Nullable Long int64) { + this.int64 = int64; + } + + + public FormatTest number(@javax.annotation.Nonnull BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + */ + @javax.annotation.Nonnull + + public BigDecimal getNumber() { + return number; + } + + public void setNumber(@javax.annotation.Nonnull BigDecimal number) { + this.number = number; + } + + + public FormatTest _float(@javax.annotation.Nullable Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + */ + @javax.annotation.Nullable + + public Float getFloat() { + return _float; + } + + public void setFloat(@javax.annotation.Nullable Float _float) { + this._float = _float; + } + + + public FormatTest _double(@javax.annotation.Nullable Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + */ + @javax.annotation.Nullable + + public Double getDouble() { + return _double; + } + + public void setDouble(@javax.annotation.Nullable Double _double) { + this._double = _double; + } + + + public FormatTest string(@javax.annotation.Nullable String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + */ + @javax.annotation.Nullable + + public String getString() { + return string; + } + + public void setString(@javax.annotation.Nullable String string) { + this.string = string; + } + + + public FormatTest _byte(@javax.annotation.Nonnull byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + */ + @javax.annotation.Nonnull + + public byte[] getByte() { + return _byte; + } + + public void setByte(@javax.annotation.Nonnull byte[] _byte) { + this._byte = _byte; + } + + + public FormatTest binary(@javax.annotation.Nullable File binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + */ + @javax.annotation.Nullable + + public File getBinary() { + return binary; + } + + public void setBinary(@javax.annotation.Nullable File binary) { + this.binary = binary; + } + + + public FormatTest date(@javax.annotation.Nonnull LocalDate date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + */ + @javax.annotation.Nonnull + + public LocalDate getDate() { + return date; + } + + public void setDate(@javax.annotation.Nonnull LocalDate date) { + this.date = date; + } + + + public FormatTest dateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @javax.annotation.Nullable + + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public FormatTest uuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + + public UUID getUuid() { + return uuid; + } + + public void setUuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + + public FormatTest password(@javax.annotation.Nonnull String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nonnull + + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nonnull String password) { + this.password = password; + } + + + public FormatTest bigDecimal(@javax.annotation.Nullable BigDecimal bigDecimal) { + this.bigDecimal = bigDecimal; + return this; + } + + /** + * Get bigDecimal + * @return bigDecimal + */ + @javax.annotation.Nullable + + public BigDecimal getBigDecimal() { + return bigDecimal; + } + + public void setBigDecimal(@javax.annotation.Nullable BigDecimal bigDecimal) { + this.bigDecimal = bigDecimal; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FormatTest instance itself + */ + public FormatTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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.bigDecimal, formatTest.bigDecimal)&& + Objects.equals(this.additionalProperties, formatTest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal, additionalProperties); + } + + @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("*").append("\n"); + sb.append(" bigDecimal: ").append(toIndentedString(bigDecimal)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(integer); + out.writeValue(int32); + out.writeValue(int64); + out.writeValue(number); + out.writeValue(_float); + out.writeValue(_double); + out.writeValue(string); + out.writeValue(_byte); + out.writeValue(binary); + out.writeValue(date); + out.writeValue(dateTime); + out.writeValue(uuid); + out.writeValue(password); + out.writeValue(bigDecimal); + } + + FormatTest(Parcel in) { + integer = (Integer)in.readValue(null); + int32 = (Integer)in.readValue(null); + int64 = (Long)in.readValue(null); + number = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); + _float = (Float)in.readValue(null); + _double = (Double)in.readValue(null); + string = (String)in.readValue(null); + _byte = (byte[])in.readValue(null); + binary = (File)in.readValue(File.class.getClassLoader()); + date = (LocalDate)in.readValue(LocalDate.class.getClassLoader()); + dateTime = (OffsetDateTime)in.readValue(OffsetDateTime.class.getClassLoader()); + uuid = (UUID)in.readValue(UUID.class.getClassLoader()); + password = (String)in.readValue(null); + bigDecimal = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public FormatTest createFromParcel(Parcel in) { + return new FormatTest(in); + } + public FormatTest[] newArray(int size) { + return new FormatTest[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer", "int32", "int64", "number", "float", "double", "string", "byte", "binary", "date", "dateTime", "uuid", "password", "BigDecimal")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("number", "byte", "date", "password")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FormatTest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FormatTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FormatTest is not found in the empty JSON string", FormatTest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FormatTest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("string") != null && !jsonObj.get("string").isJsonNull()) && !jsonObj.get("string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string").toString())); + } + if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } + if (!jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FormatTest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FormatTest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FormatTest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FormatTest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FormatTest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FormatTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FormatTest given an JSON string + * + * @param jsonString JSON string + * @return An instance of FormatTest + * @throws IOException if the JSON string is invalid with respect to FormatTest + */ + public static FormatTest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FormatTest.class); + } + + /** + * Convert an instance of FormatTest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..5f67b6d5e431 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -0,0 +1,332 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * HasOnlyReadOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class HasOnlyReadOnly implements Parcelable { + public static final String SERIALIZED_NAME_BAR = "bar"; + @SerializedName(SERIALIZED_NAME_BAR) + @javax.annotation.Nullable + private String bar; + + public static final String SERIALIZED_NAME_FOO = "foo"; + @SerializedName(SERIALIZED_NAME_FOO) + @javax.annotation.Nullable + private String foo; + + public HasOnlyReadOnly() { + } + + public HasOnlyReadOnly( + String bar, + String foo + ) { + this(); + this.bar = bar; + this.foo = foo; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + + public String getBar() { + return bar; + } + + + + /** + * Get foo + * @return foo + */ + @javax.annotation.Nullable + + public String getFoo() { + return foo; + } + + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the HasOnlyReadOnly instance itself + */ + public HasOnlyReadOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, hasOnlyReadOnly.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(bar); + out.writeValue(foo); + } + + HasOnlyReadOnly(Parcel in) { + bar = (String)in.readValue(null); + foo = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public HasOnlyReadOnly createFromParcel(Parcel in) { + return new HasOnlyReadOnly(in); + } + public HasOnlyReadOnly[] newArray(int size) { + return new HasOnlyReadOnly[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar", "foo")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HasOnlyReadOnly + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HasOnlyReadOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in HasOnlyReadOnly is not found in the empty JSON string", HasOnlyReadOnly.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonNull()) && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } + if ((jsonObj.get("foo") != null && !jsonObj.get("foo").isJsonNull()) && !jsonObj.get("foo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `foo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("foo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HasOnlyReadOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HasOnlyReadOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HasOnlyReadOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HasOnlyReadOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public HasOnlyReadOnly read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + HasOnlyReadOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HasOnlyReadOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of HasOnlyReadOnly + * @throws IOException if the JSON string is invalid with respect to HasOnlyReadOnly + */ + public static HasOnlyReadOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HasOnlyReadOnly.class); + } + + /** + * Convert an instance of HasOnlyReadOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java new file mode 100644 index 000000000000..3207de750d39 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,477 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * MapTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class MapTest implements Parcelable { + public static final String SERIALIZED_NAME_MAP_MAP_OF_STRING = "map_map_of_string"; + @SerializedName(SERIALIZED_NAME_MAP_MAP_OF_STRING) + @javax.annotation.Nullable + private Map> mapMapOfString = new HashMap<>(); + + /** + * Gets or Sets inner + */ + @JsonAdapter(InnerEnum.Adapter.class) + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final InnerEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public InnerEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return InnerEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + InnerEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_MAP_OF_ENUM_STRING = "map_of_enum_string"; + @SerializedName(SERIALIZED_NAME_MAP_OF_ENUM_STRING) + @javax.annotation.Nullable + private Map mapOfEnumString = new HashMap<>(); + + public static final String SERIALIZED_NAME_DIRECT_MAP = "direct_map"; + @SerializedName(SERIALIZED_NAME_DIRECT_MAP) + @javax.annotation.Nullable + private Map directMap = new HashMap<>(); + + public static final String SERIALIZED_NAME_INDIRECT_MAP = "indirect_map"; + @SerializedName(SERIALIZED_NAME_INDIRECT_MAP) + @javax.annotation.Nullable + private Map indirectMap = new HashMap<>(); + + public MapTest() { + } + + public MapTest mapMapOfString(@javax.annotation.Nullable 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 + + public Map> getMapMapOfString() { + return mapMapOfString; + } + + public void setMapMapOfString(@javax.annotation.Nullable Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + + public MapTest mapOfEnumString(@javax.annotation.Nullable 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 + + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + public void setMapOfEnumString(@javax.annotation.Nullable Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + + public MapTest directMap(@javax.annotation.Nullable 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 + + public Map getDirectMap() { + return directMap; + } + + public void setDirectMap(@javax.annotation.Nullable Map directMap) { + this.directMap = directMap; + } + + + public MapTest indirectMap(@javax.annotation.Nullable 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 + + public Map getIndirectMap() { + return indirectMap; + } + + public void setIndirectMap(@javax.annotation.Nullable Map indirectMap) { + this.indirectMap = indirectMap; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MapTest instance itself + */ + public MapTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, mapTest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(mapMapOfString); + out.writeValue(mapOfEnumString); + out.writeValue(directMap); + out.writeValue(indirectMap); + } + + MapTest(Parcel in) { + mapMapOfString = (Map>)in.readValue(Map.class.getClassLoader()); + mapOfEnumString = (Map)in.readValue(null); + directMap = (Map)in.readValue(null); + indirectMap = (Map)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public MapTest createFromParcel(Parcel in) { + return new MapTest(in); + } + public MapTest[] newArray(int size) { + return new MapTest[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MapTest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MapTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in MapTest is not found in the empty JSON string", MapTest.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MapTest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MapTest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MapTest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MapTest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MapTest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MapTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MapTest given an JSON string + * + * @param jsonString JSON string + * @return An instance of MapTest + * @throws IOException if the JSON string is invalid with respect to MapTest + */ + public static MapTest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MapTest.class); + } + + /** + * Convert an instance of MapTest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..3f66272cfb6b --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,378 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class MixedPropertiesAndAdditionalPropertiesClass implements Parcelable { + public static final String SERIALIZED_NAME_UUID = "uuid"; + @SerializedName(SERIALIZED_NAME_UUID) + @javax.annotation.Nullable + private UUID uuid; + + public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; + @SerializedName(SERIALIZED_NAME_DATE_TIME) + @javax.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String SERIALIZED_NAME_MAP = "map"; + @SerializedName(SERIALIZED_NAME_MAP) + @javax.annotation.Nullable + private Map map = new HashMap<>(); + + public MixedPropertiesAndAdditionalPropertiesClass() { + } + + public MixedPropertiesAndAdditionalPropertiesClass uuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + + public UUID getUuid() { + return uuid; + } + + public void setUuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @javax.annotation.Nullable + + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public MixedPropertiesAndAdditionalPropertiesClass map(@javax.annotation.Nullable 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 + + public Map getMap() { + return map; + } + + public void setMap(@javax.annotation.Nullable Map map) { + this.map = map; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MixedPropertiesAndAdditionalPropertiesClass instance itself + */ + public MixedPropertiesAndAdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, mixedPropertiesAndAdditionalPropertiesClass.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(uuid); + out.writeValue(dateTime); + out.writeValue(map); + } + + MixedPropertiesAndAdditionalPropertiesClass(Parcel in) { + uuid = (UUID)in.readValue(UUID.class.getClassLoader()); + dateTime = (OffsetDateTime)in.readValue(OffsetDateTime.class.getClassLoader()); + map = (Map)in.readValue(Animal.class.getClassLoader()); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public MixedPropertiesAndAdditionalPropertiesClass createFromParcel(Parcel in) { + return new MixedPropertiesAndAdditionalPropertiesClass(in); + } + public MixedPropertiesAndAdditionalPropertiesClass[] newArray(int size) { + return new MixedPropertiesAndAdditionalPropertiesClass[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("uuid", "dateTime", "map")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MixedPropertiesAndAdditionalPropertiesClass + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in MixedPropertiesAndAdditionalPropertiesClass is not found in the empty JSON string", MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MixedPropertiesAndAdditionalPropertiesClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MixedPropertiesAndAdditionalPropertiesClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MixedPropertiesAndAdditionalPropertiesClass.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MixedPropertiesAndAdditionalPropertiesClass value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MixedPropertiesAndAdditionalPropertiesClass read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MixedPropertiesAndAdditionalPropertiesClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MixedPropertiesAndAdditionalPropertiesClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of MixedPropertiesAndAdditionalPropertiesClass + * @throws IOException if the JSON string is invalid with respect to MixedPropertiesAndAdditionalPropertiesClass + */ + public static MixedPropertiesAndAdditionalPropertiesClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MixedPropertiesAndAdditionalPropertiesClass.class); + } + + /** + * Convert an instance of MixedPropertiesAndAdditionalPropertiesClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java new file mode 100644 index 000000000000..b126b3e708a2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java @@ -0,0 +1,336 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model name starting with number + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Model200Response implements Parcelable { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private Integer name; + + public static final String SERIALIZED_NAME_PROPERTY_CLASS = "class"; + @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) + @javax.annotation.Nullable + private String propertyClass; + + public Model200Response() { + } + + public Model200Response name(@javax.annotation.Nullable Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public Integer getName() { + return name; + } + + public void setName(@javax.annotation.Nullable Integer name) { + this.name = name; + } + + + public Model200Response propertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @javax.annotation.Nullable + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Model200Response instance itself + */ + public Model200Response putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, _200response.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(name); + out.writeValue(propertyClass); + } + + Model200Response(Parcel in) { + name = (Integer)in.readValue(null); + propertyClass = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Model200Response createFromParcel(Parcel in) { + return new Model200Response(in); + } + public Model200Response[] newArray(int size) { + return new Model200Response[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "class")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Model200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Model200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Model200Response is not found in the empty JSON string", Model200Response.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("class") != null && !jsonObj.get("class").isJsonNull()) && !jsonObj.get("class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("class").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Model200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Model200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Model200Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Model200Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Model200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Model200Response instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Model200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of Model200Response + * @throws IOException if the JSON string is invalid with respect to Model200Response + */ + public static Model200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Model200Response.class); + } + + /** + * Convert an instance of Model200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..a8b8783b40e5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,368 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelApiResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelApiResponse implements Parcelable { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + + public Integer getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, _apiResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(code); + out.writeValue(type); + out.writeValue(message); + } + + ModelApiResponse(Parcel in) { + code = (Integer)in.readValue(null); + type = (String)in.readValue(null); + message = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ModelApiResponse createFromParcel(Parcel in) { + return new ModelApiResponse(in); + } + public ModelApiResponse[] newArray(int size) { + return new ModelApiResponse[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("code", "type", "message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelApiResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelApiResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelApiResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelApiResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelApiResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelApiResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelApiResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelApiResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelApiResponse + * @throws IOException if the JSON string is invalid with respect to ModelApiResponse + */ + public static ModelApiResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelApiResponse.class); + } + + /** + * Convert an instance of ModelApiResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java new file mode 100644 index 000000000000..441e4591d3aa --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java @@ -0,0 +1,307 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Must be named `File` for test. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelFile implements Parcelable { + public static final String SERIALIZED_NAME_SOURCE_U_R_I = "sourceURI"; + @SerializedName(SERIALIZED_NAME_SOURCE_U_R_I) + @javax.annotation.Nullable + private String sourceURI; + + public ModelFile() { + } + + public ModelFile sourceURI(@javax.annotation.Nullable String sourceURI) { + this.sourceURI = sourceURI; + return this; + } + + /** + * Test capitalization + * @return sourceURI + */ + @javax.annotation.Nullable + + public String getSourceURI() { + return sourceURI; + } + + public void setSourceURI(@javax.annotation.Nullable String sourceURI) { + this.sourceURI = sourceURI; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelFile instance itself + */ + public ModelFile putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelFile _file = (ModelFile) o; + return Objects.equals(this.sourceURI, _file.sourceURI)&& + Objects.equals(this.additionalProperties, _file.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(sourceURI, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelFile {\n"); + sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(sourceURI); + } + + ModelFile(Parcel in) { + sourceURI = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ModelFile createFromParcel(Parcel in) { + return new ModelFile(in); + } + public ModelFile[] newArray(int size) { + return new ModelFile[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("sourceURI")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelFile + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelFile.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelFile is not found in the empty JSON string", ModelFile.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("sourceURI") != null && !jsonObj.get("sourceURI").isJsonNull()) && !jsonObj.get("sourceURI").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `sourceURI` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceURI").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelFile.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelFile' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelFile.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelFile value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelFile read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelFile instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelFile given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelFile + * @throws IOException if the JSON string is invalid with respect to ModelFile + */ + public static ModelFile fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelFile.class); + } + + /** + * Convert an instance of ModelFile to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java new file mode 100644 index 000000000000..695dad98276e --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java @@ -0,0 +1,307 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelList implements Parcelable { + public static final String SERIALIZED_NAME_123LIST = "123-list"; + @SerializedName(SERIALIZED_NAME_123LIST) + @javax.annotation.Nullable + private String _123list; + + public ModelList() { + } + + public ModelList _123list(@javax.annotation.Nullable String _123list) { + this._123list = _123list; + return this; + } + + /** + * Get _123list + * @return _123list + */ + @javax.annotation.Nullable + + public String get123list() { + return _123list; + } + + public void set123list(@javax.annotation.Nullable String _123list) { + this._123list = _123list; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelList instance itself + */ + public ModelList putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelList _list = (ModelList) o; + return Objects.equals(this._123list, _list._123list)&& + Objects.equals(this.additionalProperties, _list.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(_123list, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelList {\n"); + sb.append(" _123list: ").append(toIndentedString(_123list)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(_123list); + } + + ModelList(Parcel in) { + _123list = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ModelList createFromParcel(Parcel in) { + return new ModelList(in); + } + public ModelList[] newArray(int size) { + return new ModelList[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("123-list")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelList is not found in the empty JSON string", ModelList.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("123-list") != null && !jsonObj.get("123-list").isJsonNull()) && !jsonObj.get("123-list").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `123-list` to be a primitive type in the JSON string but got `%s`", jsonObj.get("123-list").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelList instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelList given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelList + * @throws IOException if the JSON string is invalid with respect to ModelList + */ + public static ModelList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelList.class); + } + + /** + * Convert an instance of ModelList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java new file mode 100644 index 000000000000..b29b4e979f31 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -0,0 +1,304 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing reserved words + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelReturn implements Parcelable { + public static final String SERIALIZED_NAME_RETURN = "return"; + @SerializedName(SERIALIZED_NAME_RETURN) + @javax.annotation.Nullable + private Integer _return; + + public ModelReturn() { + } + + public ModelReturn _return(@javax.annotation.Nullable Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + */ + @javax.annotation.Nullable + + public Integer getReturn() { + return _return; + } + + public void setReturn(@javax.annotation.Nullable Integer _return) { + this._return = _return; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelReturn instance itself + */ + public ModelReturn putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, _return.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(_return, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(_return); + } + + ModelReturn(Parcel in) { + _return = (Integer)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ModelReturn createFromParcel(Parcel in) { + return new ModelReturn(in); + } + public ModelReturn[] newArray(int size) { + return new ModelReturn[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("return")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelReturn + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelReturn.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelReturn is not found in the empty JSON string", ModelReturn.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelReturn.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelReturn' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelReturn.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelReturn value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelReturn read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelReturn instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelReturn given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelReturn + * @throws IOException if the JSON string is invalid with respect to ModelReturn + */ + public static ModelReturn fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelReturn.class); + } + + /** + * Convert an instance of ModelReturn to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Name.java new file mode 100644 index 000000000000..581806256eaf --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Name.java @@ -0,0 +1,394 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model name same as property name + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Name implements Parcelable { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private Integer name; + + public static final String SERIALIZED_NAME_SNAKE_CASE = "snake_case"; + @SerializedName(SERIALIZED_NAME_SNAKE_CASE) + @javax.annotation.Nullable + private Integer snakeCase; + + public static final String SERIALIZED_NAME_PROPERTY = "property"; + @SerializedName(SERIALIZED_NAME_PROPERTY) + @javax.annotation.Nullable + private String property; + + public static final String SERIALIZED_NAME_123NUMBER = "123Number"; + @SerializedName(SERIALIZED_NAME_123NUMBER) + @javax.annotation.Nullable + private Integer _123number; + + public Name() { + } + + public Name( + Integer snakeCase, + Integer _123number + ) { + this(); + this.snakeCase = snakeCase; + this._123number = _123number; + } + + public Name name(@javax.annotation.Nonnull Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public Integer getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull Integer name) { + this.name = name; + } + + + /** + * Get snakeCase + * @return snakeCase + */ + @javax.annotation.Nullable + + public Integer getSnakeCase() { + return snakeCase; + } + + + + public Name property(@javax.annotation.Nullable String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + */ + @javax.annotation.Nullable + + public String getProperty() { + return property; + } + + public void setProperty(@javax.annotation.Nullable String property) { + this.property = property; + } + + + /** + * Get _123number + * @return _123number + */ + @javax.annotation.Nullable + + public Integer get123number() { + return _123number; + } + + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Name instance itself + */ + public Name putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, name.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(name); + out.writeValue(snakeCase); + out.writeValue(property); + out.writeValue(_123number); + } + + Name(Parcel in) { + name = (Integer)in.readValue(null); + snakeCase = (Integer)in.readValue(null); + property = (String)in.readValue(null); + _123number = (Integer)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Name createFromParcel(Parcel in) { + return new Name(in); + } + public Name[] newArray(int size) { + return new Name[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "snake_case", "property", "123Number")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Name + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Name.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Name is not found in the empty JSON string", Name.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Name.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("property") != null && !jsonObj.get("property").isJsonNull()) && !jsonObj.get("property").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `property` to be a primitive type in the JSON string but got `%s`", jsonObj.get("property").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Name.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Name' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Name.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Name value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Name read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Name instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Name given an JSON string + * + * @param jsonString JSON string + * @return An instance of Name + * @throws IOException if the JSON string is invalid with respect to Name + */ + public static Name fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Name.class); + } + + /** + * Convert an instance of Name to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java new file mode 100644 index 000000000000..7cad5073f7a9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -0,0 +1,305 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NumberOnly implements Parcelable { + public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; + @SerializedName(SERIALIZED_NAME_JUST_NUMBER) + @javax.annotation.Nullable + private BigDecimal justNumber; + + public NumberOnly() { + } + + public NumberOnly justNumber(@javax.annotation.Nullable BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + */ + @javax.annotation.Nullable + + public BigDecimal getJustNumber() { + return justNumber; + } + + public void setJustNumber(@javax.annotation.Nullable BigDecimal justNumber) { + this.justNumber = justNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NumberOnly instance itself + */ + public NumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, numberOnly.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(justNumber); + } + + NumberOnly(Parcel in) { + justNumber = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public NumberOnly createFromParcel(Parcel in) { + return new NumberOnly(in); + } + public NumberOnly[] newArray(int size) { + return new NumberOnly[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("JustNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NumberOnly + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NumberOnly is not found in the empty JSON string", NumberOnly.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NumberOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NumberOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NumberOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NumberOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NumberOnly read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NumberOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of NumberOnly + * @throws IOException if the JSON string is invalid with respect to NumberOnly + */ + public static NumberOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NumberOnly.class); + } + + /** + * Convert an instance of NumberOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..8a995433060d --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,511 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Order + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Order implements Parcelable { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_PET_ID = "petId"; + @SerializedName(SERIALIZED_NAME_PET_ID) + @javax.annotation.Nullable + private Long petId; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; + @SerializedName(SERIALIZED_NAME_SHIP_DATE) + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_COMPLETE = "complete"; + @SerializedName(SERIALIZED_NAME_COMPLETE) + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + + public Long getPetId() { + return petId; + } + + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + + public OffsetDateTime getShipDate() { + return shipDate; + } + + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + + public Boolean getComplete() { + return complete; + } + + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, order.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(id); + out.writeValue(petId); + out.writeValue(quantity); + out.writeValue(shipDate); + out.writeValue(status); + out.writeValue(complete); + } + + Order(Parcel in) { + id = (Long)in.readValue(null); + petId = (Long)in.readValue(null); + quantity = (Integer)in.readValue(null); + shipDate = (OffsetDateTime)in.readValue(OffsetDateTime.class.getClassLoader()); + status = (StatusEnum)in.readValue(null); + complete = (Boolean)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Order createFromParcel(Parcel in) { + return new Order(in); + } + public Order[] newArray(int size) { + return new Order[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "petId", "quantity", "shipDate", "status", "complete")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Order + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Order.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Order' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Order.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Order value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Order read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Order instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Order given an JSON string + * + * @param jsonString JSON string + * @return An instance of Order + * @throws IOException if the JSON string is invalid with respect to Order + */ + public static Order fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Order.class); + } + + /** + * Convert an instance of Order to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java new file mode 100644 index 000000000000..0664a715c7d4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -0,0 +1,366 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OuterComposite + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OuterComposite implements Parcelable { + public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; + @SerializedName(SERIALIZED_NAME_MY_NUMBER) + @javax.annotation.Nullable + private BigDecimal myNumber; + + public static final String SERIALIZED_NAME_MY_STRING = "my_string"; + @SerializedName(SERIALIZED_NAME_MY_STRING) + @javax.annotation.Nullable + private String myString; + + public static final String SERIALIZED_NAME_MY_BOOLEAN = "my_boolean"; + @SerializedName(SERIALIZED_NAME_MY_BOOLEAN) + @javax.annotation.Nullable + private Boolean myBoolean; + + public OuterComposite() { + } + + public OuterComposite myNumber(@javax.annotation.Nullable BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + */ + @javax.annotation.Nullable + + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(@javax.annotation.Nullable BigDecimal myNumber) { + this.myNumber = myNumber; + } + + + public OuterComposite myString(@javax.annotation.Nullable String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + */ + @javax.annotation.Nullable + + public String getMyString() { + return myString; + } + + public void setMyString(@javax.annotation.Nullable String myString) { + this.myString = myString; + } + + + public OuterComposite myBoolean(@javax.annotation.Nullable Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + */ + @javax.annotation.Nullable + + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(@javax.annotation.Nullable Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OuterComposite instance itself + */ + public OuterComposite putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, outerComposite.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(myNumber); + out.writeValue(myString); + out.writeValue(myBoolean); + } + + OuterComposite(Parcel in) { + myNumber = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); + myString = (String)in.readValue(null); + myBoolean = (Boolean)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public OuterComposite createFromParcel(Parcel in) { + return new OuterComposite(in); + } + public OuterComposite[] newArray(int size) { + return new OuterComposite[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("my_number", "my_string", "my_boolean")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OuterComposite + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OuterComposite.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in OuterComposite is not found in the empty JSON string", OuterComposite.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("my_string") != null && !jsonObj.get("my_string").isJsonNull()) && !jsonObj.get("my_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `my_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("my_string").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OuterComposite.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OuterComposite' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OuterComposite.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OuterComposite value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OuterComposite read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OuterComposite instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OuterComposite given an JSON string + * + * @param jsonString JSON string + * @return An instance of OuterComposite + * @throws IOException if the JSON string is invalid with respect to OuterComposite + */ + public static OuterComposite fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OuterComposite.class); + } + + /** + * Convert an instance of OuterComposite to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/OuterEnum.java new file mode 100644 index 000000000000..f9002dca2ded --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -0,0 +1,82 @@ +/* + * 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 com.google.gson.annotations.SerializedName; +import android.os.Parcelable; +import android.os.Parcel; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets OuterEnum + */ +@JsonAdapter(OuterEnum.Adapter.class) +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OuterEnum fromValue(String value) { + for (OuterEnum b : OuterEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OuterEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OuterEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OuterEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OuterEnum.fromValue(value); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..b782d78b8ecb --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,567 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pet implements Parcelable { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private Set photoUrls = new LinkedHashSet<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull Set photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new LinkedHashSet<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public Set getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull Set photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable 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 + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, pet.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(id); + out.writeValue(category); + out.writeValue(name); + out.writeValue(photoUrls); + out.writeValue(tags); + out.writeValue(status); + } + + Pet(Parcel in) { + id = (Long)in.readValue(null); + category = (Category)in.readValue(Category.class.getClassLoader()); + name = (String)in.readValue(null); + photoUrls = (Set)in.readValue(null); + tags = (List)in.readValue(Tag.class.getClassLoader()); + status = (StatusEnum)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Pet createFromParcel(Parcel in) { + return new Pet(in); + } + public Pet[] newArray(int size) { + return new Pet[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Pet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Pet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Pet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Pet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Pet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Pet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Pet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Pet given an JSON string + * + * @param jsonString JSON string + * @return An instance of Pet + * @throws IOException if the JSON string is invalid with respect to Pet + */ + public static Pet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Pet.class); + } + + /** + * Convert an instance of Pet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..8ecee5d6f8f0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -0,0 +1,338 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReadOnlyFirst + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ReadOnlyFirst implements Parcelable { + public static final String SERIALIZED_NAME_BAR = "bar"; + @SerializedName(SERIALIZED_NAME_BAR) + @javax.annotation.Nullable + private String bar; + + public static final String SERIALIZED_NAME_BAZ = "baz"; + @SerializedName(SERIALIZED_NAME_BAZ) + @javax.annotation.Nullable + private String baz; + + public ReadOnlyFirst() { + } + + public ReadOnlyFirst( + String bar + ) { + this(); + this.bar = bar; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + + public String getBar() { + return bar; + } + + + + public ReadOnlyFirst baz(@javax.annotation.Nullable String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + */ + @javax.annotation.Nullable + + public String getBaz() { + return baz; + } + + public void setBaz(@javax.annotation.Nullable String baz) { + this.baz = baz; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ReadOnlyFirst instance itself + */ + public ReadOnlyFirst putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, readOnlyFirst.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(bar); + out.writeValue(baz); + } + + ReadOnlyFirst(Parcel in) { + bar = (String)in.readValue(null); + baz = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ReadOnlyFirst createFromParcel(Parcel in) { + return new ReadOnlyFirst(in); + } + public ReadOnlyFirst[] newArray(int size) { + return new ReadOnlyFirst[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar", "baz")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReadOnlyFirst + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReadOnlyFirst.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReadOnlyFirst is not found in the empty JSON string", ReadOnlyFirst.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonNull()) && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } + if ((jsonObj.get("baz") != null && !jsonObj.get("baz").isJsonNull()) && !jsonObj.get("baz").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `baz` to be a primitive type in the JSON string but got `%s`", jsonObj.get("baz").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReadOnlyFirst.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReadOnlyFirst' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReadOnlyFirst.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReadOnlyFirst value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ReadOnlyFirst read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReadOnlyFirst instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReadOnlyFirst given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReadOnlyFirst + * @throws IOException if the JSON string is invalid with respect to ReadOnlyFirst + */ + public static ReadOnlyFirst fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReadOnlyFirst.class); + } + + /** + * Convert an instance of ReadOnlyFirst to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java new file mode 100644 index 000000000000..ced5d6d7f35b --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -0,0 +1,304 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SpecialModelName + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class SpecialModelName implements Parcelable { + public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) + @javax.annotation.Nullable + private Long $specialPropertyName; + + public SpecialModelName() { + } + + public SpecialModelName $specialPropertyName(@javax.annotation.Nullable Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + */ + @javax.annotation.Nullable + + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + public void set$SpecialPropertyName(@javax.annotation.Nullable Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SpecialModelName instance itself + */ + public SpecialModelName putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, $specialModelName.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue($specialPropertyName); + } + + SpecialModelName(Parcel in) { + $specialPropertyName = (Long)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public SpecialModelName createFromParcel(Parcel in) { + return new SpecialModelName(in); + } + public SpecialModelName[] newArray(int size) { + return new SpecialModelName[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("$special[property.name]")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SpecialModelName + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SpecialModelName.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SpecialModelName is not found in the empty JSON string", SpecialModelName.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SpecialModelName.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SpecialModelName' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SpecialModelName.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SpecialModelName value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SpecialModelName read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SpecialModelName instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SpecialModelName given an JSON string + * + * @param jsonString JSON string + * @return An instance of SpecialModelName + * @throws IOException if the JSON string is invalid with respect to SpecialModelName + */ + public static SpecialModelName fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SpecialModelName.class); + } + + /** + * Convert an instance of SpecialModelName to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..9463d5e46ea6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,336 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Tag + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Tag implements Parcelable { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(id); + out.writeValue(name); + } + + Tag(Parcel in) { + id = (Long)in.readValue(null); + name = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Tag createFromParcel(Parcel in) { + return new Tag(in); + } + public Tag[] newArray(int size) { + return new Tag[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Tag + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Tag.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Tag' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Tag value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Tag read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Tag given an JSON string + * + * @param jsonString JSON string + * @return An instance of Tag + * @throws IOException if the JSON string is invalid with respect to Tag + */ + public static Tag fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Tag.class); + } + + /** + * Convert an instance of Tag to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java new file mode 100644 index 000000000000..128b87187565 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -0,0 +1,448 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TypeHolderDefault + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class TypeHolderDefault implements Parcelable { + public static final String SERIALIZED_NAME_STRING_ITEM = "string_item"; + @SerializedName(SERIALIZED_NAME_STRING_ITEM) + @javax.annotation.Nonnull + private String stringItem = "what"; + + public static final String SERIALIZED_NAME_NUMBER_ITEM = "number_item"; + @SerializedName(SERIALIZED_NAME_NUMBER_ITEM) + @javax.annotation.Nonnull + private BigDecimal numberItem; + + public static final String SERIALIZED_NAME_INTEGER_ITEM = "integer_item"; + @SerializedName(SERIALIZED_NAME_INTEGER_ITEM) + @javax.annotation.Nonnull + private Integer integerItem; + + public static final String SERIALIZED_NAME_BOOL_ITEM = "bool_item"; + @SerializedName(SERIALIZED_NAME_BOOL_ITEM) + @javax.annotation.Nonnull + private Boolean boolItem = true; + + public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; + @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) + @javax.annotation.Nonnull + private List arrayItem = new ArrayList<>(); + + public TypeHolderDefault() { + } + + public TypeHolderDefault stringItem(@javax.annotation.Nonnull String stringItem) { + this.stringItem = stringItem; + return this; + } + + /** + * Get stringItem + * @return stringItem + */ + @javax.annotation.Nonnull + + public String getStringItem() { + return stringItem; + } + + public void setStringItem(@javax.annotation.Nonnull String stringItem) { + this.stringItem = stringItem; + } + + + public TypeHolderDefault numberItem(@javax.annotation.Nonnull BigDecimal numberItem) { + this.numberItem = numberItem; + return this; + } + + /** + * Get numberItem + * @return numberItem + */ + @javax.annotation.Nonnull + + public BigDecimal getNumberItem() { + return numberItem; + } + + public void setNumberItem(@javax.annotation.Nonnull BigDecimal numberItem) { + this.numberItem = numberItem; + } + + + public TypeHolderDefault integerItem(@javax.annotation.Nonnull Integer integerItem) { + this.integerItem = integerItem; + return this; + } + + /** + * Get integerItem + * @return integerItem + */ + @javax.annotation.Nonnull + + public Integer getIntegerItem() { + return integerItem; + } + + public void setIntegerItem(@javax.annotation.Nonnull Integer integerItem) { + this.integerItem = integerItem; + } + + + public TypeHolderDefault boolItem(@javax.annotation.Nonnull Boolean boolItem) { + this.boolItem = boolItem; + return this; + } + + /** + * Get boolItem + * @return boolItem + */ + @javax.annotation.Nonnull + + public Boolean getBoolItem() { + return boolItem; + } + + public void setBoolItem(@javax.annotation.Nonnull Boolean boolItem) { + this.boolItem = boolItem; + } + + + public TypeHolderDefault arrayItem(@javax.annotation.Nonnull List arrayItem) { + this.arrayItem = arrayItem; + return this; + } + + public TypeHolderDefault addArrayItemItem(Integer arrayItemItem) { + if (this.arrayItem == null) { + this.arrayItem = new ArrayList<>(); + } + this.arrayItem.add(arrayItemItem); + return this; + } + + /** + * Get arrayItem + * @return arrayItem + */ + @javax.annotation.Nonnull + + public List getArrayItem() { + return arrayItem; + } + + public void setArrayItem(@javax.annotation.Nonnull List arrayItem) { + this.arrayItem = arrayItem; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TypeHolderDefault instance itself + */ + public TypeHolderDefault putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TypeHolderDefault typeHolderDefault = (TypeHolderDefault) o; + return Objects.equals(this.stringItem, typeHolderDefault.stringItem) && + Objects.equals(this.numberItem, typeHolderDefault.numberItem) && + Objects.equals(this.integerItem, typeHolderDefault.integerItem) && + Objects.equals(this.boolItem, typeHolderDefault.boolItem) && + Objects.equals(this.arrayItem, typeHolderDefault.arrayItem)&& + Objects.equals(this.additionalProperties, typeHolderDefault.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypeHolderDefault {\n"); + sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); + sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); + sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); + sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); + sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(stringItem); + out.writeValue(numberItem); + out.writeValue(integerItem); + out.writeValue(boolItem); + out.writeValue(arrayItem); + } + + TypeHolderDefault(Parcel in) { + stringItem = (String)in.readValue(null); + numberItem = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); + integerItem = (Integer)in.readValue(null); + boolItem = (Boolean)in.readValue(null); + arrayItem = (List)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public TypeHolderDefault createFromParcel(Parcel in) { + return new TypeHolderDefault(in); + } + public TypeHolderDefault[] newArray(int size) { + return new TypeHolderDefault[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("string_item", "number_item", "integer_item", "bool_item", "array_item")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("string_item", "number_item", "integer_item", "bool_item", "array_item")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TypeHolderDefault + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TypeHolderDefault.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TypeHolderDefault is not found in the empty JSON string", TypeHolderDefault.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TypeHolderDefault.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("string_item").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `string_item` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_item").toString())); + } + // ensure the required json array is present + if (jsonObj.get("array_item") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("array_item").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_item` to be an array in the JSON string but got `%s`", jsonObj.get("array_item").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TypeHolderDefault.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TypeHolderDefault' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TypeHolderDefault.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TypeHolderDefault value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TypeHolderDefault read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TypeHolderDefault instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TypeHolderDefault given an JSON string + * + * @param jsonString JSON string + * @return An instance of TypeHolderDefault + * @throws IOException if the JSON string is invalid with respect to TypeHolderDefault + */ + public static TypeHolderDefault fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TypeHolderDefault.class); + } + + /** + * Convert an instance of TypeHolderDefault to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java new file mode 100644 index 000000000000..bc6d9e994a68 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -0,0 +1,477 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TypeHolderExample + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class TypeHolderExample implements Parcelable { + public static final String SERIALIZED_NAME_STRING_ITEM = "string_item"; + @SerializedName(SERIALIZED_NAME_STRING_ITEM) + @javax.annotation.Nonnull + private String stringItem; + + public static final String SERIALIZED_NAME_NUMBER_ITEM = "number_item"; + @SerializedName(SERIALIZED_NAME_NUMBER_ITEM) + @javax.annotation.Nonnull + private BigDecimal numberItem; + + public static final String SERIALIZED_NAME_FLOAT_ITEM = "float_item"; + @SerializedName(SERIALIZED_NAME_FLOAT_ITEM) + @javax.annotation.Nonnull + private Float floatItem; + + public static final String SERIALIZED_NAME_INTEGER_ITEM = "integer_item"; + @SerializedName(SERIALIZED_NAME_INTEGER_ITEM) + @javax.annotation.Nonnull + private Integer integerItem; + + public static final String SERIALIZED_NAME_BOOL_ITEM = "bool_item"; + @SerializedName(SERIALIZED_NAME_BOOL_ITEM) + @javax.annotation.Nonnull + private Boolean boolItem; + + public static final String SERIALIZED_NAME_ARRAY_ITEM = "array_item"; + @SerializedName(SERIALIZED_NAME_ARRAY_ITEM) + @javax.annotation.Nonnull + private List arrayItem = new ArrayList<>(); + + public TypeHolderExample() { + } + + public TypeHolderExample stringItem(@javax.annotation.Nonnull String stringItem) { + this.stringItem = stringItem; + return this; + } + + /** + * Get stringItem + * @return stringItem + */ + @javax.annotation.Nonnull + + public String getStringItem() { + return stringItem; + } + + public void setStringItem(@javax.annotation.Nonnull String stringItem) { + this.stringItem = stringItem; + } + + + public TypeHolderExample numberItem(@javax.annotation.Nonnull BigDecimal numberItem) { + this.numberItem = numberItem; + return this; + } + + /** + * Get numberItem + * @return numberItem + */ + @javax.annotation.Nonnull + + public BigDecimal getNumberItem() { + return numberItem; + } + + public void setNumberItem(@javax.annotation.Nonnull BigDecimal numberItem) { + this.numberItem = numberItem; + } + + + public TypeHolderExample floatItem(@javax.annotation.Nonnull Float floatItem) { + this.floatItem = floatItem; + return this; + } + + /** + * Get floatItem + * @return floatItem + */ + @javax.annotation.Nonnull + + public Float getFloatItem() { + return floatItem; + } + + public void setFloatItem(@javax.annotation.Nonnull Float floatItem) { + this.floatItem = floatItem; + } + + + public TypeHolderExample integerItem(@javax.annotation.Nonnull Integer integerItem) { + this.integerItem = integerItem; + return this; + } + + /** + * Get integerItem + * @return integerItem + */ + @javax.annotation.Nonnull + + public Integer getIntegerItem() { + return integerItem; + } + + public void setIntegerItem(@javax.annotation.Nonnull Integer integerItem) { + this.integerItem = integerItem; + } + + + public TypeHolderExample boolItem(@javax.annotation.Nonnull Boolean boolItem) { + this.boolItem = boolItem; + return this; + } + + /** + * Get boolItem + * @return boolItem + */ + @javax.annotation.Nonnull + + public Boolean getBoolItem() { + return boolItem; + } + + public void setBoolItem(@javax.annotation.Nonnull Boolean boolItem) { + this.boolItem = boolItem; + } + + + public TypeHolderExample arrayItem(@javax.annotation.Nonnull List arrayItem) { + this.arrayItem = arrayItem; + return this; + } + + public TypeHolderExample addArrayItemItem(Integer arrayItemItem) { + if (this.arrayItem == null) { + this.arrayItem = new ArrayList<>(); + } + this.arrayItem.add(arrayItemItem); + return this; + } + + /** + * Get arrayItem + * @return arrayItem + */ + @javax.annotation.Nonnull + + public List getArrayItem() { + return arrayItem; + } + + public void setArrayItem(@javax.annotation.Nonnull List arrayItem) { + this.arrayItem = arrayItem; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TypeHolderExample instance itself + */ + public TypeHolderExample putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TypeHolderExample typeHolderExample = (TypeHolderExample) o; + return Objects.equals(this.stringItem, typeHolderExample.stringItem) && + Objects.equals(this.numberItem, typeHolderExample.numberItem) && + Objects.equals(this.floatItem, typeHolderExample.floatItem) && + Objects.equals(this.integerItem, typeHolderExample.integerItem) && + Objects.equals(this.boolItem, typeHolderExample.boolItem) && + Objects.equals(this.arrayItem, typeHolderExample.arrayItem)&& + Objects.equals(this.additionalProperties, typeHolderExample.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypeHolderExample {\n"); + sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); + sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); + sb.append(" floatItem: ").append(toIndentedString(floatItem)).append("\n"); + sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); + sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); + sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(stringItem); + out.writeValue(numberItem); + out.writeValue(floatItem); + out.writeValue(integerItem); + out.writeValue(boolItem); + out.writeValue(arrayItem); + } + + TypeHolderExample(Parcel in) { + stringItem = (String)in.readValue(null); + numberItem = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); + floatItem = (Float)in.readValue(null); + integerItem = (Integer)in.readValue(null); + boolItem = (Boolean)in.readValue(null); + arrayItem = (List)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public TypeHolderExample createFromParcel(Parcel in) { + return new TypeHolderExample(in); + } + public TypeHolderExample[] newArray(int size) { + return new TypeHolderExample[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("string_item", "number_item", "float_item", "integer_item", "bool_item", "array_item")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("string_item", "number_item", "float_item", "integer_item", "bool_item", "array_item")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TypeHolderExample + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TypeHolderExample.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TypeHolderExample is not found in the empty JSON string", TypeHolderExample.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TypeHolderExample.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("string_item").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `string_item` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_item").toString())); + } + // ensure the required json array is present + if (jsonObj.get("array_item") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("array_item").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_item` to be an array in the JSON string but got `%s`", jsonObj.get("array_item").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TypeHolderExample.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TypeHolderExample' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TypeHolderExample.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TypeHolderExample value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TypeHolderExample read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TypeHolderExample instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TypeHolderExample given an JSON string + * + * @param jsonString JSON string + * @return An instance of TypeHolderExample + * @throws IOException if the JSON string is invalid with respect to TypeHolderExample + */ + public static TypeHolderExample fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TypeHolderExample.class); + } + + /** + * Convert an instance of TypeHolderExample to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..6880182477cc --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,525 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * User + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class User implements Parcelable { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nullable + private String username; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nullable + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nullable + private String lastName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nullable + private String password; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nullable + private String phone; + + public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; + @SerializedName(SERIALIZED_NAME_USER_STATUS) + @javax.annotation.Nullable + private Integer userStatus; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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.additionalProperties, user.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(id); + out.writeValue(username); + out.writeValue(firstName); + out.writeValue(lastName); + out.writeValue(email); + out.writeValue(password); + out.writeValue(phone); + out.writeValue(userStatus); + } + + User(Parcel in) { + id = (Long)in.readValue(null); + username = (String)in.readValue(null); + firstName = (String)in.readValue(null); + lastName = (String)in.readValue(null); + email = (String)in.readValue(null); + password = (String)in.readValue(null); + phone = (String)in.readValue(null); + userStatus = (Integer)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public User createFromParcel(Parcel in) { + return new User(in); + } + public User[] newArray(int size) { + return new User[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to User + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) && !jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!User.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'User' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(User.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, User value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public User read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of User given an JSON string + * + * @param jsonString JSON string + * @return An instance of User + * @throws IOException if the JSON string is invalid with respect to User + */ + public static User fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, User.class); + } + + /** + * Convert an instance of User to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java new file mode 100644 index 000000000000..f80bdcf46ef2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java @@ -0,0 +1,1243 @@ +/* + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import android.os.Parcelable; +import android.os.Parcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * XmlItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class XmlItem implements Parcelable { + public static final String SERIALIZED_NAME_ATTRIBUTE_STRING = "attribute_string"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_STRING) + @javax.annotation.Nullable + private String attributeString; + + public static final String SERIALIZED_NAME_ATTRIBUTE_NUMBER = "attribute_number"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_NUMBER) + @javax.annotation.Nullable + private BigDecimal attributeNumber; + + public static final String SERIALIZED_NAME_ATTRIBUTE_INTEGER = "attribute_integer"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_INTEGER) + @javax.annotation.Nullable + private Integer attributeInteger; + + public static final String SERIALIZED_NAME_ATTRIBUTE_BOOLEAN = "attribute_boolean"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_BOOLEAN) + @javax.annotation.Nullable + private Boolean attributeBoolean; + + public static final String SERIALIZED_NAME_WRAPPED_ARRAY = "wrapped_array"; + @SerializedName(SERIALIZED_NAME_WRAPPED_ARRAY) + @javax.annotation.Nullable + private List wrappedArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAME_STRING = "name_string"; + @SerializedName(SERIALIZED_NAME_NAME_STRING) + @javax.annotation.Nullable + private String nameString; + + public static final String SERIALIZED_NAME_NAME_NUMBER = "name_number"; + @SerializedName(SERIALIZED_NAME_NAME_NUMBER) + @javax.annotation.Nullable + private BigDecimal nameNumber; + + public static final String SERIALIZED_NAME_NAME_INTEGER = "name_integer"; + @SerializedName(SERIALIZED_NAME_NAME_INTEGER) + @javax.annotation.Nullable + private Integer nameInteger; + + public static final String SERIALIZED_NAME_NAME_BOOLEAN = "name_boolean"; + @SerializedName(SERIALIZED_NAME_NAME_BOOLEAN) + @javax.annotation.Nullable + private Boolean nameBoolean; + + public static final String SERIALIZED_NAME_NAME_ARRAY = "name_array"; + @SerializedName(SERIALIZED_NAME_NAME_ARRAY) + @javax.annotation.Nullable + private List nameArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAME_WRAPPED_ARRAY = "name_wrapped_array"; + @SerializedName(SERIALIZED_NAME_NAME_WRAPPED_ARRAY) + @javax.annotation.Nullable + private List nameWrappedArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX_STRING = "prefix_string"; + @SerializedName(SERIALIZED_NAME_PREFIX_STRING) + @javax.annotation.Nullable + private String prefixString; + + public static final String SERIALIZED_NAME_PREFIX_NUMBER = "prefix_number"; + @SerializedName(SERIALIZED_NAME_PREFIX_NUMBER) + @javax.annotation.Nullable + private BigDecimal prefixNumber; + + public static final String SERIALIZED_NAME_PREFIX_INTEGER = "prefix_integer"; + @SerializedName(SERIALIZED_NAME_PREFIX_INTEGER) + @javax.annotation.Nullable + private Integer prefixInteger; + + public static final String SERIALIZED_NAME_PREFIX_BOOLEAN = "prefix_boolean"; + @SerializedName(SERIALIZED_NAME_PREFIX_BOOLEAN) + @javax.annotation.Nullable + private Boolean prefixBoolean; + + public static final String SERIALIZED_NAME_PREFIX_ARRAY = "prefix_array"; + @SerializedName(SERIALIZED_NAME_PREFIX_ARRAY) + @javax.annotation.Nullable + private List prefixArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX_WRAPPED_ARRAY = "prefix_wrapped_array"; + @SerializedName(SERIALIZED_NAME_PREFIX_WRAPPED_ARRAY) + @javax.annotation.Nullable + private List prefixWrappedArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAMESPACE_STRING = "namespace_string"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_STRING) + @javax.annotation.Nullable + private String namespaceString; + + public static final String SERIALIZED_NAME_NAMESPACE_NUMBER = "namespace_number"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_NUMBER) + @javax.annotation.Nullable + private BigDecimal namespaceNumber; + + public static final String SERIALIZED_NAME_NAMESPACE_INTEGER = "namespace_integer"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_INTEGER) + @javax.annotation.Nullable + private Integer namespaceInteger; + + public static final String SERIALIZED_NAME_NAMESPACE_BOOLEAN = "namespace_boolean"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_BOOLEAN) + @javax.annotation.Nullable + private Boolean namespaceBoolean; + + public static final String SERIALIZED_NAME_NAMESPACE_ARRAY = "namespace_array"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_ARRAY) + @javax.annotation.Nullable + private List namespaceArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAMESPACE_WRAPPED_ARRAY = "namespace_wrapped_array"; + @SerializedName(SERIALIZED_NAME_NAMESPACE_WRAPPED_ARRAY) + @javax.annotation.Nullable + private List namespaceWrappedArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX_NS_STRING = "prefix_ns_string"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_STRING) + @javax.annotation.Nullable + private String prefixNsString; + + public static final String SERIALIZED_NAME_PREFIX_NS_NUMBER = "prefix_ns_number"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_NUMBER) + @javax.annotation.Nullable + private BigDecimal prefixNsNumber; + + public static final String SERIALIZED_NAME_PREFIX_NS_INTEGER = "prefix_ns_integer"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_INTEGER) + @javax.annotation.Nullable + private Integer prefixNsInteger; + + public static final String SERIALIZED_NAME_PREFIX_NS_BOOLEAN = "prefix_ns_boolean"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_BOOLEAN) + @javax.annotation.Nullable + private Boolean prefixNsBoolean; + + public static final String SERIALIZED_NAME_PREFIX_NS_ARRAY = "prefix_ns_array"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_ARRAY) + @javax.annotation.Nullable + private List prefixNsArray = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX_NS_WRAPPED_ARRAY = "prefix_ns_wrapped_array"; + @SerializedName(SERIALIZED_NAME_PREFIX_NS_WRAPPED_ARRAY) + @javax.annotation.Nullable + private List prefixNsWrappedArray = new ArrayList<>(); + + public XmlItem() { + } + + public XmlItem attributeString(@javax.annotation.Nullable String attributeString) { + this.attributeString = attributeString; + return this; + } + + /** + * Get attributeString + * @return attributeString + */ + @javax.annotation.Nullable + + public String getAttributeString() { + return attributeString; + } + + public void setAttributeString(@javax.annotation.Nullable String attributeString) { + this.attributeString = attributeString; + } + + + public XmlItem attributeNumber(@javax.annotation.Nullable BigDecimal attributeNumber) { + this.attributeNumber = attributeNumber; + return this; + } + + /** + * Get attributeNumber + * @return attributeNumber + */ + @javax.annotation.Nullable + + public BigDecimal getAttributeNumber() { + return attributeNumber; + } + + public void setAttributeNumber(@javax.annotation.Nullable BigDecimal attributeNumber) { + this.attributeNumber = attributeNumber; + } + + + public XmlItem attributeInteger(@javax.annotation.Nullable Integer attributeInteger) { + this.attributeInteger = attributeInteger; + return this; + } + + /** + * Get attributeInteger + * @return attributeInteger + */ + @javax.annotation.Nullable + + public Integer getAttributeInteger() { + return attributeInteger; + } + + public void setAttributeInteger(@javax.annotation.Nullable Integer attributeInteger) { + this.attributeInteger = attributeInteger; + } + + + public XmlItem attributeBoolean(@javax.annotation.Nullable Boolean attributeBoolean) { + this.attributeBoolean = attributeBoolean; + return this; + } + + /** + * Get attributeBoolean + * @return attributeBoolean + */ + @javax.annotation.Nullable + + public Boolean getAttributeBoolean() { + return attributeBoolean; + } + + public void setAttributeBoolean(@javax.annotation.Nullable Boolean attributeBoolean) { + this.attributeBoolean = attributeBoolean; + } + + + public XmlItem wrappedArray(@javax.annotation.Nullable List wrappedArray) { + this.wrappedArray = wrappedArray; + return this; + } + + public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { + if (this.wrappedArray == null) { + this.wrappedArray = new ArrayList<>(); + } + this.wrappedArray.add(wrappedArrayItem); + return this; + } + + /** + * Get wrappedArray + * @return wrappedArray + */ + @javax.annotation.Nullable + + public List getWrappedArray() { + return wrappedArray; + } + + public void setWrappedArray(@javax.annotation.Nullable List wrappedArray) { + this.wrappedArray = wrappedArray; + } + + + public XmlItem nameString(@javax.annotation.Nullable String nameString) { + this.nameString = nameString; + return this; + } + + /** + * Get nameString + * @return nameString + */ + @javax.annotation.Nullable + + public String getNameString() { + return nameString; + } + + public void setNameString(@javax.annotation.Nullable String nameString) { + this.nameString = nameString; + } + + + public XmlItem nameNumber(@javax.annotation.Nullable BigDecimal nameNumber) { + this.nameNumber = nameNumber; + return this; + } + + /** + * Get nameNumber + * @return nameNumber + */ + @javax.annotation.Nullable + + public BigDecimal getNameNumber() { + return nameNumber; + } + + public void setNameNumber(@javax.annotation.Nullable BigDecimal nameNumber) { + this.nameNumber = nameNumber; + } + + + public XmlItem nameInteger(@javax.annotation.Nullable Integer nameInteger) { + this.nameInteger = nameInteger; + return this; + } + + /** + * Get nameInteger + * @return nameInteger + */ + @javax.annotation.Nullable + + public Integer getNameInteger() { + return nameInteger; + } + + public void setNameInteger(@javax.annotation.Nullable Integer nameInteger) { + this.nameInteger = nameInteger; + } + + + public XmlItem nameBoolean(@javax.annotation.Nullable Boolean nameBoolean) { + this.nameBoolean = nameBoolean; + return this; + } + + /** + * Get nameBoolean + * @return nameBoolean + */ + @javax.annotation.Nullable + + public Boolean getNameBoolean() { + return nameBoolean; + } + + public void setNameBoolean(@javax.annotation.Nullable Boolean nameBoolean) { + this.nameBoolean = nameBoolean; + } + + + public XmlItem nameArray(@javax.annotation.Nullable List nameArray) { + this.nameArray = nameArray; + return this; + } + + public XmlItem addNameArrayItem(Integer nameArrayItem) { + if (this.nameArray == null) { + this.nameArray = new ArrayList<>(); + } + this.nameArray.add(nameArrayItem); + return this; + } + + /** + * Get nameArray + * @return nameArray + */ + @javax.annotation.Nullable + + public List getNameArray() { + return nameArray; + } + + public void setNameArray(@javax.annotation.Nullable List nameArray) { + this.nameArray = nameArray; + } + + + public XmlItem nameWrappedArray(@javax.annotation.Nullable List nameWrappedArray) { + this.nameWrappedArray = nameWrappedArray; + return this; + } + + public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { + if (this.nameWrappedArray == null) { + this.nameWrappedArray = new ArrayList<>(); + } + this.nameWrappedArray.add(nameWrappedArrayItem); + return this; + } + + /** + * Get nameWrappedArray + * @return nameWrappedArray + */ + @javax.annotation.Nullable + + public List getNameWrappedArray() { + return nameWrappedArray; + } + + public void setNameWrappedArray(@javax.annotation.Nullable List nameWrappedArray) { + this.nameWrappedArray = nameWrappedArray; + } + + + public XmlItem prefixString(@javax.annotation.Nullable String prefixString) { + this.prefixString = prefixString; + return this; + } + + /** + * Get prefixString + * @return prefixString + */ + @javax.annotation.Nullable + + public String getPrefixString() { + return prefixString; + } + + public void setPrefixString(@javax.annotation.Nullable String prefixString) { + this.prefixString = prefixString; + } + + + public XmlItem prefixNumber(@javax.annotation.Nullable BigDecimal prefixNumber) { + this.prefixNumber = prefixNumber; + return this; + } + + /** + * Get prefixNumber + * @return prefixNumber + */ + @javax.annotation.Nullable + + public BigDecimal getPrefixNumber() { + return prefixNumber; + } + + public void setPrefixNumber(@javax.annotation.Nullable BigDecimal prefixNumber) { + this.prefixNumber = prefixNumber; + } + + + public XmlItem prefixInteger(@javax.annotation.Nullable Integer prefixInteger) { + this.prefixInteger = prefixInteger; + return this; + } + + /** + * Get prefixInteger + * @return prefixInteger + */ + @javax.annotation.Nullable + + public Integer getPrefixInteger() { + return prefixInteger; + } + + public void setPrefixInteger(@javax.annotation.Nullable Integer prefixInteger) { + this.prefixInteger = prefixInteger; + } + + + public XmlItem prefixBoolean(@javax.annotation.Nullable Boolean prefixBoolean) { + this.prefixBoolean = prefixBoolean; + return this; + } + + /** + * Get prefixBoolean + * @return prefixBoolean + */ + @javax.annotation.Nullable + + public Boolean getPrefixBoolean() { + return prefixBoolean; + } + + public void setPrefixBoolean(@javax.annotation.Nullable Boolean prefixBoolean) { + this.prefixBoolean = prefixBoolean; + } + + + public XmlItem prefixArray(@javax.annotation.Nullable List prefixArray) { + this.prefixArray = prefixArray; + return this; + } + + public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { + if (this.prefixArray == null) { + this.prefixArray = new ArrayList<>(); + } + this.prefixArray.add(prefixArrayItem); + return this; + } + + /** + * Get prefixArray + * @return prefixArray + */ + @javax.annotation.Nullable + + public List getPrefixArray() { + return prefixArray; + } + + public void setPrefixArray(@javax.annotation.Nullable List prefixArray) { + this.prefixArray = prefixArray; + } + + + public XmlItem prefixWrappedArray(@javax.annotation.Nullable List prefixWrappedArray) { + this.prefixWrappedArray = prefixWrappedArray; + return this; + } + + public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { + if (this.prefixWrappedArray == null) { + this.prefixWrappedArray = new ArrayList<>(); + } + this.prefixWrappedArray.add(prefixWrappedArrayItem); + return this; + } + + /** + * Get prefixWrappedArray + * @return prefixWrappedArray + */ + @javax.annotation.Nullable + + public List getPrefixWrappedArray() { + return prefixWrappedArray; + } + + public void setPrefixWrappedArray(@javax.annotation.Nullable List prefixWrappedArray) { + this.prefixWrappedArray = prefixWrappedArray; + } + + + public XmlItem namespaceString(@javax.annotation.Nullable String namespaceString) { + this.namespaceString = namespaceString; + return this; + } + + /** + * Get namespaceString + * @return namespaceString + */ + @javax.annotation.Nullable + + public String getNamespaceString() { + return namespaceString; + } + + public void setNamespaceString(@javax.annotation.Nullable String namespaceString) { + this.namespaceString = namespaceString; + } + + + public XmlItem namespaceNumber(@javax.annotation.Nullable BigDecimal namespaceNumber) { + this.namespaceNumber = namespaceNumber; + return this; + } + + /** + * Get namespaceNumber + * @return namespaceNumber + */ + @javax.annotation.Nullable + + public BigDecimal getNamespaceNumber() { + return namespaceNumber; + } + + public void setNamespaceNumber(@javax.annotation.Nullable BigDecimal namespaceNumber) { + this.namespaceNumber = namespaceNumber; + } + + + public XmlItem namespaceInteger(@javax.annotation.Nullable Integer namespaceInteger) { + this.namespaceInteger = namespaceInteger; + return this; + } + + /** + * Get namespaceInteger + * @return namespaceInteger + */ + @javax.annotation.Nullable + + public Integer getNamespaceInteger() { + return namespaceInteger; + } + + public void setNamespaceInteger(@javax.annotation.Nullable Integer namespaceInteger) { + this.namespaceInteger = namespaceInteger; + } + + + public XmlItem namespaceBoolean(@javax.annotation.Nullable Boolean namespaceBoolean) { + this.namespaceBoolean = namespaceBoolean; + return this; + } + + /** + * Get namespaceBoolean + * @return namespaceBoolean + */ + @javax.annotation.Nullable + + public Boolean getNamespaceBoolean() { + return namespaceBoolean; + } + + public void setNamespaceBoolean(@javax.annotation.Nullable Boolean namespaceBoolean) { + this.namespaceBoolean = namespaceBoolean; + } + + + public XmlItem namespaceArray(@javax.annotation.Nullable List namespaceArray) { + this.namespaceArray = namespaceArray; + return this; + } + + public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { + if (this.namespaceArray == null) { + this.namespaceArray = new ArrayList<>(); + } + this.namespaceArray.add(namespaceArrayItem); + return this; + } + + /** + * Get namespaceArray + * @return namespaceArray + */ + @javax.annotation.Nullable + + public List getNamespaceArray() { + return namespaceArray; + } + + public void setNamespaceArray(@javax.annotation.Nullable List namespaceArray) { + this.namespaceArray = namespaceArray; + } + + + public XmlItem namespaceWrappedArray(@javax.annotation.Nullable List namespaceWrappedArray) { + this.namespaceWrappedArray = namespaceWrappedArray; + return this; + } + + public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { + if (this.namespaceWrappedArray == null) { + this.namespaceWrappedArray = new ArrayList<>(); + } + this.namespaceWrappedArray.add(namespaceWrappedArrayItem); + return this; + } + + /** + * Get namespaceWrappedArray + * @return namespaceWrappedArray + */ + @javax.annotation.Nullable + + public List getNamespaceWrappedArray() { + return namespaceWrappedArray; + } + + public void setNamespaceWrappedArray(@javax.annotation.Nullable List namespaceWrappedArray) { + this.namespaceWrappedArray = namespaceWrappedArray; + } + + + public XmlItem prefixNsString(@javax.annotation.Nullable String prefixNsString) { + this.prefixNsString = prefixNsString; + return this; + } + + /** + * Get prefixNsString + * @return prefixNsString + */ + @javax.annotation.Nullable + + public String getPrefixNsString() { + return prefixNsString; + } + + public void setPrefixNsString(@javax.annotation.Nullable String prefixNsString) { + this.prefixNsString = prefixNsString; + } + + + public XmlItem prefixNsNumber(@javax.annotation.Nullable BigDecimal prefixNsNumber) { + this.prefixNsNumber = prefixNsNumber; + return this; + } + + /** + * Get prefixNsNumber + * @return prefixNsNumber + */ + @javax.annotation.Nullable + + public BigDecimal getPrefixNsNumber() { + return prefixNsNumber; + } + + public void setPrefixNsNumber(@javax.annotation.Nullable BigDecimal prefixNsNumber) { + this.prefixNsNumber = prefixNsNumber; + } + + + public XmlItem prefixNsInteger(@javax.annotation.Nullable Integer prefixNsInteger) { + this.prefixNsInteger = prefixNsInteger; + return this; + } + + /** + * Get prefixNsInteger + * @return prefixNsInteger + */ + @javax.annotation.Nullable + + public Integer getPrefixNsInteger() { + return prefixNsInteger; + } + + public void setPrefixNsInteger(@javax.annotation.Nullable Integer prefixNsInteger) { + this.prefixNsInteger = prefixNsInteger; + } + + + public XmlItem prefixNsBoolean(@javax.annotation.Nullable Boolean prefixNsBoolean) { + this.prefixNsBoolean = prefixNsBoolean; + return this; + } + + /** + * Get prefixNsBoolean + * @return prefixNsBoolean + */ + @javax.annotation.Nullable + + public Boolean getPrefixNsBoolean() { + return prefixNsBoolean; + } + + public void setPrefixNsBoolean(@javax.annotation.Nullable Boolean prefixNsBoolean) { + this.prefixNsBoolean = prefixNsBoolean; + } + + + public XmlItem prefixNsArray(@javax.annotation.Nullable List prefixNsArray) { + this.prefixNsArray = prefixNsArray; + return this; + } + + public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { + if (this.prefixNsArray == null) { + this.prefixNsArray = new ArrayList<>(); + } + this.prefixNsArray.add(prefixNsArrayItem); + return this; + } + + /** + * Get prefixNsArray + * @return prefixNsArray + */ + @javax.annotation.Nullable + + public List getPrefixNsArray() { + return prefixNsArray; + } + + public void setPrefixNsArray(@javax.annotation.Nullable List prefixNsArray) { + this.prefixNsArray = prefixNsArray; + } + + + public XmlItem prefixNsWrappedArray(@javax.annotation.Nullable List prefixNsWrappedArray) { + this.prefixNsWrappedArray = prefixNsWrappedArray; + return this; + } + + public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { + if (this.prefixNsWrappedArray == null) { + this.prefixNsWrappedArray = new ArrayList<>(); + } + this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); + return this; + } + + /** + * Get prefixNsWrappedArray + * @return prefixNsWrappedArray + */ + @javax.annotation.Nullable + + public List getPrefixNsWrappedArray() { + return prefixNsWrappedArray; + } + + public void setPrefixNsWrappedArray(@javax.annotation.Nullable List prefixNsWrappedArray) { + this.prefixNsWrappedArray = prefixNsWrappedArray; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the XmlItem instance itself + */ + public XmlItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + XmlItem xmlItem = (XmlItem) o; + return Objects.equals(this.attributeString, xmlItem.attributeString) && + Objects.equals(this.attributeNumber, xmlItem.attributeNumber) && + Objects.equals(this.attributeInteger, xmlItem.attributeInteger) && + Objects.equals(this.attributeBoolean, xmlItem.attributeBoolean) && + Objects.equals(this.wrappedArray, xmlItem.wrappedArray) && + Objects.equals(this.nameString, xmlItem.nameString) && + Objects.equals(this.nameNumber, xmlItem.nameNumber) && + Objects.equals(this.nameInteger, xmlItem.nameInteger) && + Objects.equals(this.nameBoolean, xmlItem.nameBoolean) && + Objects.equals(this.nameArray, xmlItem.nameArray) && + Objects.equals(this.nameWrappedArray, xmlItem.nameWrappedArray) && + Objects.equals(this.prefixString, xmlItem.prefixString) && + Objects.equals(this.prefixNumber, xmlItem.prefixNumber) && + Objects.equals(this.prefixInteger, xmlItem.prefixInteger) && + Objects.equals(this.prefixBoolean, xmlItem.prefixBoolean) && + Objects.equals(this.prefixArray, xmlItem.prefixArray) && + Objects.equals(this.prefixWrappedArray, xmlItem.prefixWrappedArray) && + Objects.equals(this.namespaceString, xmlItem.namespaceString) && + Objects.equals(this.namespaceNumber, xmlItem.namespaceNumber) && + Objects.equals(this.namespaceInteger, xmlItem.namespaceInteger) && + Objects.equals(this.namespaceBoolean, xmlItem.namespaceBoolean) && + Objects.equals(this.namespaceArray, xmlItem.namespaceArray) && + Objects.equals(this.namespaceWrappedArray, xmlItem.namespaceWrappedArray) && + Objects.equals(this.prefixNsString, xmlItem.prefixNsString) && + Objects.equals(this.prefixNsNumber, xmlItem.prefixNsNumber) && + Objects.equals(this.prefixNsInteger, xmlItem.prefixNsInteger) && + Objects.equals(this.prefixNsBoolean, xmlItem.prefixNsBoolean) && + Objects.equals(this.prefixNsArray, xmlItem.prefixNsArray) && + Objects.equals(this.prefixNsWrappedArray, xmlItem.prefixNsWrappedArray)&& + Objects.equals(this.additionalProperties, xmlItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class XmlItem {\n"); + sb.append(" attributeString: ").append(toIndentedString(attributeString)).append("\n"); + sb.append(" attributeNumber: ").append(toIndentedString(attributeNumber)).append("\n"); + sb.append(" attributeInteger: ").append(toIndentedString(attributeInteger)).append("\n"); + sb.append(" attributeBoolean: ").append(toIndentedString(attributeBoolean)).append("\n"); + sb.append(" wrappedArray: ").append(toIndentedString(wrappedArray)).append("\n"); + sb.append(" nameString: ").append(toIndentedString(nameString)).append("\n"); + sb.append(" nameNumber: ").append(toIndentedString(nameNumber)).append("\n"); + sb.append(" nameInteger: ").append(toIndentedString(nameInteger)).append("\n"); + sb.append(" nameBoolean: ").append(toIndentedString(nameBoolean)).append("\n"); + sb.append(" nameArray: ").append(toIndentedString(nameArray)).append("\n"); + sb.append(" nameWrappedArray: ").append(toIndentedString(nameWrappedArray)).append("\n"); + sb.append(" prefixString: ").append(toIndentedString(prefixString)).append("\n"); + sb.append(" prefixNumber: ").append(toIndentedString(prefixNumber)).append("\n"); + sb.append(" prefixInteger: ").append(toIndentedString(prefixInteger)).append("\n"); + sb.append(" prefixBoolean: ").append(toIndentedString(prefixBoolean)).append("\n"); + sb.append(" prefixArray: ").append(toIndentedString(prefixArray)).append("\n"); + sb.append(" prefixWrappedArray: ").append(toIndentedString(prefixWrappedArray)).append("\n"); + sb.append(" namespaceString: ").append(toIndentedString(namespaceString)).append("\n"); + sb.append(" namespaceNumber: ").append(toIndentedString(namespaceNumber)).append("\n"); + sb.append(" namespaceInteger: ").append(toIndentedString(namespaceInteger)).append("\n"); + sb.append(" namespaceBoolean: ").append(toIndentedString(namespaceBoolean)).append("\n"); + sb.append(" namespaceArray: ").append(toIndentedString(namespaceArray)).append("\n"); + sb.append(" namespaceWrappedArray: ").append(toIndentedString(namespaceWrappedArray)).append("\n"); + sb.append(" prefixNsString: ").append(toIndentedString(prefixNsString)).append("\n"); + sb.append(" prefixNsNumber: ").append(toIndentedString(prefixNsNumber)).append("\n"); + sb.append(" prefixNsInteger: ").append(toIndentedString(prefixNsInteger)).append("\n"); + sb.append(" prefixNsBoolean: ").append(toIndentedString(prefixNsBoolean)).append("\n"); + sb.append(" prefixNsArray: ").append(toIndentedString(prefixNsArray)).append("\n"); + sb.append(" prefixNsWrappedArray: ").append(toIndentedString(prefixNsWrappedArray)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(attributeString); + out.writeValue(attributeNumber); + out.writeValue(attributeInteger); + out.writeValue(attributeBoolean); + out.writeValue(wrappedArray); + out.writeValue(nameString); + out.writeValue(nameNumber); + out.writeValue(nameInteger); + out.writeValue(nameBoolean); + out.writeValue(nameArray); + out.writeValue(nameWrappedArray); + out.writeValue(prefixString); + out.writeValue(prefixNumber); + out.writeValue(prefixInteger); + out.writeValue(prefixBoolean); + out.writeValue(prefixArray); + out.writeValue(prefixWrappedArray); + out.writeValue(namespaceString); + out.writeValue(namespaceNumber); + out.writeValue(namespaceInteger); + out.writeValue(namespaceBoolean); + out.writeValue(namespaceArray); + out.writeValue(namespaceWrappedArray); + out.writeValue(prefixNsString); + out.writeValue(prefixNsNumber); + out.writeValue(prefixNsInteger); + out.writeValue(prefixNsBoolean); + out.writeValue(prefixNsArray); + out.writeValue(prefixNsWrappedArray); + } + + XmlItem(Parcel in) { + attributeString = (String)in.readValue(null); + attributeNumber = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); + attributeInteger = (Integer)in.readValue(null); + attributeBoolean = (Boolean)in.readValue(null); + wrappedArray = (List)in.readValue(null); + nameString = (String)in.readValue(null); + nameNumber = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); + nameInteger = (Integer)in.readValue(null); + nameBoolean = (Boolean)in.readValue(null); + nameArray = (List)in.readValue(null); + nameWrappedArray = (List)in.readValue(null); + prefixString = (String)in.readValue(null); + prefixNumber = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); + prefixInteger = (Integer)in.readValue(null); + prefixBoolean = (Boolean)in.readValue(null); + prefixArray = (List)in.readValue(null); + prefixWrappedArray = (List)in.readValue(null); + namespaceString = (String)in.readValue(null); + namespaceNumber = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); + namespaceInteger = (Integer)in.readValue(null); + namespaceBoolean = (Boolean)in.readValue(null); + namespaceArray = (List)in.readValue(null); + namespaceWrappedArray = (List)in.readValue(null); + prefixNsString = (String)in.readValue(null); + prefixNsNumber = (BigDecimal)in.readValue(BigDecimal.class.getClassLoader()); + prefixNsInteger = (Integer)in.readValue(null); + prefixNsBoolean = (Boolean)in.readValue(null); + prefixNsArray = (List)in.readValue(null); + prefixNsWrappedArray = (List)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public XmlItem createFromParcel(Parcel in) { + return new XmlItem(in); + } + public XmlItem[] newArray(int size) { + return new XmlItem[size]; + } + }; + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("attribute_string", "attribute_number", "attribute_integer", "attribute_boolean", "wrapped_array", "name_string", "name_number", "name_integer", "name_boolean", "name_array", "name_wrapped_array", "prefix_string", "prefix_number", "prefix_integer", "prefix_boolean", "prefix_array", "prefix_wrapped_array", "namespace_string", "namespace_number", "namespace_integer", "namespace_boolean", "namespace_array", "namespace_wrapped_array", "prefix_ns_string", "prefix_ns_number", "prefix_ns_integer", "prefix_ns_boolean", "prefix_ns_array", "prefix_ns_wrapped_array")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to XmlItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!XmlItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in XmlItem is not found in the empty JSON string", XmlItem.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("attribute_string") != null && !jsonObj.get("attribute_string").isJsonNull()) && !jsonObj.get("attribute_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `attribute_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("attribute_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("wrapped_array") != null && !jsonObj.get("wrapped_array").isJsonNull() && !jsonObj.get("wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("wrapped_array").toString())); + } + if ((jsonObj.get("name_string") != null && !jsonObj.get("name_string").isJsonNull()) && !jsonObj.get("name_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("name_array") != null && !jsonObj.get("name_array").isJsonNull() && !jsonObj.get("name_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name_array` to be an array in the JSON string but got `%s`", jsonObj.get("name_array").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("name_wrapped_array") != null && !jsonObj.get("name_wrapped_array").isJsonNull() && !jsonObj.get("name_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("name_wrapped_array").toString())); + } + if ((jsonObj.get("prefix_string") != null && !jsonObj.get("prefix_string").isJsonNull()) && !jsonObj.get("prefix_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `prefix_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prefix_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("prefix_array") != null && !jsonObj.get("prefix_array").isJsonNull() && !jsonObj.get("prefix_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `prefix_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_array").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("prefix_wrapped_array") != null && !jsonObj.get("prefix_wrapped_array").isJsonNull() && !jsonObj.get("prefix_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `prefix_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_wrapped_array").toString())); + } + if ((jsonObj.get("namespace_string") != null && !jsonObj.get("namespace_string").isJsonNull()) && !jsonObj.get("namespace_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("namespace_array") != null && !jsonObj.get("namespace_array").isJsonNull() && !jsonObj.get("namespace_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace_array` to be an array in the JSON string but got `%s`", jsonObj.get("namespace_array").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("namespace_wrapped_array") != null && !jsonObj.get("namespace_wrapped_array").isJsonNull() && !jsonObj.get("namespace_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("namespace_wrapped_array").toString())); + } + if ((jsonObj.get("prefix_ns_string") != null && !jsonObj.get("prefix_ns_string").isJsonNull()) && !jsonObj.get("prefix_ns_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `prefix_ns_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prefix_ns_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("prefix_ns_array") != null && !jsonObj.get("prefix_ns_array").isJsonNull() && !jsonObj.get("prefix_ns_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `prefix_ns_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_ns_array").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("prefix_ns_wrapped_array") != null && !jsonObj.get("prefix_ns_wrapped_array").isJsonNull() && !jsonObj.get("prefix_ns_wrapped_array").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `prefix_ns_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_ns_wrapped_array").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!XmlItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'XmlItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(XmlItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, XmlItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public XmlItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + XmlItem instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of XmlItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of XmlItem + * @throws IOException if the JSON string is invalid with respect to XmlItem + */ + public static XmlItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, XmlItem.class); + } + + /** + * Convert an instance of XmlItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java new file mode 100644 index 000000000000..759193160447 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -0,0 +1,50 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Client; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AnotherFakeApi + */ +@Disabled +public class AnotherFakeApiTest { + + private final AnotherFakeApi api = new AnotherFakeApi(); + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + * + * @throws ApiException if the Api call fails + */ + @Test + public void call123testSpecialTagsTest() throws ApiException { + UUID uuidTest = null; + Client body = null; + Client response = api.call123testSpecialTags(uuidTest, body); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 000000000000..c5064962312c --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,253 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.User; +import org.openapitools.client.model.XmlItem; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +@Disabled +public class FakeApiTest { + + private final FakeApi api = new FakeApi(); + + /** + * creates an XmlItem + * + * this route creates an XmlItem + * + * @throws ApiException if the Api call fails + */ + @Test + public void createXmlItemTest() throws ApiException { + XmlItem xmlItem = null; + api.createXmlItem(xmlItem); + // TODO: test validations + } + + /** + * Test serialization of outer boolean types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterBooleanSerializeTest() throws ApiException { + Boolean body = null; + Boolean response = api.fakeOuterBooleanSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of object with outer number type + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterCompositeSerializeTest() throws ApiException { + OuterComposite body = null; + OuterComposite response = api.fakeOuterCompositeSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of outer number types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterNumberSerializeTest() throws ApiException { + BigDecimal body = null; + BigDecimal response = api.fakeOuterNumberSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of outer string types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterStringSerializeTest() throws ApiException { + String body = null; + String response = api.fakeOuterStringSerialize(body); + // TODO: test validations + } + + /** + * For this test, the body for this request much reference a schema named `File`. + * + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithFileSchemaTest() throws ApiException { + FileSchemaTestClass body = null; + api.testBodyWithFileSchema(body); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithQueryParamsTest() throws ApiException { + String query = null; + User body = null; + api.testBodyWithQueryParams(query, body); + // TODO: test validations + } + + /** + * To test \"client\" model + * + * To test \"client\" model + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClientModelTest() throws ApiException { + Client body = null; + Client response = api.testClientModel(body); + // TODO: test validations + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEndpointParametersTest() throws ApiException { + BigDecimal number = null; + Double _double = null; + String patternWithoutDelimiter = null; + byte[] _byte = null; + Integer integer = null; + Integer int32 = null; + Long int64 = null; + Float _float = null; + String string = null; + File binary = null; + LocalDate date = null; + OffsetDateTime dateTime = null; + String password = null; + String paramCallback = null; + api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + // TODO: test validations + } + + /** + * To test enum parameters + * + * To test enum parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEnumParametersTest() throws ApiException { + List enumHeaderStringArray = null; + String enumHeaderString = null; + List enumQueryStringArray = null; + String enumQueryString = null; + Integer enumQueryInteger = null; + Double enumQueryDouble = null; + List enumFormStringArray = null; + String enumFormString = null; + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + // TODO: test validations + } + + /** + * Fake endpoint to test group parameters (optional) + * + * Fake endpoint to test group parameters (optional) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testGroupParametersTest() throws ApiException { + Integer requiredStringGroup = null; + Boolean requiredBooleanGroup = null; + Long requiredInt64Group = null; + Integer stringGroup = null; + Boolean booleanGroup = null; + Long int64Group = null; + api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + // TODO: test validations + } + + /** + * test inline additionalProperties + * + * @throws ApiException if the Api call fails + */ + @Test + public void testInlineAdditionalPropertiesTest() throws ApiException { + Map param = null; + api.testInlineAdditionalProperties(param); + // TODO: test validations + } + + /** + * test json serialization of form data + * + * @throws ApiException if the Api call fails + */ + @Test + public void testJsonFormDataTest() throws ApiException { + String param = null; + String param2 = null; + api.testJsonFormData(param, param2); + // TODO: test validations + } + + /** + * To test the collection format in query parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryParameterCollectionFormatTest() throws ApiException { + List pipe = null; + List ioutil = null; + List http = null; + List url = null; + List context = null; + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 000000000000..4899dbeac98c --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Client; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Disabled +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + /** + * To test class name in snake case + * + * To test class name in snake case + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + Client body = null; + Client response = api.testClassname(body); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..9c54e3b6ce2f --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,158 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import java.util.Set; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + /** + * Add a new pet to the store + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet body = null; + api.addPet(body); + // TODO: test validations + } + + /** + * Deletes a pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + Set tags = null; + Set response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Update an existing pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet body = null; + api.updatePet(body); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.uploadFile(petId, additionalMetadata, _file); + // TODO: test validations + } + + /** + * uploads an image (required) + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileWithRequiredFileTest() throws ApiException { + Long petId = null; + File requiredFile = null; + String additionalMetadata = null; + ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..b6d81a6c5800 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,87 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = api.getOrderById(orderId); + // TODO: test validations + } + + /** + * Place an order for a pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order body = null; + Order response = api.placeOrder(body); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..cb958423ece1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,138 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User body = null; + api.createUser(body); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List body = null; + api.createUsersWithArrayInput(body); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List body = null; + api.createUsersWithListInput(body); + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + api.deleteUser(username); + // TODO: test validations + } + + /** + * Get user by user name + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * @throws ApiException if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + api.logoutUser(); + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User body = null; + api.updateUser(username, body); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java new file mode 100644 index 000000000000..37643c848b07 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesAnyType + */ +public class AdditionalPropertiesAnyTypeTest { + private final AdditionalPropertiesAnyType model = new AdditionalPropertiesAnyType(); + + /** + * Model tests for AdditionalPropertiesAnyType + */ + @Test + public void testAdditionalPropertiesAnyType() { + // TODO: test AdditionalPropertiesAnyType + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java new file mode 100644 index 000000000000..4c54188964c0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesArray + */ +public class AdditionalPropertiesArrayTest { + private final AdditionalPropertiesArray model = new AdditionalPropertiesArray(); + + /** + * Model tests for AdditionalPropertiesArray + */ + @Test + public void testAdditionalPropertiesArray() { + // TODO: test AdditionalPropertiesArray + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java new file mode 100644 index 000000000000..2c801222f957 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesBoolean + */ +public class AdditionalPropertiesBooleanTest { + private final AdditionalPropertiesBoolean model = new AdditionalPropertiesBoolean(); + + /** + * Model tests for AdditionalPropertiesBoolean + */ + @Test + public void testAdditionalPropertiesBoolean() { + // TODO: test AdditionalPropertiesBoolean + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..c9f259343b94 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesClass + */ +public class AdditionalPropertiesClassTest { + private final AdditionalPropertiesClass model = new AdditionalPropertiesClass(); + + /** + * Model tests for AdditionalPropertiesClass + */ + @Test + public void testAdditionalPropertiesClass() { + // TODO: test AdditionalPropertiesClass + } + + /** + * Test the property 'mapString' + */ + @Test + public void mapStringTest() { + // TODO: test mapString + } + + /** + * Test the property 'mapNumber' + */ + @Test + public void mapNumberTest() { + // TODO: test mapNumber + } + + /** + * Test the property 'mapInteger' + */ + @Test + public void mapIntegerTest() { + // TODO: test mapInteger + } + + /** + * Test the property 'mapBoolean' + */ + @Test + public void mapBooleanTest() { + // TODO: test mapBoolean + } + + /** + * Test the property 'mapArrayInteger' + */ + @Test + public void mapArrayIntegerTest() { + // TODO: test mapArrayInteger + } + + /** + * Test the property 'mapArrayAnytype' + */ + @Test + public void mapArrayAnytypeTest() { + // TODO: test mapArrayAnytype + } + + /** + * Test the property 'mapMapString' + */ + @Test + public void mapMapStringTest() { + // TODO: test mapMapString + } + + /** + * Test the property 'mapMapAnytype' + */ + @Test + public void mapMapAnytypeTest() { + // TODO: test mapMapAnytype + } + + /** + * Test the property 'anytype1' + */ + @Test + public void anytype1Test() { + // TODO: test anytype1 + } + + /** + * Test the property 'anytype2' + */ + @Test + public void anytype2Test() { + // TODO: test anytype2 + } + + /** + * Test the property 'anytype3' + */ + @Test + public void anytype3Test() { + // TODO: test anytype3 + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java new file mode 100644 index 000000000000..5b96188630d2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesInteger + */ +public class AdditionalPropertiesIntegerTest { + private final AdditionalPropertiesInteger model = new AdditionalPropertiesInteger(); + + /** + * Model tests for AdditionalPropertiesInteger + */ + @Test + public void testAdditionalPropertiesInteger() { + // TODO: test AdditionalPropertiesInteger + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java new file mode 100644 index 000000000000..e098c76dd09f --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesNumber + */ +public class AdditionalPropertiesNumberTest { + private final AdditionalPropertiesNumber model = new AdditionalPropertiesNumber(); + + /** + * Model tests for AdditionalPropertiesNumber + */ + @Test + public void testAdditionalPropertiesNumber() { + // TODO: test AdditionalPropertiesNumber + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java new file mode 100644 index 000000000000..9c0f4e265f72 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesObject + */ +public class AdditionalPropertiesObjectTest { + private final AdditionalPropertiesObject model = new AdditionalPropertiesObject(); + + /** + * Model tests for AdditionalPropertiesObject + */ + @Test + public void testAdditionalPropertiesObject() { + // TODO: test AdditionalPropertiesObject + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java new file mode 100644 index 000000000000..187096f7462a --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesString + */ +public class AdditionalPropertiesStringTest { + private final AdditionalPropertiesString model = new AdditionalPropertiesString(); + + /** + * Model tests for AdditionalPropertiesString + */ + @Test + public void testAdditionalPropertiesString() { + // TODO: test AdditionalPropertiesString + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AnimalTest.java new file mode 100644 index 000000000000..1fc472f0fafd --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Animal + */ +public class AnimalTest { + private final Animal model = new Animal(); + + /** + * Model tests for Animal + */ + @Test + public void testAnimal() { + // TODO: test Animal + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..618a21c8a982 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfArrayOfNumberOnly + */ +public class ArrayOfArrayOfNumberOnlyTest { + private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfArrayOfNumberOnly + */ + @Test + public void testArrayOfArrayOfNumberOnly() { + // TODO: test ArrayOfArrayOfNumberOnly + } + + /** + * Test the property 'arrayArrayNumber' + */ + @Test + public void arrayArrayNumberTest() { + // TODO: test arrayArrayNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..7121b15da89f --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfNumberOnly + */ +public class ArrayOfNumberOnlyTest { + private final ArrayOfNumberOnly model = new ArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfNumberOnly + */ + @Test + public void testArrayOfNumberOnly() { + // TODO: test ArrayOfNumberOnly + } + + /** + * Test the property 'arrayNumber' + */ + @Test + public void arrayNumberTest() { + // TODO: test arrayNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ArrayTestTest.java new file mode 100644 index 000000000000..da72462ec73d --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ArrayTestTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayTest + */ +public class ArrayTestTest { + private final ArrayTest model = new ArrayTest(); + + /** + * Model tests for ArrayTest + */ + @Test + public void testArrayTest() { + // TODO: test ArrayTest + } + + /** + * Test the property 'arrayOfString' + */ + @Test + public void arrayOfStringTest() { + // TODO: test arrayOfString + } + + /** + * Test the property 'arrayArrayOfInteger' + */ + @Test + public void arrayArrayOfIntegerTest() { + // TODO: test arrayArrayOfInteger + } + + /** + * Test the property 'arrayArrayOfModel' + */ + @Test + public void arrayArrayOfModelTest() { + // TODO: test arrayArrayOfModel + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 000000000000..e2f41cc959c9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Cat; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/CapitalizationTest.java new file mode 100644 index 000000000000..8179ed092cc0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/CapitalizationTest.java @@ -0,0 +1,87 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Capitalization + */ +public class CapitalizationTest { + private final Capitalization model = new Capitalization(); + + /** + * Model tests for Capitalization + */ + @Test + public void testCapitalization() { + // TODO: test Capitalization + } + + /** + * Test the property 'smallCamel' + */ + @Test + public void smallCamelTest() { + // TODO: test smallCamel + } + + /** + * Test the property 'capitalCamel' + */ + @Test + public void capitalCamelTest() { + // TODO: test capitalCamel + } + + /** + * Test the property 'smallSnake' + */ + @Test + public void smallSnakeTest() { + // TODO: test smallSnake + } + + /** + * Test the property 'capitalSnake' + */ + @Test + public void capitalSnakeTest() { + // TODO: test capitalSnake + } + + /** + * Test the property 'scAETHFlowPoints' + */ + @Test + public void scAETHFlowPointsTest() { + // TODO: test scAETHFlowPoints + } + + /** + * Test the property 'ATT_NAME' + */ + @Test + public void ATT_NAMETest() { + // TODO: test ATT_NAME + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/CatTest.java new file mode 100644 index 000000000000..a74c3076a0b5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/CatTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Cat + */ +public class CatTest { + private final Cat model = new Cat(); + + /** + * Model tests for Cat + */ + @Test + public void testCat() { + // TODO: test Cat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..6fc9054dd7f8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ClassModelTest.java new file mode 100644 index 000000000000..23f382c5cbc5 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ClassModelTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ClassModel + */ +public class ClassModelTest { + private final ClassModel model = new ClassModel(); + + /** + * Model tests for ClassModel + */ + @Test + public void testClassModel() { + // TODO: test ClassModel + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ClientTest.java new file mode 100644 index 000000000000..35cf8622cdf9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ClientTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Client + */ +public class ClientTest { + private final Client model = new Client(); + + /** + * Model tests for Client + */ + @Test + public void testClient() { + // TODO: test Client + } + + /** + * Test the property 'client' + */ + @Test + public void clientTest() { + // TODO: test client + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/DogTest.java new file mode 100644 index 000000000000..7a98584acd36 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/DogTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Dog + */ +public class DogTest { + private final Dog model = new Dog(); + + /** + * Model tests for Dog + */ + @Test + public void testDog() { + // TODO: test Dog + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/EnumArraysTest.java new file mode 100644 index 000000000000..02954e6a6839 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/EnumArraysTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumArrays + */ +public class EnumArraysTest { + private final EnumArrays model = new EnumArrays(); + + /** + * Model tests for EnumArrays + */ + @Test + public void testEnumArrays() { + // TODO: test EnumArrays + } + + /** + * Test the property 'justSymbol' + */ + @Test + public void justSymbolTest() { + // TODO: test justSymbol + } + + /** + * Test the property 'arrayEnum' + */ + @Test + public void arrayEnumTest() { + // TODO: test arrayEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/EnumClassTest.java new file mode 100644 index 000000000000..bed8681219e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/EnumClassTest.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.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumClass + */ +public class EnumClassTest { + /** + * Model tests for EnumClass + */ + @Test + public void testEnumClass() { + // TODO: test EnumClass + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/EnumTestTest.java new file mode 100644 index 000000000000..bb29f1e74613 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/EnumTestTest.java @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.OuterEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumTest + */ +public class EnumTestTest { + private final EnumTest model = new EnumTest(); + + /** + * Model tests for EnumTest + */ + @Test + public void testEnumTest() { + // TODO: test EnumTest + } + + /** + * Test the property 'enumString' + */ + @Test + public void enumStringTest() { + // TODO: test enumString + } + + /** + * Test the property 'enumStringRequired' + */ + @Test + public void enumStringRequiredTest() { + // TODO: test enumStringRequired + } + + /** + * Test the property 'enumInteger' + */ + @Test + public void enumIntegerTest() { + // TODO: test enumInteger + } + + /** + * Test the property 'enumNumber' + */ + @Test + public void enumNumberTest() { + // TODO: test enumNumber + } + + /** + * Test the property 'outerEnum' + */ + @Test + public void outerEnumTest() { + // TODO: test outerEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java new file mode 100644 index 000000000000..79eccbf4beef --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FileSchemaTestClass + */ +public class FileSchemaTestClassTest { + private final FileSchemaTestClass model = new FileSchemaTestClass(); + + /** + * Model tests for FileSchemaTestClass + */ + @Test + public void testFileSchemaTestClass() { + // TODO: test FileSchemaTestClass + } + + /** + * Test the property '_file' + */ + @Test + public void _fileTest() { + // TODO: test _file + } + + /** + * Test the property 'files' + */ + @Test + public void filesTest() { + // TODO: test files + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/FormatTestTest.java new file mode 100644 index 000000000000..14766694971d --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -0,0 +1,156 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.File; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FormatTest + */ +public class FormatTestTest { + private final FormatTest model = new FormatTest(); + + /** + * Model tests for FormatTest + */ + @Test + public void testFormatTest() { + // TODO: test FormatTest + } + + /** + * Test the property 'integer' + */ + @Test + public void integerTest() { + // TODO: test integer + } + + /** + * Test the property 'int32' + */ + @Test + public void int32Test() { + // TODO: test int32 + } + + /** + * Test the property 'int64' + */ + @Test + public void int64Test() { + // TODO: test int64 + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property '_float' + */ + @Test + public void _floatTest() { + // TODO: test _float + } + + /** + * Test the property '_double' + */ + @Test + public void _doubleTest() { + // TODO: test _double + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + + /** + * Test the property '_byte' + */ + @Test + public void _byteTest() { + // TODO: test _byte + } + + /** + * Test the property 'binary' + */ + @Test + public void binaryTest() { + // TODO: test binary + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'bigDecimal' + */ + @Test + public void bigDecimalTest() { + // TODO: test bigDecimal + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java new file mode 100644 index 000000000000..e9f2e0e27d9d --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HasOnlyReadOnly + */ +public class HasOnlyReadOnlyTest { + private final HasOnlyReadOnly model = new HasOnlyReadOnly(); + + /** + * Model tests for HasOnlyReadOnly + */ + @Test + public void testHasOnlyReadOnly() { + // TODO: test HasOnlyReadOnly + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'foo' + */ + @Test + public void fooTest() { + // TODO: test foo + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/MapTestTest.java new file mode 100644 index 000000000000..5d038c2d0fe8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/MapTestTest.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MapTest + */ +public class MapTestTest { + private final MapTest model = new MapTest(); + + /** + * Model tests for MapTest + */ + @Test + public void testMapTest() { + // TODO: test MapTest + } + + /** + * Test the property 'mapMapOfString' + */ + @Test + public void mapMapOfStringTest() { + // TODO: test mapMapOfString + } + + /** + * Test the property 'mapOfEnumString' + */ + @Test + public void mapOfEnumStringTest() { + // TODO: test mapOfEnumString + } + + /** + * Test the property 'directMap' + */ + @Test + public void directMapTest() { + // TODO: test directMap + } + + /** + * Test the property 'indirectMap' + */ + @Test + public void indirectMapTest() { + // TODO: test indirectMap + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..17838591172d --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java @@ -0,0 +1,68 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ +public class MixedPropertiesAndAdditionalPropertiesClassTest { + private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass(); + + /** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ + @Test + public void testMixedPropertiesAndAdditionalPropertiesClass() { + // TODO: test MixedPropertiesAndAdditionalPropertiesClass + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'map' + */ + @Test + public void mapTest() { + // TODO: test map + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/Model200ResponseTest.java new file mode 100644 index 000000000000..f2d8b804c0b9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/Model200ResponseTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Model200Response + */ +public class Model200ResponseTest { + private final Model200Response model = new Model200Response(); + + /** + * Model tests for Model200Response + */ + @Test + public void testModel200Response() { + // TODO: test Model200Response + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..b0d5fa0ec460 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelFileTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelFileTest.java new file mode 100644 index 000000000000..03567262c412 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelFileTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelFile + */ +public class ModelFileTest { + private final ModelFile model = new ModelFile(); + + /** + * Model tests for ModelFile + */ + @Test + public void testModelFile() { + // TODO: test ModelFile + } + + /** + * Test the property 'sourceURI' + */ + @Test + public void sourceURITest() { + // TODO: test sourceURI + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelListTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelListTest.java new file mode 100644 index 000000000000..670e48650b33 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelListTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelList + */ +public class ModelListTest { + private final ModelList model = new ModelList(); + + /** + * Model tests for ModelList + */ + @Test + public void testModelList() { + // TODO: test ModelList + } + + /** + * Test the property '_123list' + */ + @Test + public void _123listTest() { + // TODO: test _123list + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelReturnTest.java new file mode 100644 index 000000000000..74f4be0f5993 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ModelReturnTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelReturn + */ +public class ModelReturnTest { + private final ModelReturn model = new ModelReturn(); + + /** + * Model tests for ModelReturn + */ + @Test + public void testModelReturn() { + // TODO: test ModelReturn + } + + /** + * Test the property '_return' + */ + @Test + public void _returnTest() { + // TODO: test _return + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/NameTest.java new file mode 100644 index 000000000000..83b9901518f7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/NameTest.java @@ -0,0 +1,71 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Name + */ +public class NameTest { + private final Name model = new Name(); + + /** + * Model tests for Name + */ + @Test + public void testName() { + // TODO: test Name + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'snakeCase' + */ + @Test + public void snakeCaseTest() { + // TODO: test snakeCase + } + + /** + * Test the property 'property' + */ + @Test + public void propertyTest() { + // TODO: test property + } + + /** + * Test the property '_123number' + */ + @Test + public void _123numberTest() { + // TODO: test _123number + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/NumberOnlyTest.java new file mode 100644 index 000000000000..263fba35a860 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/NumberOnlyTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NumberOnly + */ +public class NumberOnlyTest { + private final NumberOnly model = new NumberOnly(); + + /** + * Model tests for NumberOnly + */ + @Test + public void testNumberOnly() { + // TODO: test NumberOnly + } + + /** + * Test the property 'justNumber' + */ + @Test + public void justNumberTest() { + // TODO: test justNumber + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..023271431452 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/OuterCompositeTest.java new file mode 100644 index 000000000000..5ed682c3550d --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/OuterCompositeTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterComposite + */ +public class OuterCompositeTest { + private final OuterComposite model = new OuterComposite(); + + /** + * Model tests for OuterComposite + */ + @Test + public void testOuterComposite() { + // TODO: test OuterComposite + } + + /** + * Test the property 'myNumber' + */ + @Test + public void myNumberTest() { + // TODO: test myNumber + } + + /** + * Test the property 'myString' + */ + @Test + public void myStringTest() { + // TODO: test myString + } + + /** + * Test the property 'myBoolean' + */ + @Test + public void myBooleanTest() { + // TODO: test myBoolean + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/OuterEnumTest.java new file mode 100644 index 000000000000..8ab11b65cbde --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/OuterEnumTest.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.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnum + */ +public class OuterEnumTest { + /** + * Model tests for OuterEnum + */ + @Test + public void testOuterEnum() { + // TODO: test OuterEnum + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..552828ac1f45 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/PetTest.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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java new file mode 100644 index 000000000000..290d52b66012 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadOnlyFirst + */ +public class ReadOnlyFirstTest { + private final ReadOnlyFirst model = new ReadOnlyFirst(); + + /** + * Model tests for ReadOnlyFirst + */ + @Test + public void testReadOnlyFirst() { + // TODO: test ReadOnlyFirst + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'baz' + */ + @Test + public void bazTest() { + // TODO: test baz + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java new file mode 100644 index 000000000000..14e74e01ea82 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SpecialModelName + */ +public class SpecialModelNameTest { + private final SpecialModelName model = new SpecialModelName(); + + /** + * Model tests for SpecialModelName + */ + @Test + public void testSpecialModelName() { + // TODO: test SpecialModelName + } + + /** + * Test the property '$specialPropertyName' + */ + @Test + public void $specialPropertyNameTest() { + // TODO: test $specialPropertyName + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..bf9338f4f91a --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java new file mode 100644 index 000000000000..8c431a664bda --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TypeHolderDefault + */ +public class TypeHolderDefaultTest { + private final TypeHolderDefault model = new TypeHolderDefault(); + + /** + * Model tests for TypeHolderDefault + */ + @Test + public void testTypeHolderDefault() { + // TODO: test TypeHolderDefault + } + + /** + * Test the property 'stringItem' + */ + @Test + public void stringItemTest() { + // TODO: test stringItem + } + + /** + * Test the property 'numberItem' + */ + @Test + public void numberItemTest() { + // TODO: test numberItem + } + + /** + * Test the property 'integerItem' + */ + @Test + public void integerItemTest() { + // TODO: test integerItem + } + + /** + * Test the property 'boolItem' + */ + @Test + public void boolItemTest() { + // TODO: test boolItem + } + + /** + * Test the property 'arrayItem' + */ + @Test + public void arrayItemTest() { + // TODO: test arrayItem + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java new file mode 100644 index 000000000000..65b2aa966eec --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java @@ -0,0 +1,91 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TypeHolderExample + */ +public class TypeHolderExampleTest { + private final TypeHolderExample model = new TypeHolderExample(); + + /** + * Model tests for TypeHolderExample + */ + @Test + public void testTypeHolderExample() { + // TODO: test TypeHolderExample + } + + /** + * Test the property 'stringItem' + */ + @Test + public void stringItemTest() { + // TODO: test stringItem + } + + /** + * Test the property 'numberItem' + */ + @Test + public void numberItemTest() { + // TODO: test numberItem + } + + /** + * Test the property 'floatItem' + */ + @Test + public void floatItemTest() { + // TODO: test floatItem + } + + /** + * Test the property 'integerItem' + */ + @Test + public void integerItemTest() { + // TODO: test integerItem + } + + /** + * Test the property 'boolItem' + */ + @Test + public void boolItemTest() { + // TODO: test boolItem + } + + /** + * Test the property 'arrayItem' + */ + @Test + public void arrayItemTest() { + // TODO: test arrayItem + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..5ea9705d7a43 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/UserTest.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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/XmlItemTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/XmlItemTest.java new file mode 100644 index 000000000000..9f7762e5dd92 --- /dev/null +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/test/java/org/openapitools/client/model/XmlItemTest.java @@ -0,0 +1,275 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for XmlItem + */ +public class XmlItemTest { + private final XmlItem model = new XmlItem(); + + /** + * Model tests for XmlItem + */ + @Test + public void testXmlItem() { + // TODO: test XmlItem + } + + /** + * Test the property 'attributeString' + */ + @Test + public void attributeStringTest() { + // TODO: test attributeString + } + + /** + * Test the property 'attributeNumber' + */ + @Test + public void attributeNumberTest() { + // TODO: test attributeNumber + } + + /** + * Test the property 'attributeInteger' + */ + @Test + public void attributeIntegerTest() { + // TODO: test attributeInteger + } + + /** + * Test the property 'attributeBoolean' + */ + @Test + public void attributeBooleanTest() { + // TODO: test attributeBoolean + } + + /** + * Test the property 'wrappedArray' + */ + @Test + public void wrappedArrayTest() { + // TODO: test wrappedArray + } + + /** + * Test the property 'nameString' + */ + @Test + public void nameStringTest() { + // TODO: test nameString + } + + /** + * Test the property 'nameNumber' + */ + @Test + public void nameNumberTest() { + // TODO: test nameNumber + } + + /** + * Test the property 'nameInteger' + */ + @Test + public void nameIntegerTest() { + // TODO: test nameInteger + } + + /** + * Test the property 'nameBoolean' + */ + @Test + public void nameBooleanTest() { + // TODO: test nameBoolean + } + + /** + * Test the property 'nameArray' + */ + @Test + public void nameArrayTest() { + // TODO: test nameArray + } + + /** + * Test the property 'nameWrappedArray' + */ + @Test + public void nameWrappedArrayTest() { + // TODO: test nameWrappedArray + } + + /** + * Test the property 'prefixString' + */ + @Test + public void prefixStringTest() { + // TODO: test prefixString + } + + /** + * Test the property 'prefixNumber' + */ + @Test + public void prefixNumberTest() { + // TODO: test prefixNumber + } + + /** + * Test the property 'prefixInteger' + */ + @Test + public void prefixIntegerTest() { + // TODO: test prefixInteger + } + + /** + * Test the property 'prefixBoolean' + */ + @Test + public void prefixBooleanTest() { + // TODO: test prefixBoolean + } + + /** + * Test the property 'prefixArray' + */ + @Test + public void prefixArrayTest() { + // TODO: test prefixArray + } + + /** + * Test the property 'prefixWrappedArray' + */ + @Test + public void prefixWrappedArrayTest() { + // TODO: test prefixWrappedArray + } + + /** + * Test the property 'namespaceString' + */ + @Test + public void namespaceStringTest() { + // TODO: test namespaceString + } + + /** + * Test the property 'namespaceNumber' + */ + @Test + public void namespaceNumberTest() { + // TODO: test namespaceNumber + } + + /** + * Test the property 'namespaceInteger' + */ + @Test + public void namespaceIntegerTest() { + // TODO: test namespaceInteger + } + + /** + * Test the property 'namespaceBoolean' + */ + @Test + public void namespaceBooleanTest() { + // TODO: test namespaceBoolean + } + + /** + * Test the property 'namespaceArray' + */ + @Test + public void namespaceArrayTest() { + // TODO: test namespaceArray + } + + /** + * Test the property 'namespaceWrappedArray' + */ + @Test + public void namespaceWrappedArrayTest() { + // TODO: test namespaceWrappedArray + } + + /** + * Test the property 'prefixNsString' + */ + @Test + public void prefixNsStringTest() { + // TODO: test prefixNsString + } + + /** + * Test the property 'prefixNsNumber' + */ + @Test + public void prefixNsNumberTest() { + // TODO: test prefixNsNumber + } + + /** + * Test the property 'prefixNsInteger' + */ + @Test + public void prefixNsIntegerTest() { + // TODO: test prefixNsInteger + } + + /** + * Test the property 'prefixNsBoolean' + */ + @Test + public void prefixNsBooleanTest() { + // TODO: test prefixNsBoolean + } + + /** + * Test the property 'prefixNsArray' + */ + @Test + public void prefixNsArrayTest() { + // TODO: test prefixNsArray + } + + /** + * Test the property 'prefixNsWrappedArray' + */ + @Test + public void prefixNsWrappedArrayTest() { + // TODO: test prefixNsWrappedArray + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger1/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp-swagger1/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp-swagger1/.gitignore b/samples/client/petstore/java/okhttp-swagger1/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/.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/client/petstore/java/okhttp-swagger1/.openapi-generator-ignore b/samples/client/petstore/java/okhttp-swagger1/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/.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/client/petstore/java/okhttp-swagger1/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-swagger1/.openapi-generator/FILES new file mode 100644 index 000000000000..dcc56b6dd665 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/.openapi-generator/FILES @@ -0,0 +1,59 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/Category.md +docs/CommonApi.md +docs/ModelApiResponse.md +docs/Order.md +docs/Pet.md +docs/Tag.md +docs/User.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/CommonApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/User.java +src/test/java/org/openapitools/client/api/CommonApiTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/okhttp-swagger1/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-swagger1/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-swagger1/.travis.yml b/samples/client/petstore/java/okhttp-swagger1/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/.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/client/petstore/java/okhttp-swagger1/README.md b/samples/client/petstore/java/okhttp-swagger1/README.md new file mode 100644 index 000000000000..6a628851f9df --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/README.md @@ -0,0 +1,184 @@ +# petstore-okhttp + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-okhttp + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-okhttp' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/petstore-okhttp-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + CommonApi apiInstance = new CommonApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*CommonApi* | [**addPet**](docs/CommonApi.md#addPet) | **POST** /pet | Add a new pet to the store +*CommonApi* | [**createUser**](docs/CommonApi.md#createUser) | **POST** /user | Create user +*CommonApi* | [**createUsersWithArrayInput**](docs/CommonApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*CommonApi* | [**createUsersWithListInput**](docs/CommonApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*CommonApi* | [**deleteOrder**](docs/CommonApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*CommonApi* | [**deletePet**](docs/CommonApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*CommonApi* | [**deleteUser**](docs/CommonApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*CommonApi* | [**findPetsByStatus**](docs/CommonApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*CommonApi* | [**findPetsByTags**](docs/CommonApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*CommonApi* | [**getInventory**](docs/CommonApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*CommonApi* | [**getOrderById**](docs/CommonApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*CommonApi* | [**getPetById**](docs/CommonApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*CommonApi* | [**getUserByName**](docs/CommonApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*CommonApi* | [**loginUser**](docs/CommonApi.md#loginUser) | **GET** /user/login | Logs user into the system +*CommonApi* | [**logoutUser**](docs/CommonApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*CommonApi* | [**placeOrder**](docs/CommonApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*CommonApi* | [**updatePet**](docs/CommonApi.md#updatePet) | **PUT** /pet | Update an existing pet +*CommonApi* | [**updatePetWithForm**](docs/CommonApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*CommonApi* | [**updateUser**](docs/CommonApi.md#updateUser) | **PUT** /user/{username} | Updated user +*CommonApi* | [**uploadFile**](docs/CommonApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image + + +## Documentation for Models + + - [Category](docs/Category.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp-swagger1/api/openapi.yaml b/samples/client/petstore/java/okhttp-swagger1/api/openapi.yaml new file mode 100644 index 000000000000..d45ad9329428 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/api/openapi.yaml @@ -0,0 +1,870 @@ +openapi: 3.0.0 +info: + description: "This is a sample server Petstore server. For this sample, you can\ + \ use the api key `special-key` to test the authorization filters." + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - common + x-content-type: application/json + x-accepts: + - application/json + - application/xml + put: + description: "" + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - common + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - common + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - common + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - common + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - common + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - common + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - common + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - common + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - common + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: orderId + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - common + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - common + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - common + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - common + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - common + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - common + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - common + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - common + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - common + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - common + x-content-type: application/json + x-accepts: + - application/json +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + Order: + description: An order for a pets from the pet store + example: + id: 0 + petId: 6 + quantity: 1 + shipDate: 2000-01-23T04:56:07.000+00:00 + status: placed + complete: false + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object + xml: + name: Order + Category: + description: A category for a pet + example: + id: 6 + name: name + properties: + id: + format: int64 + type: integer + name: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + title: Pet category + type: object + xml: + name: Category + User: + description: A User who is purchasing from the pet store + example: + id: 0 + username: username + firstName: firstName + lastName: lastName + email: email + password: password + phone: phone + userStatus: 6 + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Tag: + description: A tag for a pet + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + Pet: + description: A pet for sale in the pet store + example: + id: 0 + category: + id: 6 + name: name + name: doggie + photoUrls: + - photoUrls + - photoUrls + tags: + - id: 1 + name: name + - id: 1 + name: name + status: available + properties: + id: + format: int64 + type: integer + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + diff --git a/samples/client/petstore/java/okhttp-swagger1/build.gradle b/samples/client/petstore/java/okhttp-swagger1/build.gradle new file mode 100644 index 000000000000..4d50d10d2a2c --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/build.gradle @@ -0,0 +1,66 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-okhttp' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + swagger_annotations_version = "1.6.6" + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "io.swagger:swagger-annotations:$swagger_annotations_version" + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/build.sbt b/samples/client/petstore/java/okhttp-swagger1/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp-swagger1/docs/Category.md b/samples/client/petstore/java/okhttp-swagger1/docs/Category.md new file mode 100644 index 000000000000..a7fc939d252e --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/docs/Category.md @@ -0,0 +1,15 @@ + + +# Category + +A category for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-swagger1/docs/CommonApi.md b/samples/client/petstore/java/okhttp-swagger1/docs/CommonApi.md new file mode 100644 index 000000000000..28b3e5e5cf2c --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/docs/CommonApi.md @@ -0,0 +1,1373 @@ +# CommonApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](CommonApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**createUser**](CommonApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](CommonApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](CommonApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteOrder**](CommonApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**deletePet**](CommonApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**deleteUser**](CommonApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**findPetsByStatus**](CommonApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](CommonApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getInventory**](CommonApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](CommonApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**getPetById**](CommonApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**getUserByName**](CommonApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](CommonApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](CommonApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**placeOrder**](CommonApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | +| [**updatePet**](CommonApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](CommonApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**updateUser**](CommonApi.md#updateUser) | **PUT** /user/{username} | Updated user | +| [**uploadFile**](CommonApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | + + + +# **addPet** +> Pet addPet(pet) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + CommonApi apiInstance = new CommonApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + CommonApi apiInstance = new CommonApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + CommonApi apiInstance = new CommonApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + CommonApi apiInstance = new CommonApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### 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.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + CommonApi apiInstance = new CommonApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + CommonApi apiInstance = new CommonApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + CommonApi apiInstance = new CommonApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + CommonApi apiInstance = new CommonApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + CommonApi apiInstance = new CommonApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + CommonApi apiInstance = new CommonApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#getInventory"); + 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 + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### 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.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + CommonApi apiInstance = new CommonApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + CommonApi apiInstance = new CommonApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### 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.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + CommonApi apiInstance = new CommonApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### 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.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + CommonApi apiInstance = new CommonApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + CommonApi apiInstance = new CommonApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#logoutUser"); + 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 + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + + + +### 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.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + CommonApi apiInstance = new CommonApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + + +# **updatePet** +> Pet updatePet(pet) + +Update an existing pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + CommonApi apiInstance = new CommonApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.updatePet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + CommonApi apiInstance = new CommonApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + CommonApi apiInstance = new CommonApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.CommonApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + CommonApi apiInstance = new CommonApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CommonApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-swagger1/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-swagger1/docs/ModelApiResponse.md new file mode 100644 index 000000000000..cd7e3c400be6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/docs/ModelApiResponse.md @@ -0,0 +1,16 @@ + + +# ModelApiResponse + +Describes the result of uploading an image resource + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-swagger1/docs/Order.md b/samples/client/petstore/java/okhttp-swagger1/docs/Order.md new file mode 100644 index 000000000000..0c33059b8b6a --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/docs/Order.md @@ -0,0 +1,29 @@ + + +# Order + +An order for a pets from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp-swagger1/docs/Pet.md b/samples/client/petstore/java/okhttp-swagger1/docs/Pet.md new file mode 100644 index 000000000000..8bb363301232 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/docs/Pet.md @@ -0,0 +1,29 @@ + + +# Pet + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-swagger1/docs/Tag.md b/samples/client/petstore/java/okhttp-swagger1/docs/Tag.md new file mode 100644 index 000000000000..abfde4afb501 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/docs/Tag.md @@ -0,0 +1,15 @@ + + +# Tag + +A tag for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-swagger1/docs/User.md b/samples/client/petstore/java/okhttp-swagger1/docs/User.md new file mode 100644 index 000000000000..426845227bd3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/docs/User.md @@ -0,0 +1,21 @@ + + +# User + +A User who is purchasing from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-swagger1/git_push.sh b/samples/client/petstore/java/okhttp-swagger1/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp-swagger1/gradle.properties b/samples/client/petstore/java/okhttp-swagger1/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-swagger1/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-swagger1/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-swagger1/gradlew.bat b/samples/client/petstore/java/okhttp-swagger1/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp-swagger1/pom.xml b/samples/client/petstore/java/okhttp-swagger1/pom.xml new file mode 100644 index 000000000000..ed7122076fa4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/pom.xml @@ -0,0 +1,290 @@ + + 4.0.0 + org.openapitools + petstore-okhttp + jar + petstore-okhttp + 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-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + io.swagger + swagger-annotations + ${swagger-annotations-version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 1.6.6 + 5.4.0 + 2.10.1 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp-swagger1/settings.gradle b/samples/client/petstore/java/okhttp-swagger1/settings.gradle new file mode 100644 index 000000000000..3c778001cf97 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-okhttp" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-swagger1/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..e818a511443e --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..deb938b73b46 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1727 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://petstore.swagger.io/v2"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = ""; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io/v2) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..bbe1b2c8ee33 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..189537deb549 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..ba56d6cab13d --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..01aa8bb7a1f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,445 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Category.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelApiResponse.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Order.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Pet.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Tag.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.User.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..8b84ab37c82a --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..673ffc4cbb7b --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..10eeda6a297e --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..ae47d8bdb452 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..1b09cdb8d75c --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..a4859da9a700 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/api/CommonApi.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/api/CommonApi.java new file mode 100644 index 000000000000..697494ce4793 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/api/CommonApi.java @@ -0,0 +1,2749 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import java.time.OffsetDateTime; +import org.openapitools.client.model.Order; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CommonApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CommonApi() { + this(Configuration.getDefaultApiClient()); + } + + public CommonApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addPet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call addPetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addPetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling addPet(Async)"); + } + + return addPetCall(pet, _callback); + + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public Pet addPet(@javax.annotation.Nonnull Pet pet) throws ApiException { + ApiResponse localVarResp = addPetWithHttpInfo(pet); + return localVarResp.getData(); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Add a new pet to the store (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call addPetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createUser + * @param user Created user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUserValidateBeforeCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUser(Async)"); + } + + return createUserCall(user, _callback); + + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create user (asynchronously) + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserAsync(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithArrayInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithArrayInput(Async)"); + } + + return createUsersWithArrayInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithListInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithList"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithListInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithListInput(Async)"); + } + + return createUsersWithListInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteOrder + * @param orderId ID of the order that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{orderId}" + .replace("{" + "orderId" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOrderValidateBeforeCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); + } + + return deleteOrderCall(orderId, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete purchase order by ID (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderAsync(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deletePet + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePetValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); + } + + return deletePetCall(petId, apiKey, _callback); + + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deletes a pet (asynchronously) + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteUser + * @param username The name that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteUserValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); + } + + return deleteUserCall(username, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete user (asynchronously) + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for findPetsByStatus + * @param status Status values that need to be considered for filter (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "status", status)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByStatusValidateBeforeCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + + return findPetsByStatusCall(status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + ApiResponse> localVarResp = findPetsByStatusWithHttpInfo(status); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by status (asynchronously) + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusAsync(@javax.annotation.Nonnull List status, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for findPetsByTags + * @param tags Tags to filter by (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByTagsValidateBeforeCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); + } + + return findPetsByTagsCall(tags, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { + ApiResponse> localVarResp = findPetsByTagsWithHttpInfo(tags); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by tags (asynchronously) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsAsync(@javax.annotation.Nonnull List tags, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getInventory + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getInventoryCall(_callback); + + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Map getInventory() throws ApiException { + ApiResponse> localVarResp = getInventoryWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Returns pet inventories by status (asynchronously) + * Returns a map of status codes to quantities + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderById + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{orderId}" + .replace("{" + "orderId" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderByIdValidateBeforeCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); + } + + return getOrderByIdCall(orderId, _callback); + + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + ApiResponse localVarResp = getOrderByIdWithHttpInfo(orderId); + return localVarResp.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find purchase order by ID (asynchronously) + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdAsync(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPetById + * @param petId ID of pet to return (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + return getPetByIdCall(petId, _callback); + + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + ApiResponse localVarResp = getPetByIdWithHttpInfo(petId); + return localVarResp.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find pet by ID (asynchronously) + * Returns a single pet + * @param petId ID of pet to return (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdAsync(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserByName + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByNameValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); + } + + return getUserByNameCall(username, _callback); + + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + ApiResponse localVarResp = getUserByNameWithHttpInfo(username); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get user by user name (asynchronously) + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for loginUser + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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 okhttp3.Call loginUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (username != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); + } + + if (password != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("password", password)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call loginUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); + } + + return loginUserCall(username, password, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + ApiResponse localVarResp = loginUserWithHttpInfo(username, password); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Logs user into the system (asynchronously) + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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 okhttp3.Call loginUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for logoutUser + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return logoutUserCall(_callback); + + } + + /** + * Logs out current logged in user session + * + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Logs out current logged in user session (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for placeOrder + * @param order order placed for purchasing the pet (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = order; + + // create path and map variables + String localVarPath = "/store/order"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException("Missing the required parameter 'order' when calling placeOrder(Async)"); + } + + return placeOrderCall(order, _callback); + + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { + ApiResponse localVarResp = placeOrderWithHttpInfo(order); + return localVarResp.getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Place an order for a pet (asynchronously) + * + * @param order order placed for purchasing the pet (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderAsync(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public okhttp3.Call updatePetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling updatePet(Async)"); + } + + return updatePetCall(pet, _callback); + + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public Pet updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException { + ApiResponse localVarResp = updatePetWithHttpInfo(pet); + return localVarResp.getData(); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update an existing pet (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public okhttp3.Call updatePetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePetWithForm + * @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) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetWithFormValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); + } + + return updatePetWithFormCall(petId, name, status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updates a pet in the store with form data (asynchronously) + * + * @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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateUser + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling updateUser(Async)"); + } + + return updateUserCall(username, user, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updated user (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for uploadFile + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); + } + + return uploadFileCall(petId, additionalMetadata, _file, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = uploadFileWithHttpInfo(petId, additionalMetadata, _file); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (asynchronously) + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..334ae1f6fd40 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..07839e9966cf --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..85d6556f1f68 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..f728b306c358 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..0b5e71fe6212 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,43 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..0de7ae9fc491 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..57db3963e4f6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..75a1d304801f --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..bdd0ae91976f --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,142 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..82d792a7ddd2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,316 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A category for a pet + */ +@ApiModel(description = "A category for a pet") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Category { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, category.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Category + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Category.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Category' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Category.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Category value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Category read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Category given an JSON string + * + * @param jsonString JSON string + * @return An instance of Category + * @throws IOException if the JSON string is invalid with respect to Category + */ + public static Category fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Category.class); + } + + /** + * Convert an instance of Category to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..25747805ed7e --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,347 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Describes the result of uploading an image resource + */ +@ApiModel(description = "Describes the result of uploading an image resource") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelApiResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Integer getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, _apiResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("code", "type", "message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelApiResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelApiResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelApiResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelApiResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelApiResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelApiResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelApiResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelApiResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelApiResponse + * @throws IOException if the JSON string is invalid with respect to ModelApiResponse + */ + public static ModelApiResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelApiResponse.class); + } + + /** + * Convert an instance of ModelApiResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..d6abcf24cbcb --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,487 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * An order for a pets from the pet store + */ +@ApiModel(description = "An order for a pets from the pet store") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Order { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_PET_ID = "petId"; + @SerializedName(SERIALIZED_NAME_PET_ID) + @javax.annotation.Nullable + private Long petId; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; + @SerializedName(SERIALIZED_NAME_SHIP_DATE) + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_COMPLETE = "complete"; + @SerializedName(SERIALIZED_NAME_COMPLETE) + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Long getPetId() { + return petId; + } + + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public OffsetDateTime getShipDate() { + return shipDate; + } + + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "Order Status") + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Boolean getComplete() { + return complete; + } + + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, order.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "petId", "quantity", "shipDate", "status", "complete")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Order + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Order.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Order' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Order.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Order value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Order read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Order instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Order given an JSON string + * + * @param jsonString JSON string + * @return An instance of Order + * @throws IOException if the JSON string is invalid with respect to Order + */ + public static Order fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Order.class); + } + + /** + * Convert an instance of Order to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..ed879297876a --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,546 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A pet for sale in the pet store + */ +@ApiModel(description = "A pet for sale in the pet store") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pet { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @Deprecated + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @ApiModelProperty(example = "doggie", required = true, value = "") + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable 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 = "") + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + @Deprecated + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + @ApiModelProperty(value = "pet status in the store") + + public StatusEnum getStatus() { + return status; + } + + @Deprecated + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, pet.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Pet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Pet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Pet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Pet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Pet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Pet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Pet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Pet given an JSON string + * + * @param jsonString JSON string + * @return An instance of Pet + * @throws IOException if the JSON string is invalid with respect to Pet + */ + public static Pet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Pet.class); + } + + /** + * Convert an instance of Pet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..face50a10b61 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,316 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A tag for a pet + */ +@ApiModel(description = "A tag for a pet") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Tag { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Tag + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Tag.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Tag' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Tag value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Tag read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Tag given an JSON string + * + * @param jsonString JSON string + * @return An instance of Tag + * @throws IOException if the JSON string is invalid with respect to Tag + */ + public static Tag fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Tag.class); + } + + /** + * Convert an instance of Tag to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..09935beb3fb2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,499 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A User who is purchasing from the pet store + */ +@ApiModel(description = "A User who is purchasing from the pet store") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class User { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nullable + private String username; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nullable + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nullable + private String lastName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nullable + private String password; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nullable + private String phone; + + public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; + @SerializedName(SERIALIZED_NAME_USER_STATUS) + @javax.annotation.Nullable + private Integer userStatus; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "User Status") + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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.additionalProperties, user.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to User + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) && !jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!User.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'User' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(User.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, User value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public User read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of User given an JSON string + * + * @param jsonString JSON string + * @return An instance of User + * @throws IOException if the JSON string is invalid with respect to User + */ + public static User fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, User.class); + } + + /** + * Convert an instance of User to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/api/CommonApiTest.java b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/api/CommonApiTest.java new file mode 100644 index 000000000000..5d0164957bc0 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/api/CommonApiTest.java @@ -0,0 +1,324 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import java.time.OffsetDateTime; +import org.openapitools.client.model.Order; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for CommonApi + */ +@Disabled +public class CommonApiTest { + + private final CommonApi api = new CommonApi(); + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + Pet response = api.addPet(pet); + // TODO: test validations + } + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User user = null; + api.createUser(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List user = null; + api.createUsersWithArrayInput(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List user = null; + api.createUsersWithListInput(user); + // TODO: test validations + } + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + api.deleteUser(username); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = api.getOrderById(orderId); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + api.logoutUser(); + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order order = null; + Order response = api.placeOrder(order); + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + Pet response = api.updatePet(pet); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User user = null; + api.updateUser(username, user); + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.uploadFile(petId, additionalMetadata, _file); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..271ba7149361 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..f89a39ccd95b --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..9d116909380f --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,90 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..71d066cd0e1d --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,94 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..4b5e88a16f9c --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..f6c486fee0e7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger1/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,105 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger2/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp-swagger2/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp-swagger2/.gitignore b/samples/client/petstore/java/okhttp-swagger2/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/.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/client/petstore/java/okhttp-swagger2/.openapi-generator-ignore b/samples/client/petstore/java/okhttp-swagger2/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/.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/client/petstore/java/okhttp-swagger2/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-swagger2/.openapi-generator/FILES new file mode 100644 index 000000000000..7acc559f04eb --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/.openapi-generator/FILES @@ -0,0 +1,65 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/Category.md +docs/ModelApiResponse.md +docs/Order.md +docs/Pet.md +docs/PetApi.md +docs/StoreApi.md +docs/Tag.md +docs/User.md +docs/UserApi.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/User.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/okhttp-swagger2/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-swagger2/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-swagger2/.travis.yml b/samples/client/petstore/java/okhttp-swagger2/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/.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/client/petstore/java/okhttp-swagger2/README.md b/samples/client/petstore/java/okhttp-swagger2/README.md new file mode 100644 index 000000000000..d599bdb7d9a2 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/README.md @@ -0,0 +1,184 @@ +# petstore-okhttp + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-okhttp + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-okhttp' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/petstore-okhttp-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Category](docs/Category.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp-swagger2/api/openapi.yaml b/samples/client/petstore/java/okhttp-swagger2/api/openapi.yaml new file mode 100644 index 000000000000..a1efcc2e4d8c --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/api/openapi.yaml @@ -0,0 +1,870 @@ +openapi: 3.0.0 +info: + description: "This is a sample server Petstore server. For this sample, you can\ + \ use the api key `special-key` to test the authorization filters." + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + put: + description: "" + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: orderId + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json +components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + Order: + description: An order for a pets from the pet store + example: + id: 0 + petId: 6 + quantity: 1 + shipDate: 2000-01-23T04:56:07.000+00:00 + status: placed + complete: false + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object + xml: + name: Order + Category: + description: A category for a pet + example: + id: 6 + name: name + properties: + id: + format: int64 + type: integer + name: + pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$" + type: string + title: Pet category + type: object + xml: + name: Category + User: + description: A User who is purchasing from the pet store + example: + id: 0 + username: username + firstName: firstName + lastName: lastName + email: email + password: password + phone: phone + userStatus: 6 + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Tag: + description: A tag for a pet + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + Pet: + description: A pet for sale in the pet store + example: + id: 0 + category: + id: 6 + name: name + name: doggie + photoUrls: + - photoUrls + - photoUrls + tags: + - id: 1 + name: name + - id: 1 + name: name + status: available + properties: + id: + format: int64 + type: integer + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + diff --git a/samples/client/petstore/java/okhttp-swagger2/build.gradle b/samples/client/petstore/java/okhttp-swagger2/build.gradle new file mode 100644 index 000000000000..7694555db918 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/build.gradle @@ -0,0 +1,66 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-okhttp' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + swagger_annotations_version = "2.2.15" + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version" + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/build.sbt b/samples/client/petstore/java/okhttp-swagger2/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp-swagger2/docs/Category.md b/samples/client/petstore/java/okhttp-swagger2/docs/Category.md new file mode 100644 index 000000000000..a7fc939d252e --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/docs/Category.md @@ -0,0 +1,15 @@ + + +# Category + +A category for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-swagger2/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-swagger2/docs/ModelApiResponse.md new file mode 100644 index 000000000000..cd7e3c400be6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/docs/ModelApiResponse.md @@ -0,0 +1,16 @@ + + +# ModelApiResponse + +Describes the result of uploading an image resource + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-swagger2/docs/Order.md b/samples/client/petstore/java/okhttp-swagger2/docs/Order.md new file mode 100644 index 000000000000..0c33059b8b6a --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/docs/Order.md @@ -0,0 +1,29 @@ + + +# Order + +An order for a pets from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp-swagger2/docs/Pet.md b/samples/client/petstore/java/okhttp-swagger2/docs/Pet.md new file mode 100644 index 000000000000..8bb363301232 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/docs/Pet.md @@ -0,0 +1,29 @@ + + +# Pet + +A pet for sale in the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp-swagger2/docs/PetApi.md b/samples/client/petstore/java/okhttp-swagger2/docs/PetApi.md new file mode 100644 index 000000000000..f395ba3f6f16 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/docs/PetApi.md @@ -0,0 +1,570 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | + + + +# **addPet** +> Pet addPet(pet) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.addPet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +# **updatePet** +> Pet updatePet(pet) + +Update an existing pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + Pet result = apiInstance.updatePet(pet); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, additionalMetadata, _file) + +uploads an image + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp-swagger2/docs/StoreApi.md b/samples/client/petstore/java/okhttp-swagger2/docs/StoreApi.md new file mode 100644 index 000000000000..af54298ffc2e --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/docs/StoreApi.md @@ -0,0 +1,266 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + 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 + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + + + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/okhttp-swagger2/docs/Tag.md b/samples/client/petstore/java/okhttp-swagger2/docs/Tag.md new file mode 100644 index 000000000000..abfde4afb501 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/docs/Tag.md @@ -0,0 +1,15 @@ + + +# Tag + +A tag for a pet + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-swagger2/docs/User.md b/samples/client/petstore/java/okhttp-swagger2/docs/User.md new file mode 100644 index 000000000000..426845227bd3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/docs/User.md @@ -0,0 +1,21 @@ + + +# User + +A User who is purchasing from the pet store + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp-swagger2/docs/UserApi.md b/samples/client/petstore/java/okhttp-swagger2/docs/UserApi.md new file mode 100644 index 000000000000..4c338a42137a --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/docs/UserApi.md @@ -0,0 +1,553 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | + + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + 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 + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + +null (empty response body) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/okhttp-swagger2/git_push.sh b/samples/client/petstore/java/okhttp-swagger2/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp-swagger2/gradle.properties b/samples/client/petstore/java/okhttp-swagger2/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp-swagger2/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp-swagger2/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp-swagger2/gradlew.bat b/samples/client/petstore/java/okhttp-swagger2/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp-swagger2/pom.xml b/samples/client/petstore/java/okhttp-swagger2/pom.xml new file mode 100644 index 000000000000..eeeb329cb8c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/pom.xml @@ -0,0 +1,290 @@ + + 4.0.0 + org.openapitools + petstore-okhttp + jar + petstore-okhttp + 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-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + io.swagger.core.v3 + swagger-annotations + ${swagger-annotations-version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 2.2.15 + 5.4.0 + 2.10.1 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp-swagger2/settings.gradle b/samples/client/petstore/java/okhttp-swagger2/settings.gradle new file mode 100644 index 000000000000..3c778001cf97 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-okhttp" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp-swagger2/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..e818a511443e --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..deb938b73b46 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1727 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://petstore.swagger.io/v2"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = ""; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io/v2) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..bbe1b2c8ee33 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..189537deb549 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..ba56d6cab13d --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..01aa8bb7a1f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,445 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Category.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelApiResponse.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Order.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Pet.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Tag.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.User.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..8b84ab37c82a --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..673ffc4cbb7b --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..10eeda6a297e --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..ae47d8bdb452 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..1b09cdb8d75c --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..a4859da9a700 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..d9ea607ffd54 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1201 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PetApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addPet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call addPetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addPetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling addPet(Async)"); + } + + return addPetCall(pet, _callback); + + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public Pet addPet(@javax.annotation.Nonnull Pet pet) throws ApiException { + ApiResponse localVarResp = addPetWithHttpInfo(pet); + return localVarResp.getData(); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Add a new pet to the store (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
+ */ + public okhttp3.Call addPetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deletePet + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePetValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); + } + + return deletePetCall(petId, apiKey, _callback); + + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deletes a pet (asynchronously) + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for findPetsByStatus + * @param status Status values that need to be considered for filter (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "status", status)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByStatusValidateBeforeCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + + return findPetsByStatusCall(status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + ApiResponse> localVarResp = findPetsByStatusWithHttpInfo(status); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by status (asynchronously) + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusAsync(@javax.annotation.Nonnull List status, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for findPetsByTags + * @param tags Tags to filter by (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByTagsValidateBeforeCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); + } + + return findPetsByTagsCall(tags, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { + ApiResponse> localVarResp = findPetsByTagsWithHttpInfo(tags); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by tags (asynchronously) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsAsync(@javax.annotation.Nonnull List tags, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPetById + * @param petId ID of pet to return (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + return getPetByIdCall(petId, _callback); + + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + ApiResponse localVarResp = getPetByIdWithHttpInfo(petId); + return localVarResp.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find pet by ID (asynchronously) + * Returns a single pet + * @param petId ID of pet to return (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdAsync(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public okhttp3.Call updatePetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling updatePet(Async)"); + } + + return updatePetCall(pet, _callback); + + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public Pet updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException { + ApiResponse localVarResp = updatePetWithHttpInfo(pet); + return localVarResp.getData(); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update an existing pet (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ * API documentation for the updatePet operation + * @see Update an existing pet Documentation + */ + public okhttp3.Call updatePetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePetWithForm + * @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) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetWithFormValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); + } + + return updatePetWithFormCall(petId, name, status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updates a pet in the store with form data (asynchronously) + * + * @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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for uploadFile + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); + } + + return uploadFileCall(petId, additionalMetadata, _file, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = uploadFileWithHttpInfo(petId, additionalMetadata, _file); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (asynchronously) + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..ff1582272715 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,593 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Order; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class StoreApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteOrder + * @param orderId ID of the order that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{orderId}" + .replace("{" + "orderId" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOrderValidateBeforeCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); + } + + return deleteOrderCall(orderId, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete purchase order by ID (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderAsync(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getInventory + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getInventoryCall(_callback); + + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Map getInventory() throws ApiException { + ApiResponse> localVarResp = getInventoryWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Returns pet inventories by status (asynchronously) + * Returns a map of status codes to quantities + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderById + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{orderId}" + .replace("{" + "orderId" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderByIdValidateBeforeCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); + } + + return getOrderByIdCall(orderId, _callback); + + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + ApiResponse localVarResp = getOrderByIdWithHttpInfo(orderId); + return localVarResp.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find purchase order by ID (asynchronously) + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdAsync(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for placeOrder + * @param order order placed for purchasing the pet (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = order; + + // create path and map variables + String localVarPath = "/store/order"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException("Missing the required parameter 'order' when calling placeOrder(Async)"); + } + + return placeOrderCall(order, _callback); + + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { + ApiResponse localVarResp = placeOrderWithHttpInfo(order); + return localVarResp.getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Place an order for a pet (asynchronously) + * + * @param order order placed for purchasing the pet (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderAsync(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..0eb18f7e8ef7 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,1105 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UserApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createUser + * @param user Created user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUserValidateBeforeCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUser(Async)"); + } + + return createUserCall(user, _callback); + + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create user (asynchronously) + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserAsync(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithArrayInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithArrayInput(Async)"); + } + + return createUsersWithArrayInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithListInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithList"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithListInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithListInput(Async)"); + } + + return createUsersWithListInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteUser + * @param username The name that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteUserValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); + } + + return deleteUserCall(username, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete user (asynchronously) + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getUserByName + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByNameValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); + } + + return getUserByNameCall(username, _callback); + + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + ApiResponse localVarResp = getUserByNameWithHttpInfo(username); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get user by user name (asynchronously) + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for loginUser + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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 okhttp3.Call loginUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (username != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); + } + + if (password != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("password", password)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call loginUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); + } + + return loginUserCall(username, password, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + ApiResponse localVarResp = loginUserWithHttpInfo(username, password); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Logs user into the system (asynchronously) + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* 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 okhttp3.Call loginUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for logoutUser + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return logoutUserCall(_callback); + + } + + /** + * Logs out current logged in user session + * + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Logs out current logged in user session (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateUser + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling updateUser(Async)"); + } + + return updateUserCall(username, user, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updated user (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..334ae1f6fd40 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..07839e9966cf --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..85d6556f1f68 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..f728b306c358 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..0b5e71fe6212 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,43 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..0de7ae9fc491 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..57db3963e4f6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..75a1d304801f --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.ApiException; +import org.openapitools.client.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..bdd0ae91976f --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,142 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..7af8c4639a6c --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,315 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A category for a pet + */ +@Schema(description = "A category for a pet") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Category { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, category.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Category + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Category.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Category' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Category.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Category value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Category read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Category given an JSON string + * + * @param jsonString JSON string + * @return An instance of Category + * @throws IOException if the JSON string is invalid with respect to Category + */ + public static Category fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Category.class); + } + + /** + * Convert an instance of Category to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..ea0615681b44 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,346 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Describes the result of uploading an image resource + */ +@Schema(description = "Describes the result of uploading an image resource") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelApiResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public Integer getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, _apiResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("code", "type", "message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelApiResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelApiResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelApiResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelApiResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelApiResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelApiResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelApiResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelApiResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelApiResponse + * @throws IOException if the JSON string is invalid with respect to ModelApiResponse + */ + public static ModelApiResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelApiResponse.class); + } + + /** + * Convert an instance of ModelApiResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..4dbce3b0ec10 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,486 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +import java.time.OffsetDateTime; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * An order for a pets from the pet store + */ +@Schema(description = "An order for a pets from the pet store") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Order { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_PET_ID = "petId"; + @SerializedName(SERIALIZED_NAME_PET_ID) + @javax.annotation.Nullable + private Long petId; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; + @SerializedName(SERIALIZED_NAME_SHIP_DATE) + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_COMPLETE = "complete"; + @SerializedName(SERIALIZED_NAME_COMPLETE) + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public Long getPetId() { + return petId; + } + + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public OffsetDateTime getShipDate() { + return shipDate; + } + + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "Order Status") + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public Boolean getComplete() { + return complete; + } + + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, order.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "petId", "quantity", "shipDate", "status", "complete")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Order + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Order.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Order' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Order.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Order value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Order read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Order instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Order given an JSON string + * + * @param jsonString JSON string + * @return An instance of Order + * @throws IOException if the JSON string is invalid with respect to Order + */ + public static Order fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Order.class); + } + + /** + * Convert an instance of Order to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..9b632594dec8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,545 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A pet for sale in the pet store + */ +@Schema(description = "A pet for sale in the pet store") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pet { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @Deprecated + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + @Schema(example = "doggie", requiredMode = Schema.RequiredMode.REQUIRED, description = "") + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "") + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable 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 + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + @Deprecated + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "pet status in the store") + + public StatusEnum getStatus() { + return status; + } + + @Deprecated + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, pet.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Pet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Pet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Pet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Pet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Pet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Pet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Pet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Pet given an JSON string + * + * @param jsonString JSON string + * @return An instance of Pet + * @throws IOException if the JSON string is invalid with respect to Pet + */ + public static Pet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Pet.class); + } + + /** + * Convert an instance of Pet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..4f7dc76635ff --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,315 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A tag for a pet + */ +@Schema(description = "A tag for a pet") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Tag { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Tag + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Tag.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Tag' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Tag value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Tag read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Tag given an JSON string + * + * @param jsonString JSON string + * @return An instance of Tag + * @throws IOException if the JSON string is invalid with respect to Tag + */ + public static Tag fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Tag.class); + } + + /** + * Convert an instance of Tag to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..7d4027bd4675 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,498 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * A User who is purchasing from the pet store + */ +@Schema(description = "A User who is purchasing from the pet store") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class User { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nullable + private String username; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nullable + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nullable + private String lastName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nullable + private String password; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nullable + private String phone; + + public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; + @SerializedName(SERIALIZED_NAME_USER_STATUS) + @javax.annotation.Nullable + private Integer userStatus; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "User Status") + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(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.additionalProperties, user.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, additionalProperties); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to User + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) && !jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!User.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'User' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(User.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, User value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public User read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of User given an JSON string + * + * @param jsonString JSON string + * @return An instance of User + * @throws IOException if the JSON string is invalid with respect to User + */ + public static User fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, User.class); + } + + /** + * Convert an instance of User to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..44e74f1cf98b --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,153 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + Pet response = api.addPet(pet); + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + Pet response = api.updatePet(pet); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.uploadFile(petId, additionalMetadata, _file); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..3ca20d0b210b --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,89 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = api.getOrderById(orderId); + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order order = null; + Order response = api.placeOrder(order); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..a46743c4435d --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,148 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * 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.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User user = null; + api.createUser(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List user = null; + api.createUsersWithArrayInput(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List user = null; + api.createUsersWithListInput(user); + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + api.deleteUser(username); + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + api.logoutUser(); + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User user = null; + api.updateUser(username, user); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..d8bc181fd88c --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..9a0879e2e4d4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..31e5bc8af327 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,89 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..96df06bd7fb4 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,93 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..a7b114f548fa --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..6f470a1bf992 --- /dev/null +++ b/samples/client/petstore/java/okhttp-swagger2/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,104 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/okhttp/.github/workflows/maven.yml b/samples/client/petstore/java/okhttp/.github/workflows/maven.yml new file mode 100644 index 000000000000..460f78bfd1b2 --- /dev/null +++ b/samples/client/petstore/java/okhttp/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + +name: Java CI with Maven + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build: + name: Build OpenAPI Petstore + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/samples/client/petstore/java/okhttp/.gitignore b/samples/client/petstore/java/okhttp/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/okhttp/.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/client/petstore/java/okhttp/.openapi-generator-ignore b/samples/client/petstore/java/okhttp/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/okhttp/.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/client/petstore/java/okhttp/.openapi-generator/FILES b/samples/client/petstore/java/okhttp/.openapi-generator/FILES new file mode 100644 index 000000000000..b42e6848a138 --- /dev/null +++ b/samples/client/petstore/java/okhttp/.openapi-generator/FILES @@ -0,0 +1,401 @@ +.github/workflows/maven.yml +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/AdditionalPropertiesClass.md +docs/AllOfModelArrayAnyOf.md +docs/AllOfModelArrayAnyOfAllOfAttributes.md +docs/AllOfModelArrayAnyOfAllOfAttributesC.md +docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md +docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md +docs/AllOfRefToDouble.md +docs/AllOfRefToFloat.md +docs/AllOfRefToLong.md +docs/Animal.md +docs/AnotherFakeApi.md +docs/Apple.md +docs/AppleReq.md +docs/ArrayAnyOf.md +docs/ArrayDefault.md +docs/ArrayOfArrayOfNumberOnly.md +docs/ArrayOfInlineAllOf.md +docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md +docs/ArrayOfNumberOnly.md +docs/ArrayOneOf.md +docs/ArrayTest.md +docs/Banana.md +docs/BananaReq.md +docs/BasquePig.md +docs/Capitalization.md +docs/Cat.md +docs/Category.md +docs/ClassModel.md +docs/Client.md +docs/ComplexQuadrilateral.md +docs/DanishPig.md +docs/DefaultApi.md +docs/DeprecatedObject.md +docs/Dog.md +docs/Drawing.md +docs/EnumArrays.md +docs/EnumClass.md +docs/EnumStringDiscriminator.md +docs/EnumTest.md +docs/EquilateralTriangle.md +docs/FakeAnyOfWIthSameErasureGet200Response.md +docs/FakeApi.md +docs/FakeClassnameTags123Api.md +docs/FakeOneOfWIthSameErasureGet200Response.md +docs/FakeRefParameterPetIdParameter.md +docs/FileSchemaTestClass.md +docs/Foo.md +docs/FooGetDefaultResponse.md +docs/FormatTest.md +docs/FreeFormObjectTestClass.md +docs/FreeFormObjectTestClassProperties.md +docs/Fruit.md +docs/FruitReq.md +docs/GmFruit.md +docs/GrandparentAnimal.md +docs/HasOnlyReadOnly.md +docs/HealthCheckResult.md +docs/IsoscelesTriangle.md +docs/Mammal.md +docs/MammalAnyof.md +docs/MapTest.md +docs/MixedPropertiesAndAdditionalPropertiesClass.md +docs/Model200Response.md +docs/ModelApiResponse.md +docs/ModelFile.md +docs/ModelList.md +docs/ModelReturn.md +docs/ModelWithOneOfAnyOfProperties.md +docs/Name.md +docs/NestedArrayWithDefaultValues.md +docs/NewPet.md +docs/NewPetCategoryInlineAllof.md +docs/NewPetCategoryInlineAllofAllOfCategoryTag.md +docs/NullableClass.md +docs/NullableEnum.md +docs/NullableFieldsMapError.md +docs/NullableFieldsMapResponse.md +docs/NullableFieldsMapSuccess.md +docs/NullableFieldsValue.md +docs/NullableShape.md +docs/NumberOnly.md +docs/ObjectWithDeprecatedFields.md +docs/Order.md +docs/OuterComposite.md +docs/OuterEnum.md +docs/OuterEnumDefaultValue.md +docs/OuterEnumInteger.md +docs/OuterEnumIntegerDefaultValue.md +docs/ParentPet.md +docs/Pet.md +docs/PetApi.md +docs/PetComposition.md +docs/PetRef.md +docs/PetUsingAllOf.md +docs/PetWithRequiredTags.md +docs/Pig.md +docs/PropertyNameCollision.md +docs/Quadrilateral.md +docs/QuadrilateralInterface.md +docs/ReadOnlyFirst.md +docs/RequiredNullableBody.md +docs/Scalar.md +docs/ScalarAnyOf.md +docs/ScaleneTriangle.md +docs/Shape.md +docs/ShapeInterface.md +docs/ShapeOrNull.md +docs/SimpleQuadrilateral.md +docs/SpecialModelName.md +docs/StoreApi.md +docs/Tag.md +docs/TestInlineFreeformAdditionalPropertiesRequest.md +docs/Triangle.md +docs/TriangleInterface.md +docs/User.md +docs/UserApi.md +docs/Value.md +docs/ValuesApi.md +docs/Variable.md +docs/Whale.md +docs/Zebra.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/AndroidManifest.xml +src/main/java/org/openapitools/client/ApiCallback.java +src/main/java/org/openapitools/client/ApiClient.java +src/main/java/org/openapitools/client/ApiException.java +src/main/java/org/openapitools/client/ApiResponse.java +src/main/java/org/openapitools/client/Configuration.java +src/main/java/org/openapitools/client/JSON.java +src/main/java/org/openapitools/client/Pair.java +src/main/java/org/openapitools/client/ProgressRequestBody.java +src/main/java/org/openapitools/client/ProgressResponseBody.java +src/main/java/org/openapitools/client/ServerConfiguration.java +src/main/java/org/openapitools/client/ServerVariable.java +src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/AnotherFakeApi.java +src/main/java/org/openapitools/client/api/DefaultApi.java +src/main/java/org/openapitools/client/api/FakeApi.java +src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +src/main/java/org/openapitools/client/api/PetApi.java +src/main/java/org/openapitools/client/api/StoreApi.java +src/main/java/org/openapitools/client/api/UserApi.java +src/main/java/org/openapitools/client/api/ValuesApi.java +src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +src/main/java/org/openapitools/client/auth/Authentication.java +src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/OAuth.java +src/main/java/org/openapitools/client/auth/OAuthFlow.java +src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java +src/main/java/org/openapitools/client/auth/RetryingOAuth.java +src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java +src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java +src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +src/main/java/org/openapitools/client/model/AllOfRefToLong.java +src/main/java/org/openapitools/client/model/Animal.java +src/main/java/org/openapitools/client/model/Apple.java +src/main/java/org/openapitools/client/model/AppleReq.java +src/main/java/org/openapitools/client/model/ArrayAnyOf.java +src/main/java/org/openapitools/client/model/ArrayDefault.java +src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java +src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java +src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +src/main/java/org/openapitools/client/model/ArrayOneOf.java +src/main/java/org/openapitools/client/model/ArrayTest.java +src/main/java/org/openapitools/client/model/Banana.java +src/main/java/org/openapitools/client/model/BananaReq.java +src/main/java/org/openapitools/client/model/BasquePig.java +src/main/java/org/openapitools/client/model/Capitalization.java +src/main/java/org/openapitools/client/model/Cat.java +src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ClassModel.java +src/main/java/org/openapitools/client/model/Client.java +src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +src/main/java/org/openapitools/client/model/DanishPig.java +src/main/java/org/openapitools/client/model/DeprecatedObject.java +src/main/java/org/openapitools/client/model/Dog.java +src/main/java/org/openapitools/client/model/Drawing.java +src/main/java/org/openapitools/client/model/EnumArrays.java +src/main/java/org/openapitools/client/model/EnumClass.java +src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java +src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/EquilateralTriangle.java +src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java +src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java +src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java +src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +src/main/java/org/openapitools/client/model/FormatTest.java +src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java +src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java +src/main/java/org/openapitools/client/model/Fruit.java +src/main/java/org/openapitools/client/model/FruitReq.java +src/main/java/org/openapitools/client/model/GmFruit.java +src/main/java/org/openapitools/client/model/GrandparentAnimal.java +src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +src/main/java/org/openapitools/client/model/HealthCheckResult.java +src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +src/main/java/org/openapitools/client/model/Mammal.java +src/main/java/org/openapitools/client/model/MammalAnyof.java +src/main/java/org/openapitools/client/model/MapTest.java +src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +src/main/java/org/openapitools/client/model/Model200Response.java +src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/ModelFile.java +src/main/java/org/openapitools/client/model/ModelList.java +src/main/java/org/openapitools/client/model/ModelReturn.java +src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java +src/main/java/org/openapitools/client/model/Name.java +src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java +src/main/java/org/openapitools/client/model/NewPet.java +src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java +src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java +src/main/java/org/openapitools/client/model/NullableClass.java +src/main/java/org/openapitools/client/model/NullableEnum.java +src/main/java/org/openapitools/client/model/NullableFieldsMapError.java +src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java +src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java +src/main/java/org/openapitools/client/model/NullableFieldsValue.java +src/main/java/org/openapitools/client/model/NullableShape.java +src/main/java/org/openapitools/client/model/NumberOnly.java +src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +src/main/java/org/openapitools/client/model/Order.java +src/main/java/org/openapitools/client/model/OuterComposite.java +src/main/java/org/openapitools/client/model/OuterEnum.java +src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java +src/main/java/org/openapitools/client/model/OuterEnumInteger.java +src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java +src/main/java/org/openapitools/client/model/ParentPet.java +src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/PetComposition.java +src/main/java/org/openapitools/client/model/PetRef.java +src/main/java/org/openapitools/client/model/PetUsingAllOf.java +src/main/java/org/openapitools/client/model/PetWithRequiredTags.java +src/main/java/org/openapitools/client/model/Pig.java +src/main/java/org/openapitools/client/model/PropertyNameCollision.java +src/main/java/org/openapitools/client/model/Quadrilateral.java +src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +src/main/java/org/openapitools/client/model/RequiredNullableBody.java +src/main/java/org/openapitools/client/model/Scalar.java +src/main/java/org/openapitools/client/model/ScalarAnyOf.java +src/main/java/org/openapitools/client/model/ScaleneTriangle.java +src/main/java/org/openapitools/client/model/Shape.java +src/main/java/org/openapitools/client/model/ShapeInterface.java +src/main/java/org/openapitools/client/model/ShapeOrNull.java +src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +src/main/java/org/openapitools/client/model/SpecialModelName.java +src/main/java/org/openapitools/client/model/Tag.java +src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +src/main/java/org/openapitools/client/model/Triangle.java +src/main/java/org/openapitools/client/model/TriangleInterface.java +src/main/java/org/openapitools/client/model/User.java +src/main/java/org/openapitools/client/model/Value.java +src/main/java/org/openapitools/client/model/Variable.java +src/main/java/org/openapitools/client/model/Whale.java +src/main/java/org/openapitools/client/model/Zebra.java +src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java +src/test/java/org/openapitools/client/api/DefaultApiTest.java +src/test/java/org/openapitools/client/api/FakeApiTest.java +src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/api/ValuesApiTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java +src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java +src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java +src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java +src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java +src/test/java/org/openapitools/client/model/AnimalTest.java +src/test/java/org/openapitools/client/model/AppleReqTest.java +src/test/java/org/openapitools/client/model/AppleTest.java +src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java +src/test/java/org/openapitools/client/model/ArrayDefaultTest.java +src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java +src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java +src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayOneOfTest.java +src/test/java/org/openapitools/client/model/ArrayTestTest.java +src/test/java/org/openapitools/client/model/BananaReqTest.java +src/test/java/org/openapitools/client/model/BananaTest.java +src/test/java/org/openapitools/client/model/BasquePigTest.java +src/test/java/org/openapitools/client/model/CapitalizationTest.java +src/test/java/org/openapitools/client/model/CatTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ClassModelTest.java +src/test/java/org/openapitools/client/model/ClientTest.java +src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java +src/test/java/org/openapitools/client/model/DanishPigTest.java +src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java +src/test/java/org/openapitools/client/model/DogTest.java +src/test/java/org/openapitools/client/model/DrawingTest.java +src/test/java/org/openapitools/client/model/EnumArraysTest.java +src/test/java/org/openapitools/client/model/EnumClassTest.java +src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java +src/test/java/org/openapitools/client/model/EnumTestTest.java +src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java +src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java +src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java +src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java +src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java +src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java +src/test/java/org/openapitools/client/model/FooTest.java +src/test/java/org/openapitools/client/model/FormatTestTest.java +src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java +src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java +src/test/java/org/openapitools/client/model/FruitReqTest.java +src/test/java/org/openapitools/client/model/FruitTest.java +src/test/java/org/openapitools/client/model/GmFruitTest.java +src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java +src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java +src/test/java/org/openapitools/client/model/HealthCheckResultTest.java +src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java +src/test/java/org/openapitools/client/model/MammalAnyofTest.java +src/test/java/org/openapitools/client/model/MammalTest.java +src/test/java/org/openapitools/client/model/MapTestTest.java +src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java +src/test/java/org/openapitools/client/model/Model200ResponseTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/ModelFileTest.java +src/test/java/org/openapitools/client/model/ModelListTest.java +src/test/java/org/openapitools/client/model/ModelReturnTest.java +src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java +src/test/java/org/openapitools/client/model/NameTest.java +src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java +src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java +src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java +src/test/java/org/openapitools/client/model/NewPetTest.java +src/test/java/org/openapitools/client/model/NullableClassTest.java +src/test/java/org/openapitools/client/model/NullableEnumTest.java +src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java +src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java +src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java +src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java +src/test/java/org/openapitools/client/model/NullableShapeTest.java +src/test/java/org/openapitools/client/model/NumberOnlyTest.java +src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/OuterCompositeTest.java +src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java +src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java +src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java +src/test/java/org/openapitools/client/model/OuterEnumTest.java +src/test/java/org/openapitools/client/model/ParentPetTest.java +src/test/java/org/openapitools/client/model/PetCompositionTest.java +src/test/java/org/openapitools/client/model/PetRefTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java +src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java +src/test/java/org/openapitools/client/model/PigTest.java +src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java +src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java +src/test/java/org/openapitools/client/model/QuadrilateralTest.java +src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java +src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java +src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java +src/test/java/org/openapitools/client/model/ScalarTest.java +src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java +src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java +src/test/java/org/openapitools/client/model/ShapeOrNullTest.java +src/test/java/org/openapitools/client/model/ShapeTest.java +src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java +src/test/java/org/openapitools/client/model/SpecialModelNameTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java +src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java +src/test/java/org/openapitools/client/model/TriangleTest.java +src/test/java/org/openapitools/client/model/UserTest.java +src/test/java/org/openapitools/client/model/ValueTest.java +src/test/java/org/openapitools/client/model/VariableTest.java +src/test/java/org/openapitools/client/model/WhaleTest.java +src/test/java/org/openapitools/client/model/ZebraTest.java diff --git a/samples/client/petstore/java/okhttp/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/petstore/java/okhttp/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp/.travis.yml b/samples/client/petstore/java/okhttp/.travis.yml new file mode 100644 index 000000000000..1b6741c083c7 --- /dev/null +++ b/samples/client/petstore/java/okhttp/.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/client/petstore/java/okhttp/README.md b/samples/client/petstore/java/okhttp/README.md new file mode 100644 index 000000000000..4d341765fa52 --- /dev/null +++ b/samples/client/petstore/java/okhttp/README.md @@ -0,0 +1,337 @@ +# petstore-okhttp + +OpenAPI Petstore +- API version: 1.0.0 + - Generator version: 7.24.0-SNAPSHOT + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + org.openapitools + petstore-okhttp + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'petstore-okhttp' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp:1.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/petstore-okhttp-1.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.model.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**getParameterArrayNumber**](docs/AnotherFakeApi.md#getParameterArrayNumber) | **GET** /fake/parameter-array-number | parameter array number default value +*AnotherFakeApi* | [**getParameterStringNumber**](docs/AnotherFakeApi.md#getParameterStringNumber) | **GET** /fake/parameter-string-number | parameter string number +*DefaultApi* | [**fakeAnyOfWIthSameErasureGet**](docs/DefaultApi.md#fakeAnyOfWIthSameErasureGet) | **GET** /fake/anyOfWIthSameErasure | +*DefaultApi* | [**fakeFreeFormQueryParametersGet**](docs/DefaultApi.md#fakeFreeFormQueryParametersGet) | **GET** /fake/free-form-query-parameters | +*DefaultApi* | [**fakeOneOfWIthSameErasureGet**](docs/DefaultApi.md#fakeOneOfWIthSameErasureGet) | **GET** /fake/oneOfWIthSameErasure | +*DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo | +*FakeApi* | [**fakeGetFreeFormObjectGet**](docs/FakeApi.md#fakeGetFreeFormObjectGet) | **GET** /fake/get-free-form-object | +*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +*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* | [**fakeRefParameter**](docs/FakeApi.md#fakeRefParameter) | **POST** /fake/pet/{petId}/reference/parameter | fake reference parameter +*FakeApi* | [**fakeRequiredNullableBodyGet**](docs/FakeApi.md#fakeRequiredNullableBodyGet) | **GET** /fake/required-nullable-body | fields in the response body, required and nullable are both true +*FakeApi* | [**fakeUploadRefRequestBodies**](docs/FakeApi.md#fakeUploadRefRequestBodies) | **POST** /fake/pet/{petId}/uploadImage | fake reference parameter +*FakeApi* | [**getFakeArrayofenums**](docs/FakeApi.md#getFakeArrayofenums) | **GET** /fake/array-of-enums | Array of Enums +*FakeApi* | [**getFakeHealth**](docs/FakeApi.md#getFakeHealth) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**getParameterNameMapping**](docs/FakeApi.md#getParameterNameMapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test +*FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +*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 +*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testInlineFreeformAdditionalProperties**](docs/FakeApi.md#testInlineFreeformAdditionalProperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testNullableRequiredFieldsAnyOf**](docs/FakeApi.md#testNullableRequiredFieldsAnyOf) | **GET** /fake/nullable-required-fields-anyof | test anyOf with map of objects containing nullable required fields +*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | +*FakeApi* | [**testStringMapReference**](docs/FakeApi.md#testStringMapReference) | **POST** /fake/stringMap-reference | test referenced string map +*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user +*ValuesApi* | [**getSomeValues**](docs/ValuesApi.md#getSomeValues) | **GET** /values | Get some primitive variable values + + +## Documentation for Models + + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AllOfModelArrayAnyOf](docs/AllOfModelArrayAnyOf.md) + - [AllOfModelArrayAnyOfAllOfAttributes](docs/AllOfModelArrayAnyOfAllOfAttributes.md) + - [AllOfModelArrayAnyOfAllOfAttributesC](docs/AllOfModelArrayAnyOfAllOfAttributesC.md) + - [AllOfModelArrayAnyOfAllOfLinkListColumn1](docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md) + - [AllOfModelArrayAnyOfAllOfLinkListColumn1Value](docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md) + - [AllOfRefToDouble](docs/AllOfRefToDouble.md) + - [AllOfRefToFloat](docs/AllOfRefToFloat.md) + - [AllOfRefToLong](docs/AllOfRefToLong.md) + - [Animal](docs/Animal.md) + - [Apple](docs/Apple.md) + - [AppleReq](docs/AppleReq.md) + - [ArrayAnyOf](docs/ArrayAnyOf.md) + - [ArrayDefault](docs/ArrayDefault.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfInlineAllOf](docs/ArrayOfInlineAllOf.md) + - [ArrayOfInlineAllOfArrayAllofDogPropertyInner](docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayOneOf](docs/ArrayOneOf.md) + - [ArrayTest](docs/ArrayTest.md) + - [Banana](docs/Banana.md) + - [BananaReq](docs/BananaReq.md) + - [BasquePig](docs/BasquePig.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [Category](docs/Category.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [ComplexQuadrilateral](docs/ComplexQuadrilateral.md) + - [DanishPig](docs/DanishPig.md) + - [DeprecatedObject](docs/DeprecatedObject.md) + - [Dog](docs/Dog.md) + - [Drawing](docs/Drawing.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumStringDiscriminator](docs/EnumStringDiscriminator.md) + - [EnumTest](docs/EnumTest.md) + - [EquilateralTriangle](docs/EquilateralTriangle.md) + - [FakeAnyOfWIthSameErasureGet200Response](docs/FakeAnyOfWIthSameErasureGet200Response.md) + - [FakeOneOfWIthSameErasureGet200Response](docs/FakeOneOfWIthSameErasureGet200Response.md) + - [FakeRefParameterPetIdParameter](docs/FakeRefParameterPetIdParameter.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) + - [FormatTest](docs/FormatTest.md) + - [FreeFormObjectTestClass](docs/FreeFormObjectTestClass.md) + - [FreeFormObjectTestClassProperties](docs/FreeFormObjectTestClassProperties.md) + - [Fruit](docs/Fruit.md) + - [FruitReq](docs/FruitReq.md) + - [GmFruit](docs/GmFruit.md) + - [GrandparentAnimal](docs/GrandparentAnimal.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [HealthCheckResult](docs/HealthCheckResult.md) + - [IsoscelesTriangle](docs/IsoscelesTriangle.md) + - [Mammal](docs/Mammal.md) + - [MammalAnyof](docs/MammalAnyof.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [ModelFile](docs/ModelFile.md) + - [ModelList](docs/ModelList.md) + - [ModelReturn](docs/ModelReturn.md) + - [ModelWithOneOfAnyOfProperties](docs/ModelWithOneOfAnyOfProperties.md) + - [Name](docs/Name.md) + - [NestedArrayWithDefaultValues](docs/NestedArrayWithDefaultValues.md) + - [NewPet](docs/NewPet.md) + - [NewPetCategoryInlineAllof](docs/NewPetCategoryInlineAllof.md) + - [NewPetCategoryInlineAllofAllOfCategoryTag](docs/NewPetCategoryInlineAllofAllOfCategoryTag.md) + - [NullableClass](docs/NullableClass.md) + - [NullableEnum](docs/NullableEnum.md) + - [NullableFieldsMapError](docs/NullableFieldsMapError.md) + - [NullableFieldsMapResponse](docs/NullableFieldsMapResponse.md) + - [NullableFieldsMapSuccess](docs/NullableFieldsMapSuccess.md) + - [NullableFieldsValue](docs/NullableFieldsValue.md) + - [NullableShape](docs/NullableShape.md) + - [NumberOnly](docs/NumberOnly.md) + - [ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md) + - [OuterEnumInteger](docs/OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) + - [ParentPet](docs/ParentPet.md) + - [Pet](docs/Pet.md) + - [PetComposition](docs/PetComposition.md) + - [PetRef](docs/PetRef.md) + - [PetUsingAllOf](docs/PetUsingAllOf.md) + - [PetWithRequiredTags](docs/PetWithRequiredTags.md) + - [Pig](docs/Pig.md) + - [PropertyNameCollision](docs/PropertyNameCollision.md) + - [Quadrilateral](docs/Quadrilateral.md) + - [QuadrilateralInterface](docs/QuadrilateralInterface.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [RequiredNullableBody](docs/RequiredNullableBody.md) + - [Scalar](docs/Scalar.md) + - [ScalarAnyOf](docs/ScalarAnyOf.md) + - [ScaleneTriangle](docs/ScaleneTriangle.md) + - [Shape](docs/Shape.md) + - [ShapeInterface](docs/ShapeInterface.md) + - [ShapeOrNull](docs/ShapeOrNull.md) + - [SimpleQuadrilateral](docs/SimpleQuadrilateral.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) + - [Triangle](docs/Triangle.md) + - [TriangleInterface](docs/TriangleInterface.md) + - [User](docs/User.md) + - [Value](docs/Value.md) + - [Variable](docs/Variable.md) + - [Whale](docs/Whale.md) + - [Zebra](docs/Zebra.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +### bearer_test + +- **Type**: HTTP Bearer Token authentication (JWT) + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/okhttp/api/openapi.yaml b/samples/client/petstore/java/okhttp/api/openapi.yaml new file mode 100644 index 000000000000..ec6b0d631c06 --- /dev/null +++ b/samples/client/petstore/java/okhttp/api/openapi.yaml @@ -0,0 +1,3332 @@ +openapi: 3.0.0 +info: + description: "This spec is mainly for testing Petstore server and contains fake\ + \ endpoints, models. Please do not use this for any other purpose. Special characters:\ + \ \" \\" + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- description: petstore server + url: "http://{server}.swagger.io:{port}/v2" + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: "https://localhost:8080/{version}" + variables: + version: + default: v2 + enum: + - v1 + - v2 +- description: The local server without variables + url: https://127.0.0.1/no_variable +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: "#/components/schemas/_foo_get_default_response" + description: response + x-accepts: + - application/json + /pet: + post: + description: "" + operationId: addPet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + put: + description: "" + operationId: updatePet + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-content-type: application/json + x-accepts: + - application/json + servers: + - url: http://petstore.swagger.io/v2 + - url: http://path-server-test.petstore.local/v2 + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + default: [] + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/findByTags: + get: + deprecated: true + description: "Multiple tags can be provided with comma separated strings. Use\ + \ tag1, tag2, tag3 for testing." + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + default: [] + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + application/json: + schema: + default: [] + items: + $ref: "#/components/schemas/Pet" + type: array + description: successful operation + "400": + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: + - application/json + - application/xml + /pet/{petId}: + delete: + description: "" + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "400": + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: + - application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Pet" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: + - application/json + - application/xml + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithForm_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + - description: Content type header parameter + explode: false + in: header + name: Content-Type + required: false + schema: + type: string + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + default: [] + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: + - application/json + /store/order: + post: + description: "" + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-content-type: application/json + x-accepts: + - application/json + - application/xml + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: + - application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + description: successful operation + "400": + description: Invalid ID supplied + "404": + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: + - application/json + - application/xml + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithArray: + post: + description: "" + operationId: createUsersWithArrayInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/createWithList: + post: + description: "" + operationId: createUsersWithListInput + requestBody: + $ref: "#/components/requestBodies/UserArray" + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /user/login: + get: + description: "" + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + "400": + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: + - application/json + - application/xml + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: + - application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Delete user + tags: + - user + x-accepts: + - application/json + get: + description: "" + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + description: successful operation + "400": + description: Invalid username supplied + "404": + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: + - application/json + - application/xml + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + summary: Updated user + tags: + - user + x-content-type: application/json + x-accepts: + - application/json + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-content-type: application/json + x-accepts: + - application/json + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + explode: true + in: query + name: required_string_group + required: true + schema: + type: integer + style: form + - description: Required Boolean in group parameters + explode: false + in: header + name: required_boolean_group + required: true + schema: + type: boolean + style: simple + - description: Required Integer in group parameters + explode: true + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + style: form + - description: String in group parameters + explode: true + in: query + name: string_group + required: false + schema: + type: integer + style: form + - description: Boolean in group parameters + explode: false + in: header + name: boolean_group + required: false + schema: + type: boolean + style: simple + - description: Integer in group parameters + explode: true + in: query + name: int64_group + required: false + schema: + format: int64 + type: integer + style: form + responses: + "400": + description: Something wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + x-accepts: + - application/json + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + required: false + schema: + default: [] + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + default: [] + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_integer + required: false + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_double + required: false + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + style: form + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEnumParameters_request" + responses: + "400": + description: Invalid request + "404": + description: Not found + summary: To test enum parameters + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test "client" model + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testEndpointParameters_request" + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterNumber" + description: Input number as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterNumber" + description: Output number + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterString" + description: Input string as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterString" + description: Output string + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Input boolean as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Output boolean + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterComposite" + description: Input composite as post body + responses: + "200": + content: + '*/*': + schema: + $ref: "#/components/schemas/OuterComposite" + description: Output composite + tags: + - fake + x-content-type: application/json + x-accepts: + - '*/*' + /fake/jsonFormData: + get: + description: "" + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/testJsonFormData_request" + responses: + "200": + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-content-type: application/x-www-form-urlencoded + x-accepts: + - application/json + /fake/additionalProperties-reference: + post: + description: "" + operationId: testAdditionalPropertiesReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FreeFormObject" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/oneOfWIthSameErasure: + get: + description: "Test route, this shouldn't cause a compiler error" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/_fake_oneOfWIthSameErasure_get_200_response" + description: successful response + x-accepts: + - application/json + /fake/nullable-required-fields-anyof: + get: + description: "Tests that anyOf deserialization works when object values contain\ + \ required fields that are nullable (e.g. Record)" + operationId: testNullableRequiredFieldsAnyOf + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/NullableFieldsMapResponse" + description: successful operation + summary: test anyOf with map of objects containing nullable required fields + tags: + - fake + x-accepts: + - application/json + /fake/anyOfWIthSameErasure: + get: + description: "Test route, this shouldn't cause a compiler error" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/_fake_anyOfWIthSameErasure_get_200_response" + description: successful response + x-accepts: + - application/json + /fake/stringMap-reference: + post: + description: "" + operationId: testStringMapReference + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/MapOfString" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced string map + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/inline-additionalProperties: + post: + description: "" + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + default: [] + type: object + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/inline-freeform-additionalProperties: + post: + description: "" + operationId: testInlineFreeformAdditionalProperties + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/testInlineFreeformAdditionalProperties_request" + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline free-form additionalProperties + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - explode: true + in: query + name: query + required: true + schema: + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: "#/components/requestBodies/Client" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-content-type: application/json + x-accepts: + - application/json + /fake/body-with-file-schema: + put: + description: "For this test, the body for this request much reference a schema\ + \ named `File`." + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FileSchemaTestClass" + required: true + responses: + "200": + description: Success + tags: + - fake + x-content-type: application/json + x-accepts: + - application/json + /fake/get-free-form-object: + get: + description: Get a free form object or Json string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FreeFormObjectTestClass" + description: Success + tags: + - fake + x-accepts: + - application/json + /fake/free-form-query-parameters: + get: + parameters: + - explode: true + in: query + name: fixed + required: false + schema: + type: string + style: form + - explode: true + in: query + name: free-form + required: false + schema: + type: object + style: form + responses: + "200": + description: OK + x-accepts: + - application/json + /fake/test-query-parameters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: true + in: query + name: pipe + required: true + schema: + default: [] + items: + type: string + type: array + style: form + - explode: false + in: query + name: ioutil + required: true + schema: + default: [] + items: + type: string + type: array + style: form + - explode: false + in: query + name: http + required: true + schema: + default: [] + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + default: [] + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + default: [] + items: + type: string + type: array + style: form + responses: + "200": + description: Success + tags: + - fake + x-accepts: + - application/json + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: "" + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFileWithRequiredFile_request" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-content-type: multipart/form-data + x-accepts: + - application/json + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/HealthCheckResult" + description: The instance started successfully + summary: Health check endpoint + 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 + /fake/parameter-name-mapping: + get: + operationId: getParameterNameMapping + parameters: + - description: _type + explode: false + in: header + name: _type + required: true + schema: + format: int64 + type: integer + style: simple + - description: type + explode: true + in: query + name: type + required: true + schema: + type: string + style: form + - description: type_ + explode: false + in: header + name: type_ + required: true + schema: + type: string + style: simple + responses: + "200": + description: OK + summary: parameter name mapping test + tags: + - fake + x-accepts: + - application/json + /fake/parameter-string-number: + get: + operationId: getParameterStringNumber + parameters: + - description: string number + explode: false + in: header + name: string_number + required: true + schema: + format: number + type: string + style: simple + responses: + "200": + description: OK + summary: parameter string number + tags: + - another_fake + x-accepts: + - application/json + /fake/parameter-array-number: + get: + operationId: getParameterArrayNumber + parameters: + - description: array integer + explode: false + in: header + name: array + required: true + schema: + default: + - 1 + items: + type: integer + type: array + style: simple + responses: + "200": + description: OK + summary: parameter array number default value + tags: + - another_fake + x-accepts: + - application/json + /fake/pet/{petId}/uploadImage: + post: + description: "" + operationId: fake-upload-ref-request-bodies + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: "#/components/requestBodies/upload_body" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: fake reference parameter + tags: + - fake + x-content-type: multipart/form-data + x-accepts: + - application/json + /fake/pet/{petId}/reference/parameter: + post: + description: "" + operationId: fake-ref-parameter + parameters: + - description: to test oneOf in parameter $ref + explode: false + in: path + name: petId + required: true + schema: + $ref: "#/components/schemas/fake_ref_parameter_petId_parameter" + style: simple + responses: + "200": + description: successful operation + summary: fake reference parameter + tags: + - fake + x-accepts: + - application/json + /values: + get: + description: "" + operationId: getSomeValues + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Variable" + description: successful operation + "400": + description: Invalid Value + summary: Get some primitive variable values + tags: + - values + x-accepts: + - application/json + /internal/only: + get: + description: "" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/Variable" + description: successful operation + "400": + description: Invalid Value + summary: internal only + tags: + - values + x-internal: true + x-accepts: + - application/json + /fake/required-nullable-body: + get: + description: "" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/RequiredNullableBody" + description: success + summary: "fields in the response body, required and nullable are both true" + tags: + - fake + x-accepts: + - application/json +components: + parameters: + pet_id: + description: to test oneOf in parameter $ref + explode: false + in: path + name: petId + required: true + schema: + $ref: "#/components/schemas/fake_ref_parameter_petId_parameter" + style: simple + requestBodies: + upload_body: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/uploadFile_request" + UserArray: + content: + application/json: + examples: + simple-list: + description: Should not get into code examples + summary: Simple list example + value: + - username: foo + - username: bar + schema: + default: [] + items: + $ref: "#/components/schemas/User" + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + Pet: + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string + Order: + example: + id: 0 + petId: 6 + quantity: 1 + shipDate: 2020-02-02T20:20:20.000222Z + status: placed + complete: false + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + example: 2020-02-02T20:20:20.000222Z + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + id: 6 + name: default-name + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + id: 0 + username: username + firstName: firstName + lastName: lastName + email: email + password: password + phone: phone + userStatus: 6 + objectWithNoDeclaredProps: "{}" + objectWithNoDeclaredPropsNullable: "{}" + anyTypeProp: "" + anyTypePropNullable: "" + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + objectWithNoDeclaredProps: + description: test code generation for objects Value must be a map of strings + to values. It cannot be the 'null' value. + type: object + objectWithNoDeclaredPropsNullable: + description: test code generation for nullable objects. Value must be a + map of strings to values or the 'null' value. + nullable: true + type: object + anyTypeProp: + description: "test code generation for any type Here the 'type' attribute\ + \ is not specified, which means the value can be anything, including the\ + \ null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389" + anyTypePropNullable: + description: "test code generation for any type Here the 'type' attribute\ + \ is not specified, which means the value can be anything, including the\ + \ null value, string, number, boolean, array or object. The 'nullable'\ + \ attribute does not change the allowed values." + nullable: true + type: object + xml: + name: User + Tag: + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + id: 0 + category: + id: 6 + name: default-name + name: doggie + photoUrls: + - photoUrls + - photoUrls + tags: + - id: 1 + name: name + - id: 1 + name: name + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + "123Number": + readOnly: true + type: integer + required: + - name + xml: + name: Name + "200_response": + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: "#/components/schemas/Animal" + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: "#/components/schemas/Animal" + - $ref: "#/components/schemas/Address" + - properties: + declawed: + type: boolean + type: object + Address: + additionalProperties: + type: integer + default: [] + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: "#/components/schemas/Animal" + type: array + format_test: + properties: + integer: + maximum: 100 + minimum: 10 + multipleOf: 2 + type: integer + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + multipleOf: 32.5 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + decimal: + format: number + type: string + string: + pattern: "/[a-z]/i" + type: string + byte: + format: byte + type: string + binary: + 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: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + uuid_with_default: + default: 11111111-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: "^\\d{10}$" + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. + pattern: "/^image_\\d{1,3}$/i" + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_integer_only: + enum: + - 2 + - -2 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: "#/components/schemas/OuterEnum" + outerEnumInteger: + $ref: "#/components/schemas/OuterEnumInteger" + outerEnumDefaultValue: + $ref: "#/components/schemas/OuterEnumDefaultValue" + outerEnumIntegerDefaultValue: + $ref: "#/components/schemas/OuterEnumIntegerDefaultValue" + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + default: [] + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + default: [] + type: object + default: [] + type: object + anytype_1: {} + map_with_undeclared_properties_anytype_1: + type: object + map_with_undeclared_properties_anytype_2: + properties: {} + type: object + map_with_undeclared_properties_anytype_3: + additionalProperties: true + default: [] + type: object + empty_map: + additionalProperties: false + description: "an object with no declared properties and no undeclared properties,\ + \ hence it's an empty map." + type: object + map_with_undeclared_properties_string: + additionalProperties: + type: string + default: [] + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: "#/components/schemas/Animal" + default: [] + type: object + type: object + List: + properties: + "123-list": + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + default: [] + type: object + default: [] + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + default: [] + type: object + direct_map: + additionalProperties: + type: boolean + default: [] + type: object + indirect_map: + additionalProperties: + type: boolean + default: [] + type: object + type: object + ArrayTest: + properties: + array_of_string: + default: [] + items: + type: string + type: array + array_array_of_integer: + default: [] + items: + default: [] + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + default: [] + items: + default: [] + items: + $ref: "#/components/schemas/ReadOnlyFirst" + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + default: [] + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + default: [] + items: + default: [] + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + default: [] + items: + enum: + - fish + - crab + type: string + type: array + type: object + FreeFormObject: + additionalProperties: true + default: [] + description: A schema consisting only of additional properties + type: object + MapOfString: + additionalProperties: + type: string + default: [] + description: A schema consisting only of additional properties of type string + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + - s + - S + nullable: true + type: string + OuterEnumInteger: + deprecated: true + enum: + - 0 + - 1 + - 2 + type: integer + OuterEnumDefaultValue: + default: placed + enum: + - placed + - approved + - delivered + type: string + OuterEnumIntegerDefaultValue: + default: 0 + enum: + - 0 + - 1 + - 2 + type: integer + OuterComposite: + example: + my_number: 0.8008281904610115 + my_string: my_string + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + default: [] + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: "#/components/schemas/File" + files: + default: [] + items: + $ref: "#/components/schemas/File" + type: array + type: object + FreeFormObjectTestClass: + example: + name: name + properties: FreeFormObjectTestClass_properties + properties: + name: + type: string + properties: + $ref: "#/components/schemas/FreeFormObjectTestClass_properties" + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + _special_model.name_: + type: string + xml: + name: "$special[model.name]" + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable + in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage + properties: + NullableMessage: + nullable: true + type: string + type: object + NullableClass: + additionalProperties: + nullable: true + type: object + properties: + integer_prop: + nullable: true + type: integer + number_prop: + nullable: true + type: number + boolean_prop: + nullable: true + type: boolean + string_prop: + nullable: true + type: string + date_prop: + format: date + nullable: true + type: string + datetime_prop: + format: date-time + nullable: true + type: string + array_nullable_prop: + items: + type: object + nullable: true + type: array + array_and_items_nullable_prop: + items: + nullable: true + type: object + nullable: true + type: array + array_items_nullable: + default: [] + items: + nullable: true + type: object + type: array + object_nullable_prop: + additionalProperties: + type: object + nullable: true + type: object + object_and_items_nullable_prop: + additionalProperties: + nullable: true + type: object + nullable: true + type: object + object_items_nullable: + additionalProperties: + nullable: true + type: object + default: [] + type: object + type: object + fruit: + additionalProperties: false + oneOf: + - $ref: "#/components/schemas/apple" + - $ref: "#/components/schemas/banana" + properties: + color: + type: string + apple: + nullable: true + properties: + cultivar: + pattern: "^[a-zA-Z\\s]*$" + type: string + origin: + pattern: "/^[A-Z\\s]*$/i" + type: string + type: object + banana: + properties: + lengthCm: + type: number + type: object + mammal: + discriminator: + propertyName: className + oneOf: + - $ref: "#/components/schemas/whale" + - $ref: "#/components/schemas/zebra" + - $ref: "#/components/schemas/Pig" + mammal_anyof: + anyOf: + - $ref: "#/components/schemas/whale" + - $ref: "#/components/schemas/zebra" + - $ref: "#/components/schemas/Pig" + discriminator: + propertyName: className + whale: + properties: + hasBaleen: + type: boolean + hasTeeth: + type: boolean + className: + type: string + required: + - className + type: object + zebra: + additionalProperties: true + properties: + type: + enum: + - plains + - mountain + - grevys + type: string + className: + type: string + required: + - className + type: object + Pig: + discriminator: + propertyName: className + oneOf: + - $ref: "#/components/schemas/BasquePig" + - $ref: "#/components/schemas/DanishPig" + BasquePig: + properties: + className: + type: string + required: + - className + type: object + DanishPig: + properties: + className: + type: string + required: + - className + type: object + gmFruit: + additionalProperties: false + anyOf: + - $ref: "#/components/schemas/apple" + - $ref: "#/components/schemas/banana" + properties: + color: + type: string + fruitReq: + additionalProperties: false + nullable: true + oneOf: + - $ref: "#/components/schemas/appleReq" + - $ref: "#/components/schemas/bananaReq" + appleReq: + additionalProperties: false + properties: + cultivar: + type: string + mealy: + type: boolean + required: + - cultivar + type: object + bananaReq: + additionalProperties: false + properties: + lengthCm: + type: number + sweet: + type: boolean + required: + - lengthCm + type: object + Drawing: + additionalProperties: + $ref: "#/components/schemas/fruit" + properties: + mainShape: + $ref: "#/components/schemas/Shape" + shapeOrNull: + $ref: "#/components/schemas/ShapeOrNull" + nullableShape: + $ref: "#/components/schemas/NullableShape" + shapes: + default: [] + items: + $ref: "#/components/schemas/Shape" + type: array + type: object + Shape: + discriminator: + propertyName: shapeType + oneOf: + - $ref: "#/components/schemas/Triangle" + - $ref: "#/components/schemas/Quadrilateral" + ShapeOrNull: + description: The value may be a shape or the 'null' value. This is introduced + in OAS schema >= 3.1. + discriminator: + propertyName: shapeType + nullable: true + oneOf: + - $ref: "#/components/schemas/Triangle" + - $ref: "#/components/schemas/Quadrilateral" + NullableShape: + description: The value may be a shape or the 'null' value. The 'nullable' attribute + was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema + >= 3.1. + discriminator: + propertyName: shapeType + nullable: true + oneOf: + - $ref: "#/components/schemas/Triangle" + - $ref: "#/components/schemas/Quadrilateral" + ShapeInterface: + properties: + shapeType: + type: string + required: + - shapeType + TriangleInterface: + properties: + triangleType: + type: string + required: + - triangleType + Triangle: + discriminator: + propertyName: triangleType + oneOf: + - $ref: "#/components/schemas/EquilateralTriangle" + - $ref: "#/components/schemas/IsoscelesTriangle" + - $ref: "#/components/schemas/ScaleneTriangle" + EquilateralTriangle: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/TriangleInterface" + IsoscelesTriangle: + additionalProperties: false + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/TriangleInterface" + ScaleneTriangle: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/TriangleInterface" + QuadrilateralInterface: + properties: + quadrilateralType: + type: string + required: + - quadrilateralType + Quadrilateral: + discriminator: + propertyName: quadrilateralType + oneOf: + - $ref: "#/components/schemas/SimpleQuadrilateral" + - $ref: "#/components/schemas/ComplexQuadrilateral" + SimpleQuadrilateral: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/QuadrilateralInterface" + ComplexQuadrilateral: + allOf: + - $ref: "#/components/schemas/ShapeInterface" + - $ref: "#/components/schemas/QuadrilateralInterface" + GrandparentAnimal: + discriminator: + propertyName: pet_type + properties: + pet_type: + type: string + required: + - pet_type + type: object + ParentPet: + allOf: + - $ref: "#/components/schemas/GrandparentAnimal" + type: object + ArrayOfEnums: + default: [] + items: + $ref: "#/components/schemas/OuterEnum" + type: array + DateTimeTest: + default: 2010-01-01T10:10:10.000111+01:00 + example: 2010-01-01T10:10:10.000111+01:00 + format: date-time + type: string + DeprecatedObject: + deprecated: true + properties: + name: + type: string + type: object + ObjectWithDeprecatedFields: + properties: + uuid: + type: string + id: + deprecated: true + type: number + deprecatedRef: + $ref: "#/components/schemas/DeprecatedObject" + bars: + default: [] + deprecated: true + items: + $ref: "#/components/schemas/Bar" + type: array + type: object + PetWithRequiredTags: + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + - tags + type: object + xml: + name: Pet + ArrayOfInlineAllOf: + properties: + id: + format: int64 + type: integer + name: + example: doggie + type: string + array_allof_dog_property: + default: [] + items: + $ref: "#/components/schemas/ArrayOfInlineAllOf_array_allof_dog_property_inner" + type: array + required: + - name + type: object + EnumStringDiscriminator: + description: An object to test discriminator of enum string + discriminator: + propertyName: enum_str_type + properties: + enum_str_type: + description: enum string type + enum: + - type_a + - type_b + type: string + required: + - enum_str_type + type: object + ArrayDefault: + properties: + WithDefaultEmptyBracket: + default: [] + items: + type: string + type: array + WithoutDefault: + default: [] + items: + type: string + type: array + Variable: + description: Value object + example: + name: variable_1 + value: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + properties: + name: + example: variable_1 + type: string + value: + $ref: "#/components/schemas/Value" + required: + - name + - value + Value: + oneOf: + - $ref: "#/components/schemas/Scalar" + - $ref: "#/components/schemas/Array" + Scalar: + description: Values of scalar type + oneOf: + - format: uuid + type: string + - maxLength: 1089 + type: string + - type: number + - type: boolean + ScalarAnyOf: + anyOf: + - format: uuid + type: string + - maxLength: 1089 + type: string + - type: number + - type: boolean + description: Values of scalar type using anyOf + Array: + default: [] + description: Values of array type + items: + $ref: "#/components/schemas/Scalar" + minItems: 1 + type: array + NewPet: + properties: + id: + format: int64 + type: integer + x-is-unique: true + category_inline_allof: + $ref: "#/components/schemas/NewPet_category_inline_allof" + category_allOf_ref: + allOf: + - $ref: "#/components/schemas/Category" + category_allOf_ref_description: + allOf: + - $ref: "#/components/schemas/Category" + description: | + Adding description to property using allOf + category_allOf_ref_description_readonly: + allOf: + - $ref: "#/components/schemas/Category" + description: | + Adding description to readonly property using allOf + readOnly: true + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + allOf: + - $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + PropertyNameCollision: + properties: + _type: + type: string + type: + type: string + type_: + type: string + type: object + x-internal: false + InteralOnly: + properties: + type: + type: string + type: object + x-internal: true + AllOfModelArrayAnyOf: + allOf: + - $ref: "#/components/schemas/Category" + - properties: + linkListColumn1: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_linkListColumn1" + attributes: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_attributes" + type: object + PetUsingAllOf: + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + allOf: + - $ref: "#/components/schemas/Category" + description: | + multi line description + 2nd line + last line + name: + example: doggie + type: string + photoUrls: + default: [] + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + default: [] + items: + allOf: + - $ref: "#/components/schemas/Tag" + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + PetComposition: + allOf: + - $ref: "#/components/schemas/Pet" + PetRef: + properties: + id: + $ref: "#/components/schemas/Pet/properties/id" + category: + $ref: "#/components/schemas/Pet/properties/category" + name: + $ref: "#/components/schemas/Pet/properties/name" + photoUrls: + $ref: "#/components/schemas/Pet/properties/photoUrls" + tags: + $ref: "#/components/schemas/Pet/properties/tags" + status: + $ref: "#/components/schemas/Pet/properties/status" + required: + - name + - photoUrls + type: object + xml: + name: Pet + ArrayOneOf: + oneOf: + - type: integer + - default: [] + items: + type: string + type: array + ArrayAnyOf: + anyOf: + - type: integer + - default: [] + items: + type: string + type: array + ModelWithOneOfAnyOfProperties: + properties: + oneof_prop: + $ref: "#/components/schemas/ArrayOneOf" + anyof_prop: + $ref: "#/components/schemas/ArrayAnyOf" + type: object + NullableEnum: + enum: + - custom + nullable: true + type: string + RequiredNullableBody: + allOf: + - $ref: "#/components/schemas/NullableClass" + - properties: + custom_ref_enum: + $ref: "#/components/schemas/NullableEnum" + custom_enum: + enum: + - custom + nullable: true + type: string + required: + - array_and_items_nullable_prop + - array_items_nullable + - array_nullable_prop + - boolean_prop + - custom_enum + - custom_ref_enum + - date_prop + - datetime_prop + - integer_prop + - number_prop + - object_and_items_nullable_prop + - object_items_nullable + - object_nullable_prop + - string_prop + type: object + example: + integer_prop: 0 + number_prop: 6.027456183070403 + boolean_prop: true + string_prop: string_prop + date_prop: 2000-01-23 + datetime_prop: 2000-01-23T04:56:07.000+00:00 + array_nullable_prop: + - "{}" + - "{}" + array_and_items_nullable_prop: + - "{}" + - "{}" + array_items_nullable: + - "{}" + - "{}" + object_nullable_prop: + key: "{}" + object_and_items_nullable_prop: + key: "{}" + object_items_nullable: + key: "{}" + custom_ref_enum: custom + custom_enum: custom + NestedArrayWithDefaultValues: + properties: + nestedArray: + default: + - - h1 + - Header 1 + - - h2 + - Header 2 + - - h3 + - Header 3 + - - h4 + - Header 4 + items: + default: + - value1 + - value2 + items: + type: string + type: array + type: array + type: object + LongId: + description: Id as long + format: int64 + type: integer + Weight: + description: Weight as float + format: float + type: number + Height: + description: Height as double + format: double + type: number + AllOfRefToLong: + description: Object with allOf ref to long + properties: + id: + allOf: + - $ref: "#/components/schemas/LongId" + default: 10 + type: object + AllOfRefToFloat: + description: Object with allOf ref to float + properties: + weight: + allOf: + - $ref: "#/components/schemas/Weight" + default: 7.89 + type: object + AllOfRefToDouble: + description: Object with allOf ref to double + properties: + height: + allOf: + - $ref: "#/components/schemas/Height" + default: 32.1 + type: object + NullableFieldsValue: + description: Object with required but nullable string fields + example: + before: before + after: after + properties: + before: + nullable: true + type: string + after: + nullable: true + type: string + required: + - after + - before + type: object + NullableFieldsMapSuccess: + additionalProperties: false + description: Success response containing a map of objects with nullable fields + example: + status: status + positions: + key: + before: before + after: after + properties: + status: + type: string + positions: + additionalProperties: + $ref: "#/components/schemas/NullableFieldsValue" + type: object + required: + - positions + - status + type: object + NullableFieldsMapError: + additionalProperties: false + description: Error response + properties: + status: + type: string + reason: + type: string + required: + - reason + - status + type: object + NullableFieldsMapResponse: + anyOf: + - $ref: "#/components/schemas/NullableFieldsMapSuccess" + - $ref: "#/components/schemas/NullableFieldsMapError" + _foo_get_default_response: + example: + string: + bar: bar + properties: + string: + $ref: "#/components/schemas/Foo" + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request: + properties: + enum_form_string_array: + default: [] + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + type: object + testEndpointParameters_request: + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: "/[a-z]/i" + type: string + pattern_without_delimiter: + description: None + pattern: "^[A-Z].*" + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + 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: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + _fake_oneOfWIthSameErasure_get_200_response: + oneOf: + - default: [] + items: + type: string + type: array + - default: [] + items: + type: integer + type: array + _fake_anyOfWIthSameErasure_get_200_response: + anyOf: + - default: [] + items: + type: string + type: array + - default: [] + items: + type: integer + type: array + testInlineFreeformAdditionalProperties_request: + additionalProperties: true + properties: + someProperty: + type: string + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + fake_ref_parameter_petId_parameter: + oneOf: + - type: string + - type: integer + FreeFormObjectTestClass_properties: + oneOf: + - type: string + - additionalProperties: true + default: [] + type: object + ArrayOfInlineAllOf_array_allof_dog_property_inner: + allOf: + - properties: + breed: + type: string + type: object + - properties: + color: + type: string + type: object + NewPet_category_inline_allof_allOf_category_tag: + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + NewPet_category_inline_allof: + allOf: + - properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + category_tag: + $ref: "#/components/schemas/NewPet_category_inline_allof_allOf_category_tag" + required: + - name + type: object + AllOfModelArrayAnyOf_allOf_linkListColumn1_value: + anyOf: + - $ref: "#/components/schemas/User" + - $ref: "#/components/schemas/Tag" + AllOfModelArrayAnyOf_allOf_linkListColumn1: + properties: + value: + default: [] + items: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_linkListColumn1_value" + type: array + required: + - value + type: object + AllOfModelArrayAnyOf_allOf_attributes_C: + oneOf: + - $ref: "#/components/schemas/Pet" + - $ref: "#/components/schemas/Order" + AllOfModelArrayAnyOf_allOf_attributes: + properties: + C: + $ref: "#/components/schemas/AllOfModelArrayAnyOf_allOf_attributes_C" + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http + diff --git a/samples/client/petstore/java/okhttp/build.gradle b/samples/client/petstore/java/okhttp/build.gradle new file mode 100644 index 000000000000..d7cbf61b9c1d --- /dev/null +++ b/samples/client/petstore/java/okhttp/build.gradle @@ -0,0 +1,65 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' + +group = 'org.openapitools' +version = '1.0.0' + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + + +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-okhttp' + from components.java + } + } +} + +task execute(type:JavaExec) { + mainClass = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +ext { + jakarta_annotation_version = "1.3.5" + okhttp_version = "5.4.0" +} + +dependencies { + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" + implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2' + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.18.0' + compileOnly "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +test { + useJUnitPlatform() + dependsOn 'cleanTest' + testLogging { + events "passed", "skipped", "failed" + } +} diff --git a/samples/client/petstore/java/okhttp/build.sbt b/samples/client/petstore/java/okhttp/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/okhttp/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/okhttp/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp/docs/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..83051d9be44b --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/AdditionalPropertiesClass.md @@ -0,0 +1,20 @@ + + +# AdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapProperty** | **Map<String, String>** | | [optional] | +|**mapOfMapProperty** | **Map<String, Map<String, String>>** | | [optional] | +|**anytype1** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] | +|**mapWithUndeclaredPropertiesAnytype3** | **Map<String, Object>** | | [optional] | +|**emptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] | +|**mapWithUndeclaredPropertiesString** | **Map<String, String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOf.md b/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOf.md new file mode 100644 index 000000000000..96dc5a34d089 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOf.md @@ -0,0 +1,16 @@ + + +# AllOfModelArrayAnyOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | +|**linkListColumn1** | [**AllOfModelArrayAnyOfAllOfLinkListColumn1**](AllOfModelArrayAnyOfAllOfLinkListColumn1.md) | | [optional] | +|**attributes** | [**AllOfModelArrayAnyOfAllOfAttributes**](AllOfModelArrayAnyOfAllOfAttributes.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfAttributes.md b/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfAttributes.md new file mode 100644 index 000000000000..c9096e515367 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfAttributes.md @@ -0,0 +1,13 @@ + + +# AllOfModelArrayAnyOfAllOfAttributes + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**C** | [**AllOfModelArrayAnyOfAllOfAttributesC**](AllOfModelArrayAnyOfAllOfAttributesC.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfAttributesC.md b/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfAttributesC.md new file mode 100644 index 000000000000..5229de89b299 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfAttributesC.md @@ -0,0 +1,32 @@ + + +# AllOfModelArrayAnyOfAllOfAttributesC + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md b/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md new file mode 100644 index 000000000000..43fa9b696377 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1.md @@ -0,0 +1,13 @@ + + +# AllOfModelArrayAnyOfAllOfLinkListColumn1 + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**value** | [**List<AllOfModelArrayAnyOfAllOfLinkListColumn1Value>**](AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md) | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md b/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md new file mode 100644 index 000000000000..6379cac28b02 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.md @@ -0,0 +1,25 @@ + + +# AllOfModelArrayAnyOfAllOfLinkListColumn1Value + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | +|**objectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] | +|**objectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] | +|**anyTypeProp** | **Object** | 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 | [optional] | +|**anyTypePropNullable** | **Object** | 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. | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/AllOfRefToDouble.md b/samples/client/petstore/java/okhttp/docs/AllOfRefToDouble.md new file mode 100644 index 000000000000..516584f74348 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/AllOfRefToDouble.md @@ -0,0 +1,14 @@ + + +# AllOfRefToDouble + +Object with allOf ref to double + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**height** | **Double** | Height as double | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/AllOfRefToFloat.md b/samples/client/petstore/java/okhttp/docs/AllOfRefToFloat.md new file mode 100644 index 000000000000..9a60af8a2ea4 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/AllOfRefToFloat.md @@ -0,0 +1,14 @@ + + +# AllOfRefToFloat + +Object with allOf ref to float + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**weight** | **Float** | Weight as float | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/AllOfRefToLong.md b/samples/client/petstore/java/okhttp/docs/AllOfRefToLong.md new file mode 100644 index 000000000000..0f32d49b0857 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/AllOfRefToLong.md @@ -0,0 +1,14 @@ + + +# AllOfRefToLong + +Object with allOf ref to long + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | Id as long | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Animal.md b/samples/client/petstore/java/okhttp/docs/Animal.md new file mode 100644 index 000000000000..d9b32f14c88a --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Animal.md @@ -0,0 +1,14 @@ + + +# Animal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | +|**color** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/AnotherFakeApi.md b/samples/client/petstore/java/okhttp/docs/AnotherFakeApi.md new file mode 100644 index 000000000000..6cca209c72b1 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/AnotherFakeApi.md @@ -0,0 +1,191 @@ +# AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags | +| [**getParameterArrayNumber**](AnotherFakeApi.md#getParameterArrayNumber) | **GET** /fake/parameter-array-number | parameter array number default value | +| [**getParameterStringNumber**](AnotherFakeApi.md#getParameterStringNumber) | **GET** /fake/parameter-string-number | parameter string number | + + + +# **call123testSpecialTags** +> Client call123testSpecialTags(client) + +To test special tags + +To test special tags and operation ID starting with number + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getParameterArrayNumber** +> getParameterArrayNumber(array) + +parameter array number default value + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + List array = Arrays.asList(); // List | array integer + try { + apiInstance.getParameterArrayNumber(array); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#getParameterArrayNumber"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **array** | [**List<Integer>**](Integer.md)| array integer | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +# **getParameterStringNumber** +> getParameterStringNumber(stringNumber) + +parameter string number + +### 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.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + BigDecimal stringNumber = new BigDecimal(78); // BigDecimal | string number + try { + apiInstance.getParameterStringNumber(stringNumber); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#getParameterStringNumber"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **stringNumber** | **BigDecimal**| string number | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + diff --git a/samples/client/petstore/java/okhttp/docs/Apple.md b/samples/client/petstore/java/okhttp/docs/Apple.md new file mode 100644 index 000000000000..0ef7a92c74d6 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Apple.md @@ -0,0 +1,14 @@ + + +# Apple + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | [optional] | +|**origin** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/AppleReq.md b/samples/client/petstore/java/okhttp/docs/AppleReq.md new file mode 100644 index 000000000000..989e1cfedd1e --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/AppleReq.md @@ -0,0 +1,14 @@ + + +# AppleReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | | +|**mealy** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ArrayAnyOf.md b/samples/client/petstore/java/okhttp/docs/ArrayAnyOf.md new file mode 100644 index 000000000000..86bb944833ac --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ArrayAnyOf.md @@ -0,0 +1,12 @@ + + +# ArrayAnyOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp/docs/ArrayDefault.md b/samples/client/petstore/java/okhttp/docs/ArrayDefault.md new file mode 100644 index 000000000000..b539cb294d74 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ArrayDefault.md @@ -0,0 +1,14 @@ + + +# ArrayDefault + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**withDefaultEmptyBracket** | **List<String>** | | [optional] | +|**withoutDefault** | **List<String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..0188db3eb131 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayArrayNumber** | **List<List<BigDecimal>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ArrayOfInlineAllOf.md b/samples/client/petstore/java/okhttp/docs/ArrayOfInlineAllOf.md new file mode 100644 index 000000000000..3efa4933a3b9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ArrayOfInlineAllOf.md @@ -0,0 +1,15 @@ + + +# ArrayOfInlineAllOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | +|**arrayAllofDogProperty** | [**List<ArrayOfInlineAllOfArrayAllofDogPropertyInner>**](ArrayOfInlineAllOfArrayAllofDogPropertyInner.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md b/samples/client/petstore/java/okhttp/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md new file mode 100644 index 000000000000..35f349597734 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ArrayOfInlineAllOfArrayAllofDogPropertyInner.md @@ -0,0 +1,14 @@ + + +# ArrayOfInlineAllOfArrayAllofDogPropertyInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | +|**color** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/okhttp/docs/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..a5753530aada --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ArrayOfNumberOnly.md @@ -0,0 +1,13 @@ + + +# ArrayOfNumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayNumber** | **List<BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ArrayOneOf.md b/samples/client/petstore/java/okhttp/docs/ArrayOneOf.md new file mode 100644 index 000000000000..34727d5f7301 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ArrayOneOf.md @@ -0,0 +1,12 @@ + + +# ArrayOneOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp/docs/ArrayTest.md b/samples/client/petstore/java/okhttp/docs/ArrayTest.md new file mode 100644 index 000000000000..36077c9df300 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ArrayTest.md @@ -0,0 +1,15 @@ + + +# ArrayTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**arrayOfString** | **List<String>** | | [optional] | +|**arrayArrayOfInteger** | **List<List<Long>>** | | [optional] | +|**arrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Banana.md b/samples/client/petstore/java/okhttp/docs/Banana.md new file mode 100644 index 000000000000..5356d17ee700 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Banana.md @@ -0,0 +1,13 @@ + + +# Banana + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**lengthCm** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/BananaReq.md b/samples/client/petstore/java/okhttp/docs/BananaReq.md new file mode 100644 index 000000000000..22ebe1a7105f --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/BananaReq.md @@ -0,0 +1,14 @@ + + +# BananaReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**lengthCm** | **BigDecimal** | | | +|**sweet** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/BasquePig.md b/samples/client/petstore/java/okhttp/docs/BasquePig.md new file mode 100644 index 000000000000..160cb71c321f --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/BasquePig.md @@ -0,0 +1,13 @@ + + +# BasquePig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Capitalization.md b/samples/client/petstore/java/okhttp/docs/Capitalization.md new file mode 100644 index 000000000000..82a812711de2 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Capitalization.md @@ -0,0 +1,18 @@ + + +# Capitalization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**smallCamel** | **String** | | [optional] | +|**capitalCamel** | **String** | | [optional] | +|**smallSnake** | **String** | | [optional] | +|**capitalSnake** | **String** | | [optional] | +|**scAETHFlowPoints** | **String** | | [optional] | +|**ATT_NAME** | **String** | Name of the pet | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Cat.md b/samples/client/petstore/java/okhttp/docs/Cat.md new file mode 100644 index 000000000000..390dd519c8ce --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Cat.md @@ -0,0 +1,13 @@ + + +# Cat + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**declawed** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Category.md b/samples/client/petstore/java/okhttp/docs/Category.md new file mode 100644 index 000000000000..ab6d1ec334dc --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Category.md @@ -0,0 +1,14 @@ + + +# Category + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ClassModel.md b/samples/client/petstore/java/okhttp/docs/ClassModel.md new file mode 100644 index 000000000000..af46dea1f6c8 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ClassModel.md @@ -0,0 +1,14 @@ + + +# ClassModel + +Model for testing model with \"_class\" property + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Client.md b/samples/client/petstore/java/okhttp/docs/Client.md new file mode 100644 index 000000000000..ef07b4ab8b9d --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Client.md @@ -0,0 +1,13 @@ + + +# Client + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**client** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ComplexQuadrilateral.md b/samples/client/petstore/java/okhttp/docs/ComplexQuadrilateral.md new file mode 100644 index 000000000000..d0a4b1a0a758 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ComplexQuadrilateral.md @@ -0,0 +1,14 @@ + + +# ComplexQuadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/DanishPig.md b/samples/client/petstore/java/okhttp/docs/DanishPig.md new file mode 100644 index 000000000000..0b366d3cf2ff --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/DanishPig.md @@ -0,0 +1,13 @@ + + +# DanishPig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/DefaultApi.md b/samples/client/petstore/java/okhttp/docs/DefaultApi.md new file mode 100644 index 000000000000..b0835fc23cf1 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/DefaultApi.md @@ -0,0 +1,245 @@ +# DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fakeAnyOfWIthSameErasureGet**](DefaultApi.md#fakeAnyOfWIthSameErasureGet) | **GET** /fake/anyOfWIthSameErasure | | +| [**fakeFreeFormQueryParametersGet**](DefaultApi.md#fakeFreeFormQueryParametersGet) | **GET** /fake/free-form-query-parameters | | +| [**fakeOneOfWIthSameErasureGet**](DefaultApi.md#fakeOneOfWIthSameErasureGet) | **GET** /fake/oneOfWIthSameErasure | | +| [**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | | + + + +# **fakeAnyOfWIthSameErasureGet** +> FakeAnyOfWIthSameErasureGet200Response fakeAnyOfWIthSameErasureGet() + + + +Test route, this shouldn't cause a compiler error + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + FakeAnyOfWIthSameErasureGet200Response result = apiInstance.fakeAnyOfWIthSameErasureGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fakeAnyOfWIthSameErasureGet"); + 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 + +[**FakeAnyOfWIthSameErasureGet200Response**](FakeAnyOfWIthSameErasureGet200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful response | - | + + +# **fakeFreeFormQueryParametersGet** +> fakeFreeFormQueryParametersGet(fixed, freeForm) + + + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + String fixed = "fixed_example"; // String | + Object freeForm = null; // Object | + try { + apiInstance.fakeFreeFormQueryParametersGet(fixed, freeForm); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fakeFreeFormQueryParametersGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **fixed** | **String**| | [optional] | +| **freeForm** | [**Object**](.md)| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +# **fakeOneOfWIthSameErasureGet** +> FakeOneOfWIthSameErasureGet200Response fakeOneOfWIthSameErasureGet() + + + +Test route, this shouldn't cause a compiler error + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + FakeOneOfWIthSameErasureGet200Response result = apiInstance.fakeOneOfWIthSameErasureGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fakeOneOfWIthSameErasureGet"); + 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 + +[**FakeOneOfWIthSameErasureGet200Response**](FakeOneOfWIthSameErasureGet200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful response | - | + + +# **fooGet** +> FooGetDefaultResponse fooGet() + + + +### 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.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + FooGetDefaultResponse result = apiInstance.fooGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fooGet"); + 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 + +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + diff --git a/samples/client/petstore/java/okhttp/docs/DeprecatedObject.md b/samples/client/petstore/java/okhttp/docs/DeprecatedObject.md new file mode 100644 index 000000000000..48de1d624425 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/DeprecatedObject.md @@ -0,0 +1,13 @@ + + +# DeprecatedObject + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Dog.md b/samples/client/petstore/java/okhttp/docs/Dog.md new file mode 100644 index 000000000000..972c981c0d05 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Dog.md @@ -0,0 +1,13 @@ + + +# Dog + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**breed** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Drawing.md b/samples/client/petstore/java/okhttp/docs/Drawing.md new file mode 100644 index 000000000000..6b815fc4131b --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Drawing.md @@ -0,0 +1,16 @@ + + +# Drawing + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mainShape** | [**Shape**](Shape.md) | | [optional] | +|**shapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] | +|**nullableShape** | [**NullableShape**](NullableShape.md) | | [optional] | +|**shapes** | [**List<Shape>**](Shape.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/EnumArrays.md b/samples/client/petstore/java/okhttp/docs/EnumArrays.md new file mode 100644 index 000000000000..b2222d5beb25 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/EnumArrays.md @@ -0,0 +1,32 @@ + + +# EnumArrays + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] | +|**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] | + + + +## Enum: JustSymbolEnum + +| Name | Value | +|---- | -----| +| GREATER_THAN_OR_EQUAL_TO | ">=" | +| DOLLAR | "$" | + + + +## Enum: List<ArrayEnumEnum> + +| Name | Value | +|---- | -----| +| FISH | "fish" | +| CRAB | "crab" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/EnumClass.md b/samples/client/petstore/java/okhttp/docs/EnumClass.md new file mode 100644 index 000000000000..b314590a7591 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/EnumClass.md @@ -0,0 +1,15 @@ + + +# EnumClass + +## Enum + + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + + + diff --git a/samples/client/petstore/java/okhttp/docs/EnumStringDiscriminator.md b/samples/client/petstore/java/okhttp/docs/EnumStringDiscriminator.md new file mode 100644 index 000000000000..83aebcdb4226 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/EnumStringDiscriminator.md @@ -0,0 +1,23 @@ + + +# EnumStringDiscriminator + +An object to test discriminator of enum string + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**enumStrType** | [**EnumStrTypeEnum**](#EnumStrTypeEnum) | enum string type | | + + + +## Enum: EnumStrTypeEnum + +| Name | Value | +|---- | -----| +| A | "type_a" | +| B | "type_b" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/EnumTest.md b/samples/client/petstore/java/okhttp/docs/EnumTest.md new file mode 100644 index 000000000000..3e226e18b50b --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/EnumTest.md @@ -0,0 +1,68 @@ + + +# EnumTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] | +|**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | | +|**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] | +|**enumIntegerOnly** | [**EnumIntegerOnlyEnum**](#EnumIntegerOnlyEnum) | | [optional] | +|**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] | +|**outerEnum** | **OuterEnum** | | [optional] | +|**outerEnumInteger** | **OuterEnumInteger** | | [optional] | +|**outerEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] | +|**outerEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] | + + + +## Enum: EnumStringEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumStringRequiredEnum + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | +| EMPTY | "" | + + + +## Enum: EnumIntegerEnum + +| Name | Value | +|---- | -----| +| NUMBER_1 | 1 | +| NUMBER_MINUS_1 | -1 | + + + +## Enum: EnumIntegerOnlyEnum + +| Name | Value | +|---- | -----| +| NUMBER_2 | 2 | +| NUMBER_MINUS_2 | -2 | + + + +## Enum: EnumNumberEnum + +| Name | Value | +|---- | -----| +| NUMBER_1_DOT_1 | 1.1 | +| NUMBER_MINUS_1_DOT_2 | -1.2 | + + + diff --git a/samples/client/petstore/java/okhttp/docs/EquilateralTriangle.md b/samples/client/petstore/java/okhttp/docs/EquilateralTriangle.md new file mode 100644 index 000000000000..eade817feb3e --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/EquilateralTriangle.md @@ -0,0 +1,14 @@ + + +# EquilateralTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/FakeAnyOfWIthSameErasureGet200Response.md b/samples/client/petstore/java/okhttp/docs/FakeAnyOfWIthSameErasureGet200Response.md new file mode 100644 index 000000000000..c224eb3d572f --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/FakeAnyOfWIthSameErasureGet200Response.md @@ -0,0 +1,12 @@ + + +# FakeAnyOfWIthSameErasureGet200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp/docs/FakeApi.md b/samples/client/petstore/java/okhttp/docs/FakeApi.md new file mode 100644 index 000000000000..00d888ebe6e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/FakeApi.md @@ -0,0 +1,1571 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**fakeGetFreeFormObjectGet**](FakeApi.md#fakeGetFreeFormObjectGet) | **GET** /fake/get-free-form-object | | +| [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | +| [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | | +| [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | | +| [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | | +| [**fakeRefParameter**](FakeApi.md#fakeRefParameter) | **POST** /fake/pet/{petId}/reference/parameter | fake reference parameter | +| [**fakeRequiredNullableBodyGet**](FakeApi.md#fakeRequiredNullableBodyGet) | **GET** /fake/required-nullable-body | fields in the response body, required and nullable are both true | +| [**fakeUploadRefRequestBodies**](FakeApi.md#fakeUploadRefRequestBodies) | **POST** /fake/pet/{petId}/uploadImage | fake reference parameter | +| [**getFakeArrayofenums**](FakeApi.md#getFakeArrayofenums) | **GET** /fake/array-of-enums | Array of Enums | +| [**getFakeHealth**](FakeApi.md#getFakeHealth) | **GET** /fake/health | Health check endpoint | +| [**getParameterNameMapping**](FakeApi.md#getParameterNameMapping) | **GET** /fake/parameter-name-mapping | parameter name mapping test | +| [**testAdditionalPropertiesReference**](FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | +| [**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 | +| [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 | +| [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters | +| [**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) | +| [**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties | +| [**testInlineFreeformAdditionalProperties**](FakeApi.md#testInlineFreeformAdditionalProperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties | +| [**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data | +| [**testNullableRequiredFieldsAnyOf**](FakeApi.md#testNullableRequiredFieldsAnyOf) | **GET** /fake/nullable-required-fields-anyof | test anyOf with map of objects containing nullable required fields | +| [**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | | +| [**testStringMapReference**](FakeApi.md#testStringMapReference) | **POST** /fake/stringMap-reference | test referenced string map | + + + +# **fakeGetFreeFormObjectGet** +> FreeFormObjectTestClass fakeGetFreeFormObjectGet() + + + +Get a free form object or Json string + +### 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 { + FreeFormObjectTestClass result = apiInstance.fakeGetFreeFormObjectGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeGetFreeFormObjectGet"); + 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 + +[**FreeFormObjectTestClass**](FreeFormObjectTestClass.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### 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); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **Boolean**| Input boolean as post body | [optional] | + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(outerComposite) + + + +Test serialization of object with outer number type + +### 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); + OuterComposite outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(outerComposite); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] | + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### 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); + BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **BigDecimal**| Input number as post body | [optional] | + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### 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); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **String**| Input string as post body | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + + +# **fakeRefParameter** +> fakeRefParameter(petId) + +fake reference parameter + + + +### 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); + FakeRefParameterPetIdParameter petId = new FakeRefParameterPetIdParameter(); // FakeRefParameterPetIdParameter | to test oneOf in parameter $ref + try { + apiInstance.fakeRefParameter(petId); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeRefParameter"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | [**FakeRefParameterPetIdParameter**](.md)| to test oneOf in parameter $ref | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **fakeRequiredNullableBodyGet** +> RequiredNullableBody fakeRequiredNullableBodyGet() + +fields in the response body, required and nullable are both true + + + +### 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 { + RequiredNullableBody result = apiInstance.fakeRequiredNullableBodyGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeRequiredNullableBodyGet"); + 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 + +[**RequiredNullableBody**](RequiredNullableBody.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | success | - | + + +# **fakeUploadRefRequestBodies** +> ModelApiResponse fakeUploadRefRequestBodies(petId, additionalMetadata, _file) + +fake reference parameter + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.fakeUploadRefRequestBodies(petId, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeUploadRefRequestBodies"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getFakeArrayofenums** +> List<OuterEnum> getFakeArrayofenums() + +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.getFakeArrayofenums(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getFakeArrayofenums"); + 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 | - | + + +# **getFakeHealth** +> HealthCheckResult getFakeHealth() + +Health check endpoint + +### 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 { + HealthCheckResult result = apiInstance.getFakeHealth(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getFakeHealth"); + 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 + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | The instance started successfully | - | + + +# **getParameterNameMapping** +> getParameterNameMapping(underscoreType, type, typeWithUnderscore) + +parameter name mapping test + +### 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); + Long underscoreType = 56L; // Long | _type + String type = "type_example"; // String | type + String typeWithUnderscore = "typeWithUnderscore_example"; // String | type_ + try { + apiInstance.getParameterNameMapping(underscoreType, type, typeWithUnderscore); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#getParameterNameMapping"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **underscoreType** | **Long**| _type | | +| **type** | **String**| type | | +| **typeWithUnderscore** | **String**| type_ | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + + +# **testAdditionalPropertiesReference** +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### 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); + Map requestBody = null; // Map | request body + try { + apiInstance.testAdditionalPropertiesReference(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testAdditionalPropertiesReference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, Object>**](Object.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +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); + FileSchemaTestClass fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(fileSchemaTestClass); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(query, user) + + + +### 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); + String query = "query_example"; // String | + User user = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, user); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **query** | **String**| | | +| **user** | [**User**](User.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testClientModel** +> Client testClientModel(client) + +To test \"client\" model + +To test \"client\" model + +### 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); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testEndpointParameters** +> testEndpointParameters(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 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(78); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = LocalDate.now(); // LocalDate | None + OffsetDateTime dateTime = OffsetDateTime.parse("2010-02-01T10:20:10.111110+01:00"); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **number** | **BigDecimal**| None | | +| **_double** | **Double**| None | | +| **patternWithoutDelimiter** | **String**| None | | +| **_byte** | **byte[]**| None | | +| **integer** | **Integer**| None | [optional] | +| **int32** | **Integer**| None | [optional] | +| **int64** | **Long**| None | [optional] | +| **_float** | **Float**| None | [optional] | +| **string** | **String**| None | [optional] | +| **binary** | **File**| None | [optional] | +| **date** | **LocalDate**| None | [optional] | +| **dateTime** | **OffsetDateTime**| None | [optional] [default to 2010-02-01T10:20:10.111110+01:00] | +| **password** | **String**| None | [optional] | +| **paramCallback** | **String**| None | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **testEnumParameters** +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### 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); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "_abc"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "_abc"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 1; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 1.1D; // Double | Query parameter enum test (double) + List enumFormStringArray = Arrays.asList("$"); // List | Form parameter enum test (string array) + String enumFormString = "_abc"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] | +| **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] | +| **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | +| **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] | +| **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] | +| **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] | +| **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + + +# **testGroupParameters** +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group).stringGroup(stringGroup).booleanGroup(booleanGroup).int64Group(int64Group).execute(); + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP bearer authorization: bearer_test + HttpBearerAuth bearer_test = (HttpBearerAuth) defaultClient.getAuthentication("bearer_test"); + bearer_test.setBearerToken("BEARER TOKEN"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requiredStringGroup** | **Integer**| Required String in group parameters | | +| **requiredBooleanGroup** | **Boolean**| Required Boolean in group parameters | | +| **requiredInt64Group** | **Long**| Required Integer in group parameters | | +| **stringGroup** | **Integer**| String in group parameters | [optional] | +| **booleanGroup** | **Boolean**| Boolean in group parameters | [optional] | +| **int64Group** | **Long**| Integer in group parameters | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Something wrong | - | + + +# **testInlineAdditionalProperties** +> testInlineAdditionalProperties(requestBody) + +test inline additionalProperties + + + +### 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); + Map requestBody = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, String>**](String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testInlineFreeformAdditionalProperties** +> testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + + + +### 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); + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = new TestInlineFreeformAdditionalPropertiesRequest(); // TestInlineFreeformAdditionalPropertiesRequest | request body + try { + apiInstance.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineFreeformAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + + + +### 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); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **param** | **String**| field1 | | +| **param2** | **String**| field2 | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testNullableRequiredFieldsAnyOf** +> NullableFieldsMapResponse testNullableRequiredFieldsAnyOf() + +test anyOf with map of objects containing nullable required fields + +Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + +### 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 { + NullableFieldsMapResponse result = apiInstance.testNullableRequiredFieldsAnyOf(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testNullableRequiredFieldsAnyOf"); + 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 + +[**NullableFieldsMapResponse**](NullableFieldsMapResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + + +To test the collection format in query parameters + +### 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); + List pipe = Arrays.asList(); // List | + List ioutil = Arrays.asList(); // List | + List http = Arrays.asList(); // List | + List url = Arrays.asList(); // List | + List context = Arrays.asList(); // List | + try { + apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pipe** | [**List<String>**](String.md)| | | +| **ioutil** | [**List<String>**](String.md)| | | +| **http** | [**List<String>**](String.md)| | | +| **url** | [**List<String>**](String.md)| | | +| **context** | [**List<String>**](String.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +# **testStringMapReference** +> testStringMapReference(requestBody) + +test referenced string map + + + +### 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); + Map requestBody = new HashMap(); // Map | request body + try { + apiInstance.testStringMapReference(requestBody); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testStringMapReference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **requestBody** | [**Map<String, String>**](String.md)| request body | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/okhttp/docs/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..95a8c171fc34 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/FakeClassnameTags123Api.md @@ -0,0 +1,78 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case | + + + +# **testClassname** +> Client testClassname(client) + +To test class name in snake case + +To test class name in snake case + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); + + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client client = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(client); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **client** | [**Client**](Client.md)| client model | | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp/docs/FakeOneOfWIthSameErasureGet200Response.md b/samples/client/petstore/java/okhttp/docs/FakeOneOfWIthSameErasureGet200Response.md new file mode 100644 index 000000000000..0a3fbf6f8fca --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/FakeOneOfWIthSameErasureGet200Response.md @@ -0,0 +1,12 @@ + + +# FakeOneOfWIthSameErasureGet200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp/docs/FakeRefParameterPetIdParameter.md b/samples/client/petstore/java/okhttp/docs/FakeRefParameterPetIdParameter.md new file mode 100644 index 000000000000..1328d3c125c4 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/FakeRefParameterPetIdParameter.md @@ -0,0 +1,12 @@ + + +# FakeRefParameterPetIdParameter + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp/docs/FileSchemaTestClass.md b/samples/client/petstore/java/okhttp/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..85d1a0636694 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/FileSchemaTestClass.md @@ -0,0 +1,14 @@ + + +# FileSchemaTestClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_file** | [**ModelFile**](ModelFile.md) | | [optional] | +|**files** | [**List<ModelFile>**](ModelFile.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Foo.md b/samples/client/petstore/java/okhttp/docs/Foo.md new file mode 100644 index 000000000000..6b3f0556528a --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Foo.md @@ -0,0 +1,13 @@ + + +# Foo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/FooGetDefaultResponse.md b/samples/client/petstore/java/okhttp/docs/FooGetDefaultResponse.md new file mode 100644 index 000000000000..ff3d7a3a56c3 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/FooGetDefaultResponse.md @@ -0,0 +1,13 @@ + + +# FooGetDefaultResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**string** | [**Foo**](Foo.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/FormatTest.md b/samples/client/petstore/java/okhttp/docs/FormatTest.md new file mode 100644 index 000000000000..71790022c16d --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/FormatTest.md @@ -0,0 +1,29 @@ + + +# FormatTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integer** | **Integer** | | [optional] | +|**int32** | **Integer** | | [optional] | +|**int64** | **Long** | | [optional] | +|**number** | **BigDecimal** | | | +|**_float** | **Float** | | [optional] | +|**_double** | **Double** | | [optional] | +|**decimal** | **BigDecimal** | | [optional] | +|**string** | **String** | | [optional] | +|**_byte** | **byte[]** | | | +|**binary** | **File** | | [optional] | +|**date** | **LocalDate** | | | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**uuid** | **UUID** | | [optional] | +|**uuidWithDefault** | **UUID** | | [optional] | +|**password** | **String** | | | +|**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] | +|**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/FreeFormObjectTestClass.md b/samples/client/petstore/java/okhttp/docs/FreeFormObjectTestClass.md new file mode 100644 index 000000000000..3bb6144bc90b --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/FreeFormObjectTestClass.md @@ -0,0 +1,14 @@ + + +# FreeFormObjectTestClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | [optional] | +|**properties** | [**FreeFormObjectTestClassProperties**](FreeFormObjectTestClassProperties.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/FreeFormObjectTestClassProperties.md b/samples/client/petstore/java/okhttp/docs/FreeFormObjectTestClassProperties.md new file mode 100644 index 000000000000..8a7c9d2838a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/FreeFormObjectTestClassProperties.md @@ -0,0 +1,12 @@ + + +# FreeFormObjectTestClassProperties + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp/docs/Fruit.md b/samples/client/petstore/java/okhttp/docs/Fruit.md new file mode 100644 index 000000000000..f1915ef9b5b6 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Fruit.md @@ -0,0 +1,16 @@ + + +# Fruit + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**color** | **String** | | [optional] | +|**cultivar** | **String** | | [optional] | +|**origin** | **String** | | [optional] | +|**lengthCm** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/FruitReq.md b/samples/client/petstore/java/okhttp/docs/FruitReq.md new file mode 100644 index 000000000000..859a881b53ec --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/FruitReq.md @@ -0,0 +1,16 @@ + + +# FruitReq + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**cultivar** | **String** | | | +|**mealy** | **Boolean** | | [optional] | +|**lengthCm** | **BigDecimal** | | | +|**sweet** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/GmFruit.md b/samples/client/petstore/java/okhttp/docs/GmFruit.md new file mode 100644 index 000000000000..1a301bf9600a --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/GmFruit.md @@ -0,0 +1,16 @@ + + +# GmFruit + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**color** | **String** | | [optional] | +|**cultivar** | **String** | | [optional] | +|**origin** | **String** | | [optional] | +|**lengthCm** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/GrandparentAnimal.md b/samples/client/petstore/java/okhttp/docs/GrandparentAnimal.md new file mode 100644 index 000000000000..9737408f2724 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/GrandparentAnimal.md @@ -0,0 +1,13 @@ + + +# GrandparentAnimal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**petType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/okhttp/docs/HasOnlyReadOnly.md new file mode 100644 index 000000000000..29da5205dbba --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/HasOnlyReadOnly.md @@ -0,0 +1,14 @@ + + +# HasOnlyReadOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**foo** | **String** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/HealthCheckResult.md b/samples/client/petstore/java/okhttp/docs/HealthCheckResult.md new file mode 100644 index 000000000000..4885e6f1cada --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/HealthCheckResult.md @@ -0,0 +1,14 @@ + + +# HealthCheckResult + +Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**nullableMessage** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/IsoscelesTriangle.md b/samples/client/petstore/java/okhttp/docs/IsoscelesTriangle.md new file mode 100644 index 000000000000..0bd5045bc68f --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/IsoscelesTriangle.md @@ -0,0 +1,14 @@ + + +# IsoscelesTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Mammal.md b/samples/client/petstore/java/okhttp/docs/Mammal.md new file mode 100644 index 000000000000..71f0fce48839 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Mammal.md @@ -0,0 +1,26 @@ + + +# Mammal + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasBaleen** | **Boolean** | | [optional] | +|**hasTeeth** | **Boolean** | | [optional] | +|**className** | **String** | | | +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| PLAINS | "plains" | +| MOUNTAIN | "mountain" | +| GREVYS | "grevys" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/MammalAnyof.md b/samples/client/petstore/java/okhttp/docs/MammalAnyof.md new file mode 100644 index 000000000000..7a366e10da49 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/MammalAnyof.md @@ -0,0 +1,26 @@ + + +# MammalAnyof + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasBaleen** | **Boolean** | | [optional] | +|**hasTeeth** | **Boolean** | | [optional] | +|**className** | **String** | | | +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| PLAINS | "plains" | +| MOUNTAIN | "mountain" | +| GREVYS | "grevys" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/MapTest.md b/samples/client/petstore/java/okhttp/docs/MapTest.md new file mode 100644 index 000000000000..54380188e1d6 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/MapTest.md @@ -0,0 +1,25 @@ + + +# MapTest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mapMapOfString** | **Map<String, Map<String, String>>** | | [optional] | +|**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] | +|**directMap** | **Map<String, Boolean>** | | [optional] | +|**indirectMap** | **Map<String, Boolean>** | | [optional] | + + + +## Enum: Map<String, InnerEnum> + +| Name | Value | +|---- | -----| +| UPPER | "UPPER" | +| LOWER | "lower" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/okhttp/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..a5ddf0faa6a9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,15 @@ + + +# MixedPropertiesAndAdditionalPropertiesClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **UUID** | | [optional] | +|**dateTime** | **OffsetDateTime** | | [optional] | +|**map** | [**Map<String, Animal>**](Animal.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Model200Response.md b/samples/client/petstore/java/okhttp/docs/Model200Response.md new file mode 100644 index 000000000000..109411580c62 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Model200Response.md @@ -0,0 +1,15 @@ + + +# Model200Response + +Model for testing model name starting with number + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | [optional] | +|**propertyClass** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp/docs/ModelApiResponse.md new file mode 100644 index 000000000000..e374c2dd2dec --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ModelApiResponse.md @@ -0,0 +1,15 @@ + + +# ModelApiResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**code** | **Integer** | | [optional] | +|**type** | **String** | | [optional] | +|**message** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ModelFile.md b/samples/client/petstore/java/okhttp/docs/ModelFile.md new file mode 100644 index 000000000000..adcde984f527 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ModelFile.md @@ -0,0 +1,14 @@ + + +# ModelFile + +Must be named `File` for test. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**sourceURI** | **String** | Test capitalization | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ModelList.md b/samples/client/petstore/java/okhttp/docs/ModelList.md new file mode 100644 index 000000000000..f93ab7dde8d4 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ModelList.md @@ -0,0 +1,13 @@ + + +# ModelList + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_123list** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ModelReturn.md b/samples/client/petstore/java/okhttp/docs/ModelReturn.md new file mode 100644 index 000000000000..0bd356861eb7 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ModelReturn.md @@ -0,0 +1,14 @@ + + +# ModelReturn + +Model for testing reserved words + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**_return** | **Integer** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ModelWithOneOfAnyOfProperties.md b/samples/client/petstore/java/okhttp/docs/ModelWithOneOfAnyOfProperties.md new file mode 100644 index 000000000000..64c1206365fd --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ModelWithOneOfAnyOfProperties.md @@ -0,0 +1,14 @@ + + +# ModelWithOneOfAnyOfProperties + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**oneofProp** | [**ArrayOneOf**](ArrayOneOf.md) | | [optional] | +|**anyofProp** | [**ArrayAnyOf**](ArrayAnyOf.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Name.md b/samples/client/petstore/java/okhttp/docs/Name.md new file mode 100644 index 000000000000..c901d9435309 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Name.md @@ -0,0 +1,17 @@ + + +# Name + +Model for testing model name same as property name + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **Integer** | | | +|**snakeCase** | **Integer** | | [optional] [readonly] | +|**property** | **String** | | [optional] | +|**_123number** | **Integer** | | [optional] [readonly] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/NestedArrayWithDefaultValues.md b/samples/client/petstore/java/okhttp/docs/NestedArrayWithDefaultValues.md new file mode 100644 index 000000000000..c5f272f1cb30 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/NestedArrayWithDefaultValues.md @@ -0,0 +1,13 @@ + + +# NestedArrayWithDefaultValues + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**nestedArray** | **List<List<String>>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/NewPet.md b/samples/client/petstore/java/okhttp/docs/NewPet.md new file mode 100644 index 000000000000..3cfa8c0076fe --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/NewPet.md @@ -0,0 +1,31 @@ + + +# NewPet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**categoryInlineAllof** | [**NewPetCategoryInlineAllof**](NewPetCategoryInlineAllof.md) | | [optional] | +|**categoryAllOfRef** | [**Category**](Category.md) | | [optional] | +|**categoryAllOfRefDescription** | [**Category**](Category.md) | Adding description to property using allOf | [optional] | +|**categoryAllOfRefDescriptionReadonly** | [**Category**](Category.md) | Adding description to readonly property using allOf | [optional] [readonly] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/NewPetCategoryInlineAllof.md b/samples/client/petstore/java/okhttp/docs/NewPetCategoryInlineAllof.md new file mode 100644 index 000000000000..7e8872f8132d --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/NewPetCategoryInlineAllof.md @@ -0,0 +1,15 @@ + + +# NewPetCategoryInlineAllof + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | | +|**categoryTag** | [**NewPetCategoryInlineAllofAllOfCategoryTag**](NewPetCategoryInlineAllofAllOfCategoryTag.md) | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md b/samples/client/petstore/java/okhttp/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md new file mode 100644 index 000000000000..d685440279e9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/NewPetCategoryInlineAllofAllOfCategoryTag.md @@ -0,0 +1,14 @@ + + +# NewPetCategoryInlineAllofAllOfCategoryTag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/NullableClass.md b/samples/client/petstore/java/okhttp/docs/NullableClass.md new file mode 100644 index 000000000000..fa98c5c6d984 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/NullableClass.md @@ -0,0 +1,24 @@ + + +# NullableClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integerProp** | **Integer** | | [optional] | +|**numberProp** | **BigDecimal** | | [optional] | +|**booleanProp** | **Boolean** | | [optional] | +|**stringProp** | **String** | | [optional] | +|**dateProp** | **LocalDate** | | [optional] | +|**datetimeProp** | **OffsetDateTime** | | [optional] | +|**arrayNullableProp** | **List<Object>** | | [optional] | +|**arrayAndItemsNullableProp** | **List<Object>** | | [optional] | +|**arrayItemsNullable** | **List<Object>** | | [optional] | +|**objectNullableProp** | **Map<String, Object>** | | [optional] | +|**objectAndItemsNullableProp** | **Map<String, Object>** | | [optional] | +|**objectItemsNullable** | **Map<String, Object>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/NullableEnum.md b/samples/client/petstore/java/okhttp/docs/NullableEnum.md new file mode 100644 index 000000000000..774c8d6b1d70 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/NullableEnum.md @@ -0,0 +1,11 @@ + + +# NullableEnum + +## Enum + + +* `CUSTOM` (value: `"custom"`) + + + diff --git a/samples/client/petstore/java/okhttp/docs/NullableFieldsMapError.md b/samples/client/petstore/java/okhttp/docs/NullableFieldsMapError.md new file mode 100644 index 000000000000..c129f355904a --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/NullableFieldsMapError.md @@ -0,0 +1,15 @@ + + +# NullableFieldsMapError + +Error response + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | | +|**reason** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/NullableFieldsMapResponse.md b/samples/client/petstore/java/okhttp/docs/NullableFieldsMapResponse.md new file mode 100644 index 000000000000..de7b03be5807 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/NullableFieldsMapResponse.md @@ -0,0 +1,15 @@ + + +# NullableFieldsMapResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | | +|**positions** | [**Map<String, NullableFieldsValue>**](NullableFieldsValue.md) | | | +|**reason** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/NullableFieldsMapSuccess.md b/samples/client/petstore/java/okhttp/docs/NullableFieldsMapSuccess.md new file mode 100644 index 000000000000..0ce60cd148f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/NullableFieldsMapSuccess.md @@ -0,0 +1,15 @@ + + +# NullableFieldsMapSuccess + +Success response containing a map of objects with nullable fields + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | | | +|**positions** | [**Map<String, NullableFieldsValue>**](NullableFieldsValue.md) | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/NullableFieldsValue.md b/samples/client/petstore/java/okhttp/docs/NullableFieldsValue.md new file mode 100644 index 000000000000..397f73f74007 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/NullableFieldsValue.md @@ -0,0 +1,15 @@ + + +# NullableFieldsValue + +Object with required but nullable string fields + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**before** | **String** | | | +|**after** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/NullableShape.md b/samples/client/petstore/java/okhttp/docs/NullableShape.md new file mode 100644 index 000000000000..9d40680fd2c2 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/NullableShape.md @@ -0,0 +1,16 @@ + + +# NullableShape + +The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/NumberOnly.md b/samples/client/petstore/java/okhttp/docs/NumberOnly.md new file mode 100644 index 000000000000..b8ed1a4cfae1 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/NumberOnly.md @@ -0,0 +1,13 @@ + + +# NumberOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**justNumber** | **BigDecimal** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ObjectWithDeprecatedFields.md b/samples/client/petstore/java/okhttp/docs/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..f1cf571f4c09 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ObjectWithDeprecatedFields.md @@ -0,0 +1,16 @@ + + +# ObjectWithDeprecatedFields + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**uuid** | **String** | | [optional] | +|**id** | **BigDecimal** | | [optional] | +|**deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] | +|**bars** | **List<String>** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Order.md b/samples/client/petstore/java/okhttp/docs/Order.md new file mode 100644 index 000000000000..27af32855c5c --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Order.md @@ -0,0 +1,28 @@ + + +# Order + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**petId** | **Long** | | [optional] | +|**quantity** | **Integer** | | [optional] | +|**shipDate** | **OffsetDateTime** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | +|**complete** | **Boolean** | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PLACED | "placed" | +| APPROVED | "approved" | +| DELIVERED | "delivered" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/OuterComposite.md b/samples/client/petstore/java/okhttp/docs/OuterComposite.md new file mode 100644 index 000000000000..98b56e0763ff --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/OuterComposite.md @@ -0,0 +1,15 @@ + + +# OuterComposite + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**myNumber** | **BigDecimal** | | [optional] | +|**myString** | **String** | | [optional] | +|**myBoolean** | **Boolean** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/OuterEnum.md b/samples/client/petstore/java/okhttp/docs/OuterEnum.md new file mode 100644 index 000000000000..e9228f060d25 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/OuterEnum.md @@ -0,0 +1,19 @@ + + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + +* `LOWER_CASE_S` (value: `"s"`) + +* `UPPER_CASE_S` (value: `"S"`) + + + diff --git a/samples/client/petstore/java/okhttp/docs/OuterEnumDefaultValue.md b/samples/client/petstore/java/okhttp/docs/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..cbc7f4ba54d2 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/OuterEnumDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumDefaultValue + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/okhttp/docs/OuterEnumInteger.md b/samples/client/petstore/java/okhttp/docs/OuterEnumInteger.md new file mode 100644 index 000000000000..f71dea30ad00 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/OuterEnumInteger.md @@ -0,0 +1,15 @@ + + +# OuterEnumInteger + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/okhttp/docs/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/java/okhttp/docs/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..99e6389f4278 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumIntegerDefaultValue + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/okhttp/docs/ParentPet.md b/samples/client/petstore/java/okhttp/docs/ParentPet.md new file mode 100644 index 000000000000..4992b88a6710 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ParentPet.md @@ -0,0 +1,12 @@ + + +# ParentPet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp/docs/Pet.md b/samples/client/petstore/java/okhttp/docs/Pet.md new file mode 100644 index 000000000000..08dfd8623602 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Pet.md @@ -0,0 +1,28 @@ + + +# Pet + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/PetApi.md b/samples/client/petstore/java/okhttp/docs/PetApi.md new file mode 100644 index 000000000000..c7fa83cbbb77 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/PetApi.md @@ -0,0 +1,640 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store | +| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet | +| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status | +| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags | +| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID | +| [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet | +| [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data | +| [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image | +| [**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) | + + + +# **addPet** +> addPet(pet) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(pet); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| Pet id to delete | | +| **apiKey** | **String**| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid pet value | - | + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tags** | [**List<String>**](String.md)| Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + + +# **updatePet** +> updatePet(pet) + +Update an existing pet + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(pet); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet that needs to be updated | | +| **name** | **String**| Updated name of the pet | [optional] | +| **status** | **String**| Updated status of the pet | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, contentType, additionalMetadata, _file) + +uploads an image + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String contentType = "contentType_example"; // String | Content type header parameter + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File _file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, contentType, additionalMetadata, _file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **contentType** | **String**| Content type header parameter | [optional] | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | +| **_file** | **File**| file to upload | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **uploadFileWithRequiredFile** +> ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + + + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **petId** | **Long**| ID of pet to update | | +| **requiredFile** | **File**| file to upload | | +| **additionalMetadata** | **String**| Additional data to pass to server | [optional] | + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/okhttp/docs/PetComposition.md b/samples/client/petstore/java/okhttp/docs/PetComposition.md new file mode 100644 index 000000000000..3f93a8972ddc --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/PetComposition.md @@ -0,0 +1,28 @@ + + +# PetComposition + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/PetRef.md b/samples/client/petstore/java/okhttp/docs/PetRef.md new file mode 100644 index 000000000000..256faf704c49 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/PetRef.md @@ -0,0 +1,28 @@ + + +# PetRef + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/PetUsingAllOf.md b/samples/client/petstore/java/okhttp/docs/PetUsingAllOf.md new file mode 100644 index 000000000000..379da2dc359f --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/PetUsingAllOf.md @@ -0,0 +1,28 @@ + + +# PetUsingAllOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | multi line description 2nd line last line | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/PetWithRequiredTags.md b/samples/client/petstore/java/okhttp/docs/PetWithRequiredTags.md new file mode 100644 index 000000000000..2f528f536e99 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/PetWithRequiredTags.md @@ -0,0 +1,28 @@ + + +# PetWithRequiredTags + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**category** | [**Category**](Category.md) | | [optional] | +|**name** | **String** | | | +|**photoUrls** | **List<String>** | | | +|**tags** | [**List<Tag>**](Tag.md) | | | +|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| AVAILABLE | "available" | +| PENDING | "pending" | +| SOLD | "sold" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Pig.md b/samples/client/petstore/java/okhttp/docs/Pig.md new file mode 100644 index 000000000000..61079c61c498 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Pig.md @@ -0,0 +1,13 @@ + + +# Pig + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/PropertyNameCollision.md b/samples/client/petstore/java/okhttp/docs/PropertyNameCollision.md new file mode 100644 index 000000000000..28775f9b7481 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/PropertyNameCollision.md @@ -0,0 +1,15 @@ + + +# PropertyNameCollision + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**underscoreType** | **String** | | [optional] | +|**type** | **String** | | [optional] | +|**typeWithUnderscore** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Quadrilateral.md b/samples/client/petstore/java/okhttp/docs/Quadrilateral.md new file mode 100644 index 000000000000..af9f89a6f710 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Quadrilateral.md @@ -0,0 +1,14 @@ + + +# Quadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/QuadrilateralInterface.md b/samples/client/petstore/java/okhttp/docs/QuadrilateralInterface.md new file mode 100644 index 000000000000..99451f3bd020 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/QuadrilateralInterface.md @@ -0,0 +1,13 @@ + + +# QuadrilateralInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ReadOnlyFirst.md b/samples/client/petstore/java/okhttp/docs/ReadOnlyFirst.md new file mode 100644 index 000000000000..ad6af7ee155f --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ReadOnlyFirst.md @@ -0,0 +1,14 @@ + + +# ReadOnlyFirst + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bar** | **String** | | [optional] [readonly] | +|**baz** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/RequiredNullableBody.md b/samples/client/petstore/java/okhttp/docs/RequiredNullableBody.md new file mode 100644 index 000000000000..b732ff05be76 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/RequiredNullableBody.md @@ -0,0 +1,34 @@ + + +# RequiredNullableBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**integerProp** | **Integer** | | | +|**numberProp** | **BigDecimal** | | | +|**booleanProp** | **Boolean** | | | +|**stringProp** | **String** | | | +|**dateProp** | **LocalDate** | | | +|**datetimeProp** | **OffsetDateTime** | | | +|**arrayNullableProp** | **List<Object>** | | | +|**arrayAndItemsNullableProp** | **List<Object>** | | | +|**arrayItemsNullable** | **List<Object>** | | | +|**objectNullableProp** | **Map<String, Object>** | | | +|**objectAndItemsNullableProp** | **Map<String, Object>** | | | +|**objectItemsNullable** | **Map<String, Object>** | | | +|**customRefEnum** | **NullableEnum** | | | +|**customEnum** | [**CustomEnumEnum**](#CustomEnumEnum) | | | + + + +## Enum: CustomEnumEnum + +| Name | Value | +|---- | -----| +| CUSTOM | "custom" | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Scalar.md b/samples/client/petstore/java/okhttp/docs/Scalar.md new file mode 100644 index 000000000000..45dbf799e91f --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Scalar.md @@ -0,0 +1,13 @@ + + +# Scalar + +Values of scalar type + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp/docs/ScalarAnyOf.md b/samples/client/petstore/java/okhttp/docs/ScalarAnyOf.md new file mode 100644 index 000000000000..767e9196023d --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ScalarAnyOf.md @@ -0,0 +1,13 @@ + + +# ScalarAnyOf + +Values of scalar type using anyOf + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp/docs/ScaleneTriangle.md b/samples/client/petstore/java/okhttp/docs/ScaleneTriangle.md new file mode 100644 index 000000000000..c578f6cbfaab --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ScaleneTriangle.md @@ -0,0 +1,14 @@ + + +# ScaleneTriangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Shape.md b/samples/client/petstore/java/okhttp/docs/Shape.md new file mode 100644 index 000000000000..51549d7b67f9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Shape.md @@ -0,0 +1,15 @@ + + +# Shape + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ShapeInterface.md b/samples/client/petstore/java/okhttp/docs/ShapeInterface.md new file mode 100644 index 000000000000..b4f981e3b566 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ShapeInterface.md @@ -0,0 +1,13 @@ + + +# ShapeInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/ShapeOrNull.md b/samples/client/petstore/java/okhttp/docs/ShapeOrNull.md new file mode 100644 index 000000000000..c4ae8f1b6720 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ShapeOrNull.md @@ -0,0 +1,16 @@ + + +# ShapeOrNull + +The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/SimpleQuadrilateral.md b/samples/client/petstore/java/okhttp/docs/SimpleQuadrilateral.md new file mode 100644 index 000000000000..52fb7d1a6a49 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/SimpleQuadrilateral.md @@ -0,0 +1,14 @@ + + +# SimpleQuadrilateral + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**quadrilateralType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/SpecialModelName.md b/samples/client/petstore/java/okhttp/docs/SpecialModelName.md new file mode 100644 index 000000000000..e17d0d797b7f --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/SpecialModelName.md @@ -0,0 +1,14 @@ + + +# SpecialModelName + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**$specialPropertyName** | **Long** | | [optional] | +|**specialModelName** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/StoreApi.md b/samples/client/petstore/java/okhttp/docs/StoreApi.md new file mode 100644 index 000000000000..719f9df42478 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/StoreApi.md @@ -0,0 +1,266 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID | +| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | +| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID | +| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **String**| ID of the order that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + 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 + +**Map<String, Integer>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **orderId** | **Long**| ID of pet that needs to be fetched | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + + + +### 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.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order order = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/okhttp/docs/Tag.md b/samples/client/petstore/java/okhttp/docs/Tag.md new file mode 100644 index 000000000000..5088b2dd1c31 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Tag.md @@ -0,0 +1,14 @@ + + +# Tag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/client/petstore/java/okhttp/docs/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..dc066e6c7dac --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,13 @@ + + +# TestInlineFreeformAdditionalPropertiesRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someProperty** | **String** | | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Triangle.md b/samples/client/petstore/java/okhttp/docs/Triangle.md new file mode 100644 index 000000000000..71de2174f744 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Triangle.md @@ -0,0 +1,14 @@ + + +# Triangle + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**shapeType** | **String** | | | +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/TriangleInterface.md b/samples/client/petstore/java/okhttp/docs/TriangleInterface.md new file mode 100644 index 000000000000..ef5fc7575f34 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/TriangleInterface.md @@ -0,0 +1,13 @@ + + +# TriangleInterface + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**triangleType** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/User.md b/samples/client/petstore/java/okhttp/docs/User.md new file mode 100644 index 000000000000..9e97dc35485f --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/User.md @@ -0,0 +1,24 @@ + + +# User + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | | [optional] | +|**username** | **String** | | [optional] | +|**firstName** | **String** | | [optional] | +|**lastName** | **String** | | [optional] | +|**email** | **String** | | [optional] | +|**password** | **String** | | [optional] | +|**phone** | **String** | | [optional] | +|**userStatus** | **Integer** | User Status | [optional] | +|**objectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] | +|**objectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] | +|**anyTypeProp** | **Object** | 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 | [optional] | +|**anyTypePropNullable** | **Object** | 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. | [optional] | + + + diff --git a/samples/client/petstore/java/okhttp/docs/UserApi.md b/samples/client/petstore/java/okhttp/docs/UserApi.md new file mode 100644 index 000000000000..2c5974674074 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/UserApi.md @@ -0,0 +1,511 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | +| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | +| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | +| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | +| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | +| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | +| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | +| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | + + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + User user = new User(); // User | Created user object + try { + apiInstance.createUser(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**User**](User.md)| Created user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List user = Arrays.asList(); // List | List of user object + try { + apiInstance.createUsersWithListInput(user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **user** | [**List<User>**](User.md)| List of user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be deleted | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| The user name for login | | +| **password** | **String**| The password for login in clear text | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### 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 | - | + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + 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 + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### 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.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User user = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, user); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **username** | **String**| name that need to be deleted | | +| **user** | [**User**](User.md)| Updated user object | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/okhttp/docs/Value.md b/samples/client/petstore/java/okhttp/docs/Value.md new file mode 100644 index 000000000000..54c8fc245e72 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Value.md @@ -0,0 +1,12 @@ + + +# Value + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| + + + diff --git a/samples/client/petstore/java/okhttp/docs/ValuesApi.md b/samples/client/petstore/java/okhttp/docs/ValuesApi.md new file mode 100644 index 000000000000..4210bff03ec9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/ValuesApi.md @@ -0,0 +1,68 @@ +# ValuesApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getSomeValues**](ValuesApi.md#getSomeValues) | **GET** /values | Get some primitive variable values | + + + +# **getSomeValues** +> Variable getSomeValues() + +Get some primitive variable values + + + +### 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.ValuesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + ValuesApi apiInstance = new ValuesApi(defaultClient); + try { + Variable result = apiInstance.getSomeValues(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ValuesApi#getSomeValues"); + 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 + +[**Variable**](Variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Value | - | + diff --git a/samples/client/petstore/java/okhttp/docs/Variable.md b/samples/client/petstore/java/okhttp/docs/Variable.md new file mode 100644 index 000000000000..d179fb1775cf --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Variable.md @@ -0,0 +1,15 @@ + + +# Variable + +Value object + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | | | +|**value** | [**Value**](Value.md) | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Whale.md b/samples/client/petstore/java/okhttp/docs/Whale.md new file mode 100644 index 000000000000..30ce4bb82151 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Whale.md @@ -0,0 +1,15 @@ + + +# Whale + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasBaleen** | **Boolean** | | [optional] | +|**hasTeeth** | **Boolean** | | [optional] | +|**className** | **String** | | | + + + diff --git a/samples/client/petstore/java/okhttp/docs/Zebra.md b/samples/client/petstore/java/okhttp/docs/Zebra.md new file mode 100644 index 000000000000..f7c4389b6456 --- /dev/null +++ b/samples/client/petstore/java/okhttp/docs/Zebra.md @@ -0,0 +1,24 @@ + + +# Zebra + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | +|**className** | **String** | | | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| PLAINS | "plains" | +| MOUNTAIN | "mountain" | +| GREVYS | "grevys" | + + + diff --git a/samples/client/petstore/java/okhttp/git_push.sh b/samples/client/petstore/java/okhttp/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/petstore/java/okhttp/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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/client/petstore/java/okhttp/gradle.properties b/samples/client/petstore/java/okhttp/gradle.properties new file mode 100644 index 000000000000..a3408578278a --- /dev/null +++ b/samples/client/petstore/java/okhttp/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/samples/client/petstore/java/okhttp/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/okhttp/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..e6441136f3d4ba8a0da8d277868979cfbc8ad796 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe7d(#tha?_1uQys2KtHQ{)Qco)qwGjrdNL7thd^G5i8Os)CHqc>iOidS} z%nFEDdm=GXBw=yXe1W-ShHHFb?Cc70+$W~z_+}nAoHFYI1MV1wZegw*0y^tC*s%3h zhD3tN8b=Gv&rj}!SUM6|ajSPp*58KR7MPpI{oAJCtY~JECm)*m_x>AZEu>DFgUcby z1Qaw8lU4jZpQ_$;*7RME+gq1KySGG#Wql>aL~k9tLrSO()LWn*q&YxHEuzmwd1?aAtI zBJ>P=&$=l1efe1CDU;`Fd+_;&wI07?V0aAIgc(!{a z0Jg6Y=inXc3^n!U0Atk`iCFIQooHqcWhO(qrieUOW8X(x?(RD}iYDLMjSwffH2~tB z)oDgNBLB^AJBM1M^c5HdRx6fBfka`(LD-qrlh5jqH~);#nw|iyp)()xVYak3;Ybik z0j`(+69aK*B>)e_p%=wu8XC&9e{AO4c~O1U`5X9}?0mrd*m$_EUek{R?DNSh(=br# z#Q61gBzEpmy`$pA*6!87 zSDD+=@fTY7<4A?GLqpA?Pb2z$pbCc4B4zL{BeZ?F-8`s$?>*lXXtn*NC61>|*w7J* z$?!iB{6R-0=KFmyp1nnEmLsA-H0a6l+1uaH^g%c(p{iT&YFrbQ$&PRb8Up#X3@Zsk zD^^&LK~111%cqlP%!_gFNa^dTYT?rhkGl}5=fL{a`UViaXWI$k-UcHJwmaH1s=S$4 z%4)PdWJX;hh5UoK?6aWoyLxX&NhNRqKam7tcOkLh{%j3K^4Mgx1@i|Pi&}<^5>hs5 zm8?uOS>%)NzT(%PjVPGa?X%`N2TQCKbeH2l;cTnHiHppPSJ<7y-yEIiC!P*ikl&!B z%+?>VttCOQM@ShFguHVjxX^?mHX^hSaO_;pnyh^v9EumqSZTi+#f&_Vaija0Q-e*| z7ulQj6Fs*bbmsWp{`auM04gGwsYYdNNZcg|ph0OgD>7O}Asn7^Z=eI>`$2*v78;sj-}oMoEj&@)9+ycEOo92xSyY344^ z11Hb8^kdOvbf^GNAK++bYioknrpdN>+u8R?JxG=!2Kd9r=YWCOJYXYuM0cOq^FhEd zBg2puKy__7VT3-r*dG4c62Wgxi52EMCQ`bKgf*#*ou(D4-ZN$+mg&7$u!! z-^+Z%;-3IDwqZ|K=ah85OLwkO zKxNBh+4QHh)u9D?MFtpbl)us}9+V!D%w9jfAMYEb>%$A;u)rrI zuBudh;5PN}_6J_}l55P3l_)&RMlH{m!)ai-i$g)&*M`eN$XQMw{v^r@-125^RRCF0 z^2>|DxhQw(mtNEI2Kj(;KblC7x=JlK$@78`O~>V!`|1Lm-^JR$-5pUANAnb(5}B}JGjBsliK4& zk6y(;$e&h)lh2)L=bvZKbvh@>vLlreBdH8No2>$#%_Wp1U0N7Ank!6$dFSi#xzh|( zRi{Uw%-4W!{IXZ)fWx@XX6;&(m_F%c6~X8hx=BN1&q}*( zoaNjWabE{oUPb!Bt$eyd#$5j9rItB-h*5JiNi(v^e|XKAj*8(k<5-2$&ZBR5fF|JA z9&m4fbzNQnAU}r8ab>fFV%J0z5awe#UZ|bz?Ur)U9bCIKWEzi2%A+5CLqh?}K4JHi z4vtM;+uPsVz{Lfr;78W78gC;z*yTch~4YkLr&m-7%-xc ztw6Mh2d>_iO*$Rd8(-Cr1_V8EO1f*^@wRoSozS) zy1UoC@pruAaC8Z_7~_w4Q6n*&B0AjOmMWa;sIav&gu z|J5&|{=a@vR!~k-OjKEgPFCzcJ>#A1uL&7xTDn;{XBdeM}V=l3B8fE1--DHjSaxoSjNKEM9|U9#m2<3>n{Iuo`r3UZp;>GkT2YBNAh|b z^jTq-hJp(ebZh#Lk8hVBP%qXwv-@vbvoREX$TqRGTgEi$%_F9tZES@z8Bx}$#5eeG zk^UsLBH{bc2VBW)*EdS({yw=?qmevwi?BL6*=12k9zM5gJv1>y#ML4!)iiPzVaH9% zgSImetD@dam~e>{LvVh!phhzpW+iFvWpGT#CVE5TQ40n%F|p(sP5mXxna+Ev7PDwA zamaV4m*^~*xV+&p;W749xhb_X=$|LD;FHuB&JL5?*Y2-oIT(wYY2;73<^#46S~Gx| z^cez%V7x$81}UWqS13Gz80379Rj;6~WdiXWOSsdmzY39L;Hg3MH43o*y8ibNBBH`(av4|u;YPq%{R;IuYow<+GEsf@R?=@tT@!}?#>zIIn0CoyV!hq3mw zHj>OOjfJM3F{RG#6ujzo?y32m^tgSXf@v=J$ELdJ+=5j|=F-~hP$G&}tDZsZE?5rX ztGj`!S>)CFmdkccxM9eGIcGnS2AfK#gXwj%esuIBNJQP1WV~b~+D7PJTmWGTSDrR` zEAu4B8l>NPuhsk5a`rReSya2nfV1EK01+G!x8aBdTs3Io$u5!6n6KX%uv@DxAp3F@{4UYg4SWJtQ-W~0MDb|j-$lwVn znAm*Pl!?Ps&3wO=R115RWKb*JKoexo*)uhhHBncEDMSVa_PyA>k{Zm2(wMQ(5NM3# z)jkza|GoWEQo4^s*wE(gHz?Xsg4`}HUAcs42cM1-qq_=+=!Gk^y710j=66(cSWqUe zklbm8+zB_syQv5A2rj!Vbw8;|$@C!vfNmNV!yJIWDQ>{+2x zKjuFX`~~HKG~^6h5FntRpnnHt=D&rq0>IJ9#F0eM)Y-)GpRjiN7gkA8wvnG#K=q{q z9dBn8_~wm4J<3J_vl|9H{7q6u2A!cW{bp#r*-f{gOV^e=8S{nc1DxMHFwuM$;aVI^ zz6A*}m8N-&x8;aunp1w7_vtB*pa+OYBw=TMc6QK=mbA-|Cf* zvyh8D4LRJImooUaSb7t*fVfih<97Gf@VE0|z>NcBwBQze);Rh!k3K_sfunToZY;f2 z^HmC4KjHRVg+eKYj;PRN^|E0>Gj_zagfRbrki68I^#~6-HaHg3BUW%+clM1xQEdPYt_g<2K+z!$>*$9nQ>; zf9Bei{?zY^-e{q_*|W#2rJG`2fy@{%6u0i_VEWTq$*(ZN37|8lFFFt)nCG({r!q#9 z5VK_kkSJ3?zOH)OezMT{!YkCuSSn!K#-Rhl$uUM(bq*jY? zi1xbMVthJ`E>d>(f3)~fozjg^@eheMF6<)I`oeJYx4*+M&%c9VArn(OM-wp%M<-`x z7sLP1&3^%Nld9Dhm@$3f2}87!quhI@nwd@3~fZl_3LYW-B?Ia>ui`ELg z&Qfe!7m6ze=mZ`Ia9$z|ARSw|IdMpooY4YiPN8K z4B(ts3p%2i(Td=tgEHX z0UQ_>URBtG+-?0E;E7Ld^dyZ;jjw0}XZ(}-QzC6+NN=40oDb2^v!L1g9xRvE#@IBR zO!b-2N7wVfLV;mhEaXQ9XAU+>=XVA6f&T4Z-@AX!leJ8obP^P^wP0aICND?~w&NykJ#54x3_@r7IDMdRNy4Hh;h*!u(Ol(#0bJdwEo$5437-UBjQ+j=Ic>Q2z` zJNDf0yO6@mr6y1#n3)s(W|$iE_i8r@Gd@!DWDqZ7J&~gAm1#~maIGJ1sls^gxL9LLG_NhU!pTGty!TbhzQnu)I*S^54U6Yu%ZeCg`R>Q zhBv$n5j0v%O_j{QYWG!R9W?5_b&67KB$t}&e2LdMvd(PxN6Ir!H4>PNlerpBL>Zvyy!yw z-SOo8caEpDt(}|gKPBd$qND5#a5nju^O>V&;f890?yEOfkSG^HQVmEbM3Ugzu+UtH zC(INPDdraBN?P%kE;*Ae%Wto&sgw(crfZ#Qy(<4nk;S|hD3j{IQRI6Yq|f^basLY; z-HB&Je%Gg}Jt@={_C{L$!RM;$$|iD6vu#3w?v?*;&()uB|I-XqEKqZPS!reW9JkLewLb!70T7n`i!gNtb1%vN- zySZj{8-1>6E%H&=V}LM#xmt`J3XQoaD|@XygXjdZ1+P77-=;=eYpoEQ01B@L*a(uW zrZeZz?HJsw_4g0vhUgkg@VF8<-X$B8pOqCuWAl28uB|@r`19DTUQQsb^pfqB6QtiT z*`_UZ`fT}vtUY#%sq2{rchyfu*pCg;uec2$-$N_xgjZcoumE5vSI{+s@iLWoz^Mf; zuI8kDP{!XY6OP~q5}%1&L}CtfH^N<3o4L@J@zg1-mt{9L`s^z$Vgb|mr{@WiwAqKg zp#t-lhrU>F8o0s1q_9y`gQNf~Vb!F%70f}$>i7o4ho$`uciNf=xgJ>&!gSt0g;M>*x4-`U)ysFW&Vs^Vk6m%?iuWU+o&m(2Jm26Y(3%TL; zA7T)BP{WS!&xmxNw%J=$MPfn(9*^*TV;$JwRy8Zl*yUZi8jWYF>==j~&S|Xinsb%c z2?B+kpet*muEW7@AzjBA^wAJBY8i|#C{WtO_or&Nj2{=6JTTX05}|H>N2B|Wf!*3_ z7hW*j6p3TvpghEc6-wufFiY!%-GvOx*bZrhZu+7?iSrZL5q9}igiF^*R3%DE4aCHZ zqu>xS8LkW+Auv%z-<1Xs92u23R$nk@Pk}MU5!gT|c7vGlEA%G^2th&Q*zfg%-D^=f z&J_}jskj|Q;73NP4<4k*Y%pXPU2Thoqr+5uH1yEYM|VtBPW6lXaetokD0u z9qVek6Q&wk)tFbQ8(^HGf3Wp16gKmr>G;#G(HRBx?F`9AIRboK+;OfHaLJ(P>IP0w zyTbTkx_THEOs%Q&aPrxbZrJlio+hCC_HK<4%f3ZoSAyG7Dn`=X=&h@m*|UYO-4Hq0 z-Bq&+Ie!S##4A6OGoC~>ZW`Y5J)*ouaFl_e9GA*VSL!O_@xGiBw!AF}1{tB)z(w%c zS1Hmrb9OC8>0a_$BzeiN?rkPLc9%&;1CZW*4}CDDNr2gcl_3z+WC15&H1Zc2{o~i) z)LLW=WQ{?ricmC`G1GfJ0Yp4Dy~Ba;j6ZV4r{8xRs`13{dD!xXmr^Aga|C=iSmor% z8hi|pTXH)5Yf&v~exp3o+sY4B^^b*eYkkCYl*T{*=-0HniSA_1F53eCb{x~1k3*`W zr~};p1A`k{1DV9=UPnLDgz{aJH=-LQo<5%+Em!DNN252xwIf*wF_zS^!(XSm(9eoj z=*dXG&n0>)_)N5oc6v!>-bd(2ragD8O=M|wGW z!xJQS<)u70m&6OmrF0WSsr@I%T*c#Qo#Ha4d3COcX+9}hM5!7JIGF>7<~C(Ear^Sn zm^ZFkV6~Ula6+8S?oOROOA6$C&q&dp`>oR-2Ym3(HT@O7Sd5c~+kjrmM)YmgPH*tL zX+znN>`tv;5eOfX?h{AuX^LK~V#gPCu=)Tigtq9&?7Xh$qN|%A$?V*v=&-2F$zTUv z`C#WyIrChS5|Kgm_GeudCFf;)!WH7FI60j^0o#65o6`w*S7R@)88n$1nrgU(oU0M9 zx+EuMkC>(4j1;m6NoGqEkpJYJ?vc|B zOlwT3t&UgL!pX_P*6g36`ZXQ; z9~Cv}ANFnJGp(;ZhS(@FT;3e)0)Kp;h^x;$*xZn*k0U6-&FwI=uOGaODdrsp-!K$Ac32^c{+FhI-HkYd5v=`PGsg%6I`4d9Jy)uW0y%) zm&j^9WBAp*P8#kGJUhB!L?a%h$hJgQrx!6KCB_TRo%9{t0J7KW8!o1B!NC)VGLM5! zpZy5Jc{`r{1e(jd%jsG7k%I+m#CGS*BPA65ZVW~fLYw0dA-H_}O zrkGFL&P1PG9p2(%QiEWm6x;U-U&I#;Em$nx-_I^wtgw3xUPVVu zqSuKnx&dIT-XT+T10p;yjo1Y)z(x1fb8Dzfn8e yu?e%!_ptzGB|8GrCfu%p?(_ zQccdaaVK$5bz;*rnyK{_SQYM>;aES6Qs^lj9lEs6_J+%nIiuQC*fN;z8md>r_~Mfl zU%p5Dt_YT>gQqfr@`cR!$NWr~+`CZb%dn;WtzrAOI>P_JtsB76PYe*<%H(y>qx-`Kq!X_; z<{RpAqYhE=L1r*M)gNF3B8r(<%8mo*SR2hu zccLRZwGARt)Hlo1euqTyM>^!HK*!Q2P;4UYrysje@;(<|$&%vQekbn|0Ruu_Io(w4#%p6ld2Yp7tlA`Y$cciThP zKzNGIMPXX%&Ud0uQh!uQZz|FB`4KGD?3!ND?wQt6!n*f4EmCoJUh&b?;B{|lxs#F- z31~HQ`SF4x$&v00@(P+j1pAaj5!s`)b2RDBp*PB=2IB>oBF!*6vwr7Dp%zpAx*dPr zb@Zjq^XjN?O4QcZ*O+8>)|HlrR>oD*?WQl5ri3R#2?*W6iJ>>kH%KnnME&TT@ZzrHS$Q%LC?n|e>V+D+8D zYc4)QddFz7I8#}y#Wj6>4P%34dZH~OUDb?uP%-E zwjXM(?Sg~1!|wI(RVuxbu)-rH+O=igSho_pDCw(c6b=P zKk4ATlB?bj9+HHlh<_!&z0rx13K3ZrAR8W)!@Y}o`?a*JJsD+twZIv`W)@Y?Amu_u zz``@-e2X}27$i(2=9rvIu5uTUOVhzwu%mNazS|lZb&PT;XE2|B&W1>=B58#*!~D&) zfVmJGg8UdP*fx(>Cj^?yS^zH#o-$Q-*$SnK(ZVFkw+er=>N^7!)FtP3y~Xxnu^nzY zikgB>Nj0%;WOltWIob|}%lo?_C7<``a5hEkx&1ku$|)i>Rh6@3h*`slY=9U}(Ql_< zaNG*J8vb&@zpdhAvv`?{=zDedJ23TD&Zg__snRAH4eh~^oawdYi6A3w8<Ozh@Kw)#bdktM^GVb zrG08?0bG?|NG+w^&JvD*7LAbjED{_Zkc`3H!My>0u5Q}m!+6VokMLXxl`Mkd=g&Xx z-a>m*#G3SLlhbKB!)tnzfWOBV;u;ftU}S!NdD5+YtOjLg?X}dl>7m^gOpihrf1;PY zvll&>dIuUGs{Qnd- zwIR3oIrct8Va^Tm0t#(bJD7c$Z7DO9*7NnRZorrSm`b`cxz>OIC;jSE3DO8`hX955ui`s%||YQtt2 z5DNA&pG-V+4oI2s*x^>-$6J?p=I>C|9wZF8z;VjR??Icg?1w2v5Me+FgAeGGa8(3S z4vg*$>zC-WIVZtJ7}o9{D-7d>zCe|z#<9>CFve-OPAYsneTb^JH!Enaza#j}^mXy1 z+ULn^10+rWLF6j2>Ya@@Kq?26>AqK{A_| zQKb*~F1>sE*=d?A?W7N2j?L09_7n+HGi{VY;MoTGr_)G9)ot$p!-UY5zZ2Xtbm=t z@dpPSGwgH=QtIcEulQNI>S-#ifbnO5EWkI;$A|pxJd885oM+ zGZ0_0gDvG8q2xebj+fbCHYfAXuZStH2j~|d^sBAzo46(K8n59+T6rzBwK)^rfPT+B zyIFw)9YC-V^rhtK`!3jrhmW-sTmM+tPH+;nwjL#-SjQPUZ53L@A>y*rt(#M(qsiB2 zx6B)dI}6Wlsw%bJ8h|(lhkJVogQZA&n{?Vgs6gNSXzuZpEyu*xySy8ro07QZ7Vk1!3tJphN_5V7qOiyK8p z#@jcDD8nmtYi1^l8ml;AF<#IPK?!pqf9D4moYk>d99Im}Jtwj6c#+A;f)CQ*f-hZ< z=p_T86jog%!p)D&5g9taSwYi&eP z#JuEK%+NULWus;0w32-SYFku#i}d~+{Pkho&^{;RxzP&0!RCm3-9K6`>KZpnzS6?L z^H^V*s!8<>x8bomvD%rh>Zp3>Db%kyin;qtl+jAv8Oo~1g~mqGAC&Qi_wy|xEt2iz zWAJEfTV%cl2Cs<1L&DLRVVH05EDq`pH7Oh7sR`NNkL%wi}8n>IXcO40hp+J+sC!W?!krJf!GJNE8uj zg-y~Ns-<~D?yqbzVRB}G>0A^f0!^N7l=$m0OdZuqAOQqLc zX?AEGr1Ht+inZ-Qiwnl@Z0qukd__a!C*CKuGdy5#nD7VUBM^6OCpxCa2A(X;e0&V4 zM&WR8+wErQ7UIc6LY~Q9x%Sn*Tn>>P`^t&idaOEnOd(Ufw#>NoR^1QdhJ8s`h^|R_ zXX`c5*O~Xdvh%q;7L!_!ohf$NfEBmCde|#uVZvEo>OfEq%+Ns7&_f$OR9xsihRpBb z+cjk8LyDm@U{YN>+r46?nn{7Gh(;WhFw6GAxtcKD+YWV?uge>;+q#Xx4!GpRkVZYu zzsF}1)7$?%s9g9CH=Zs+B%M_)+~*j3L0&Q9u7!|+T`^O{xE6qvAP?XWv9_MrZKdo& z%IyU)$Q95AB4!#hT!_dA>4e@zjOBD*Y=XjtMm)V|+IXzjuM;(l+8aA5#Kaz_$rR6! zj>#&^DidYD$nUY(D$mH`9eb|dtV0b{S>H6FBfq>t5`;OxA4Nn{J(+XihF(stSche7$es&~N$epi&PDM_N`As;*9D^L==2Q7Z2zD+CiU(|+-kL*VG+&9!Yb3LgPy?A zm7Z&^qRG_JIxK7-FBzZI3Q<;{`DIxtc48k> zc|0dmX;Z=W$+)qE)~`yn6MdoJ4co;%!`ddy+FV538Y)j(vg}5*k(WK)KWZ3WaOG!8 z!syGn=s{H$odtpqFrT#JGM*utN7B((abXnpDM6w56nhw}OY}0TiTG1#f*VFZr+^-g zbP10`$LPq_;PvrA1XXlyx2uM^mrjTzX}w{yuLo-cOClE8MMk47T25G8M!9Z5ypOSV zAJUBGEg5L2fY)ZGJb^E34R2zJ?}Vf>{~gB!8=5Z) z9y$>5c)=;o0HeHHSuE4U)#vG&KF|I%-cF6f$~pdYJWk_dD}iOA>iA$O$+4%@>JU08 zS`ep)$XLPJ+n0_i@PkF#ri6T8?ZeAot$6JIYHm&P6EB=BiaNY|aA$W0I+nz*zkz_z zkEru!tj!QUffq%)8y0y`T&`fuus-1p>=^hnBiBqD^hXrPs`PY9tU3m0np~rISY09> z`P3s=-kt_cYcxWd{de@}TwSqg*xVhp;E9zCsnXo6z z?f&Sv^U7n4`xr=mXle94HzOdN!2kB~4=%)u&N!+2;z6UYKUDqi-s6AZ!haB;@&B`? z_TRX0%@suz^TRdCb?!vNJYPY8L_}&07uySH9%W^Tc&1pia6y1q#?*Drf}GjGbPjBS zbOPcUY#*$3sL2x4v_i*Y=N7E$mR}J%|GUI(>WEr+28+V z%v5{#e!UF*6~G&%;l*q*$V?&r$Pp^sE^i-0$+RH3ERUUdQ0>rAq2(2QAbG}$y{de( z>{qD~GGuOk559Y@%$?N^1ApVL_a704>8OD%8Y%8B;FCt%AoPu8*D1 zLB5X>b}Syz81pn;xnB}%0FnwazlWfUV)Z-~rZg6~b z6!9J$EcE&sEbzcy?CI~=boWA&eeIa%z(7SE^qgVLz??1Vbc1*aRvc%Mri)AJaAG!p z$X!_9Ds;Zz)f+;%s&dRcJt2==P{^j3bf0M=nJd&xwUGlUFn?H=2W(*2I2Gdu zv!gYCwM10aeus)`RIZSrCK=&oKaO_Ry~D1B5!y0R=%!i2*KfXGYX&gNv_u+n9wiR5 z*e$Zjju&ODRW3phN925%S(jL+bCHv6rZtc?!*`1TyYXT6%Ju=|X;6D@lq$8T zW{Y|e39ioPez(pBH%k)HzFITXHvnD6hw^lIoUMA;qAJ^CU?top1fo@s7xT13Fvn1H z6JWa-6+FJF#x>~+A;D~;VDs26>^oH0EI`IYT2iagy23?nyJ==i{g4%HrAf1-*v zK1)~@&(KkwR7TL}L(A@C_S0G;-GMDy=MJn2$FP5s<%wC)4jC5PXoxrQBFZ_k0P{{s@sz+gX`-!=T8rcB(=7vW}^K6oLWMmp(rwDh}b zwaGGd>yEy6fHv%jM$yJXo5oMAQ>c9j`**}F?MCry;T@47@r?&sKHgVe$MCqk#Z_3S z1GZI~nOEN*P~+UaFGnj{{Jo@16`(qVNtbU>O0Hf57-P>x8Jikp=`s8xWs^dAJ9lCQ z)GFm+=OV%AMVqVATtN@|vp61VVAHRn87}%PC^RAzJ%JngmZTasWBAWsoAqBU+8L8u z4A&Pe?fmTm0?mK-BL9t+{y7o(7jm+RpOhL9KnY#E&qu^}B6=K_dB}*VlSEiC9fn)+V=J;OnN)Ta5v66ic1rG+dGAJ1 z1%Zb_+!$=tQ~lxQrzv3x#CPb?CekEkA}0MYSgx$Jdd}q8+R=ma$|&1a#)TQ=l$1tQ z=tL9&_^vJ)Pk}EDO-va`UCT1m#Uty1{v^A3P~83_#v^ozH}6*9mIjIr;t3Uv%@VeW zGL6(CwCUp)Jq%G0bIG%?{_*Y#5IHf*5M@wPo6A{$Um++Co$wLC=J1aoG93&T7Ho}P z=mGEPP7GbvoG!uD$k(H3A$Z))+i{Hy?QHdk>3xSBXR0j!11O^mEe9RHmw!pvzv?Ua~2_l2Yh~_!s1qS`|0~0)YsbHSz8!mG)WiJE| z2f($6TQtt6L_f~ApQYQKSb=`053LgrQq7G@98#igV>y#i==-nEjQ!XNu9 z~;mE+gtj4IDDNQJ~JVk5Ux6&LCSFL!y=>79kE9=V}J7tD==Ga+IW zX)r7>VZ9dY=V&}DR))xUoV!u(Z|%3ciQi_2jl}3=$Agc(`RPb z8kEBpvY>1FGQ9W$n>Cq=DIpski};nE)`p3IUw1Oz0|wxll^)4dq3;CCY@RyJgFgc# zKouFh!`?Xuo{IMz^xi-h=StCis_M7yq$u) z?XHvw*HP0VgR+KR6wI)jEMX|ssqYvSf*_3W8zVTQzD?3>H!#>InzpSO)@SC8q*ii- z%%h}_#0{4JG;Jm`4zg};BPTGkYamx$Xo#O~lBirRY)q=5M45n{GCfV7h9qwyu1NxOMoP4)jjZMxmT|IQQh0U7C$EbnMN<3)Kk?fFHYq$d|ICu>KbY_hO zTZM+uKHe(cIZfEqyzyYSUBZa8;Fcut-GN!HSA9ius`ltNebF46ZX_BbZNU}}ZOm{M2&nANL9@0qvih15(|`S~z}m&h!u4x~(%MAO$jHRWNfuxWF#B)E&g3ghSQ9|> z(MFaLQj)NE0lowyjvg8z0#m6FIuKE9lDO~Glg}nSb7`~^&#(Lw{}GVOS>U)m8bF}x zVjbXljBm34Cs-yM6TVusr+3kYFjr28STT3g056y3cH5Tmge~ASxBj z%|yb>$eF;WgrcOZf569sDZOVwoo%8>XO>XQOX1OyN9I-SQgrm;U;+#3OI(zrWyow3 zk==|{lt2xrQ%FIXOTejR>;wv(Pb8u8}BUpx?yd(Abh6? zsoO3VYWkeLnF43&@*#MQ9-i-d0t*xN-UEyNKeyNMHw|A(k(_6QKO=nKMCxD(W(Yop zsRQ)QeL4X3Lxp^L%wzi2-WVSsf61dqliPUM7srDB?Wm6Lzn0&{*}|IsKQW;02(Y&| zaTKv|`U(pSzuvR6Rduu$wzK_W-Y-7>7s?G$)U}&uK;<>vU}^^ns@Z!p+9?St1s)dG zK%y6xkPyyS1$~&6v{kl?Md6gwM|>mt6Upm>oa8RLD^8T{0?HC!Z>;(Bob7el(DV6x zi`I)$&E&ngwFS@bi4^xFLAn`=fzTC;aimE^!cMI2n@Vo%Ae-ne`RF((&5y6xsjjAZ zVguVoQ?Z9uk$2ON;ersE%PU*xGO@T*;j1BO5#TuZKEf(mB7|g7pcEA=nYJ{s3vlbg zd4-DUlD{*6o%Gc^N!Nptgay>j6E5;3psI+C3Q!1ZIbeCubW%w4pq9)MSDyB{HLm|k zxv-{$$A*pS@csolri$Ge<4VZ}e~78JOL-EVyrbxKra^d{?|NnPp86!q>t<&IP07?Z z^>~IK^k#OEKgRH+LjllZXk7iA>2cfH6+(e&9ku5poo~6y{GC5>(bRK7hwjiurqAiZ zg*DmtgY}v83IjE&AbiWgMyFbaRUPZ{lYiz$U^&Zt2YjG<%m((&_JUbZcfJ22(>bi5 z!J?<7AySj0JZ&<-qXX;mcV!f~>G=sB0KnjWca4}vrtunD^1TrpfeS^4dvFr!65knK zZh`d;*VOkPs4*-9kL>$GP0`(M!j~B;#x?Ba~&s6CopvO86oM?-? zOw#dIRc;6A6T?B`Qp%^<U5 z19x(ywSH$_N+Io!6;e?`tWaM$`=Db!gzx|lQ${DG!zb1Zl&|{kX0y6xvO1o z220r<-oaS^^R2pEyY;=Qllqpmue|5yI~D|iI!IGt@iod{Opz@*ml^w2bNs)p`M(Io z|E;;m*Xpjd9l)4G#KaWfV(t8YUn@A;nK^#xgv=LtnArX|vWQVuw3}B${h+frU2>9^ z!l6)!Uo4`5k`<<;E(ido7M6lKTgWezNLq>U*=uz&s=cc$1%>VrAeOoUtA|T6gO4>UNqsdK=NF*8|~*sl&wI=x9-EGiq*aqV!(VVXA57 zw9*o6Ir8Lj1npUXvlevtn(_+^X5rzdR>#(}4YcB9O50q97%rW2me5_L=%ffYPUSRc z!vv?Kv>dH994Qi>U(a<0KF6NH5b16enCp+mw^Hb3Xs1^tThFpz!3QuN#}KBbww`(h z7GO)1olDqy6?T$()R7y%NYx*B0k_2IBiZ14&8|JPFxeMF{vSTxF-Vi3+ZOI=Thq2} zyQgjYY1_7^ZQHh{?P))4+qUiQJLi1&{yE>h?~jU%tjdV0h|FENbM3X(KnJdPKc?~k zh=^Ixv*+smUll!DTWH!jrV*wSh*(mx0o6}1@JExzF(#9FXgmTXVoU+>kDe68N)dkQ zH#_98Zv$}lQwjKL@yBd;U(UD0UCl322=pav<=6g>03{O_3oKTq;9bLFX1ia*lw;#K zOiYDcBJf)82->83N_Y(J7Kr_3lE)hAu;)Q(nUVydv+l+nQ$?|%MWTy`t>{havFSQloHwiIkGK9YZ79^9?AZo0ZyQlVR#}lF%dn5n%xYksXf8gnBm=wO7g_^! zauQ-bH1Dc@3ItZ-9D_*pH}p!IG7j8A_o94#~>$LR|TFq zZ-b00*nuw|-5C2lJDCw&8p5N~Z1J&TrcyErds&!l3$eSz%`(*izc;-?HAFD9AHb-| z>)id`QCrzRws^9(#&=pIx9OEf2rmlob8sK&xPCWS+nD~qzU|qG6KwA{zbikcfQrdH z+ zQg>O<`K4L8rN7`GJB0*3<3`z({lWe#K!4AZLsI{%z#ja^OpfjU{!{)x0ZH~RB0W5X zTwN^w=|nA!4PEU2=LR05x~}|B&ZP?#pNgDMwD*ajI6oJqv!L81gu=KpqH22avXf0w zX3HjbCI!n9>l046)5rr5&v5ja!xkKK42zmqHzPx$9Nn_MZk`gLeSLgC=LFf;H1O#B zn=8|^1iRrujHfbgA+8i<9jaXc;CQBAmQvMGQPhFec2H1knCK2x!T`e6soyrqCamX% zTQ4dX_E*8so)E*TB$*io{$c6X)~{aWfaqdTh=xEeGvOAN9H&-t5tEE-qso<+C!2>+ zskX51H-H}#X{A75wqFe-J{?o8Bx|>fTBtl&tcbdR|132Ztqu5X0i-pisB-z8n71%q%>EF}yy5?z=Ve`}hVh{Drv1YWL zW=%ug_&chF11gDv3D6B)Tz5g54H0mDHNjuKZ+)CKFk4Z|$RD zfRuKLW`1B>B?*RUfVd0+u8h3r-{@fZ{k)c!93t1b0+Q9vOaRnEn1*IL>5Z4E4dZ!7 ztp4GP-^1d>8~LMeb}bW!(aAnB1tM_*la=Xx)q(I0Y@__Zd$!KYb8T2VBRw%e$iSdZ zkwdMwd}eV9q*;YvrBFTv1>1+}{H!JK2M*C|TNe$ZSA>UHKk);wz$(F$rXVc|sI^lD zV^?_J!3cLM;GJuBMbftbaRUs$;F}HDEDtIeHQ)^EJJ1F9FKJTGH<(Jj`phE6OuvE) zqK^K`;3S{Y#1M@8yRQwH`?kHMq4tHX#rJ>5lY3DM#o@or4&^_xtBC(|JpGTfrbGkA z2Tu+AyT^pHannww!4^!$5?@5v`LYy~T`qs7SYt$JgrY(w%C+IWA;ZkwEF)u5sDvOK zGk;G>Mh&elvXDcV69J_h02l&O;!{$({fng9Rlc3ID#tmB^FIG^w{HLUpF+iB`|
NnX)EH+Nua)3Y(c z&{(nX_ht=QbJ%DzAya}!&uNu!4V0xI)QE$SY__m)SAKcN0P(&JcoK*Lxr@P zY&P=}&B3*UWNlc|&$Oh{BEqwK2+N2U$4WB7Fd|aIal`FGANUa9E-O)!gV`((ZGCc$ zBJA|FFrlg~9OBp#f7aHodCe{6= zay$6vN~zj1ddMZ9gQ4p32(7wD?(dE>KA2;SOzXRmPBiBc6g`eOsy+pVcHu=;Yd8@{ zSGgXf@%sKKQz~;!J;|2fC@emm#^_rnO0esEn^QxXgJYd`#FPWOUU5b;9eMAF zZhfiZb|gk8aJIw*YLp4!*(=3l8Cp{(%p?ho22*vN9+5NLV0TTazNY$B5L6UKUrd$n zjbX%#m7&F#U?QNOBXkiiWB*_tk+H?N3`vg;1F-I+83{M2!8<^nydGr5XX}tC!10&e z7D36bLaB56WrjL&HiiMVtpff|K%|*{t*ltt^5ood{FOG0<>k&1h95qPio)2`eL${YAGIx(b4VN*~nKn6E~SIQUuRH zQ+5zP6jfnP$S0iJ@~t!Ai3o`X7biohli;E zT#yXyl{bojG@-TGZzpdVDXhbmF%F9+-^YSIv|MT1l3j zrxOFq>gd2%U}?6}8mIj?M zc077Zc9fq(-)4+gXv?Az26IO6eV`RAJz8e3)SC7~>%rlzDwySVx*q$ygTR5kW2ds- z!HBgcq0KON9*8Ff$X0wOq$`T7ml(@TF)VeoF}x1OttjuVHn3~sHrMB++}f7f9H%@f z=|kP_?#+fve@{0MlbkC9tyvQ_R?lRdRJ@$qcB(8*jyMyeME5ns6ypVI1Xm*Zr{DuS zZ!1)rQfa89c~;l~VkCiHI|PCBd`S*2RLNQM8!g9L6?n`^evQNEwfO@&JJRme+uopQX0%Jo zgd5G&#&{nX{o?TQwQvF1<^Cg3?2co;_06=~Hcb6~4XWpNFL!WU{+CK;>gH%|BLOh7@!hsa(>pNDAmpcuVO-?;Bic17R}^|6@8DahH)G z!EmhsfunLL|3b=M0MeK2vqZ|OqUqS8npxwge$w-4pFVXFq$_EKrZY?BuP@Az@(k`L z`ViQBSk`y+YwRT;&W| z2e3UfkCo^uTA4}Qmmtqs+nk#gNr2W4 zTH%hhErhB)pkXR{B!q5P3-OM+M;qu~f>}IjtF%>w{~K-0*jPVLl?Chz&zIdxp}bjx zStp&Iufr58FTQ36AHU)0+CmvaOpKF;W@sMTFpJ`j;3d)J_$tNQI^c<^1o<49Z(~K> z;EZTBaVT%14(bFw2ob@?JLQ2@(1pCdg3S%E4*dJ}dA*v}_a4_P(a`cHnBFJxNobAv zf&Zl-Yt*lhn-wjZsq<9v-IsXxAxMZ58C@e0!rzhJ+D@9^3~?~yllY^s$?&oNwyH!#~6x4gUrfxplCvK#!f z$viuszW>MFEcFL?>ux*((!L$;R?xc*myjRIjgnQX79@UPD$6Dz0jutM@7h_pq z0Zr)#O<^y_K6jfY^X%A-ip>P%3saX{!v;fxT-*0C_j4=UMH+Xth(XVkVGiiKE#f)q z%Jp=JT)uy{&}Iq2E*xr4YsJ5>w^=#-mRZ4vPXpI6q~1aFwi+lQcimO45V-JXP;>(Q zo={U`{=_JF`EQj87Wf}{Qy35s8r1*9Mxg({CvOt}?Vh9d&(}iI-quvs-rm~P;eRA@ zG5?1HO}puruc@S{YNAF3vmUc2B4!k*yi))<5BQmvd3tr}cIs#9)*AX>t`=~{f#Uz0 z0&Nk!7sSZwJe}=)-R^$0{yeS!V`Dh7w{w5rZ9ir!Z7Cd7dwZcK;BT#V0bzTt>;@Cl z#|#A!-IL6CZ@eHH!CG>OO8!%G8&8t4)Ro@}USB*k>oEUo0LsljsJ-%5Mo^MJF2I8- z#v7a5VdJ-Cd%(a+y6QwTmi+?f8Nxtm{g-+WGL>t;s#epv7ug>inqimZCVm!uT5Pf6 ziEgQt7^%xJf#!aPWbuC_3Nxfb&CFbQy!(8ANpkWLI4oSnH?Q3f?0k1t$3d+lkQs{~(>06l&v|MpcFsyAv zin6N!-;pggosR*vV=DO(#+}4ps|5$`udE%Kdmp?G7B#y%H`R|i8skKOd9Xzx8xgR$>Zo2R2Ytktq^w#ul4uicxW#{ zFjG_RNlBroV_n;a7U(KIpcp*{M~e~@>Q#Av90Jc5v%0c>egEdY4v3%|K1XvB{O_8G zkTWLC>OZKf;XguMH2-Pw{BKbFzaY;4v2seZV0>^7Q~d4O=AwaPhP3h|!hw5aqOtT@ z!SNz}$of**Bl3TK209@F=Tn1+mgZa8yh(Png%Zd6Mt}^NSjy)etQrF zme*llAW=N_8R*O~d2!apJnF%(JcN??=`$qs3Y+~xs>L9x`0^NIn!8mMRFA_tg`etw z3k{9JAjnl@ygIiJcNHTy02GMAvBVqEss&t2<2mnw!; zU`J)0>lWiqVqo|ex7!+@0i>B~BSU1A_0w#Ee+2pJx0BFiZ7RDHEvE*ptc9md(B{&+ zKE>TM)+Pd>HEmdJao7U@S>nL(qq*A)#eLOuIfAS@j`_sK0UEY6OAJJ-kOrHG zjHx`g!9j*_jRcJ%>CE9K2MVf?BUZKFHY?EpV6ai7sET-tqk=nDFh-(65rhjtlKEY% z@G&cQ<5BKatfdA1FKuB=i>CCC5(|9TMW%K~GbA4}80I5%B}(gck#Wlq@$nO3%@QP_ z8nvPkJFa|znk>V92cA!K1rKtr)skHEJD;k8P|R8RkCq1Rh^&}Evwa4BUJz2f!2=MH zo4j8Y$YL2313}H~F7@J7mh>u%556Hw0VUOz-Un@ZASCL)y8}4XXS`t1AC*^>PLwIc zUQok5PFS=*#)Z!3JZN&eZ6ZDP^-c@StY*t20JhCnbMxXf=LK#;`4KHEqMZ-Ly9KsS zI2VUJGY&PmdbM+iT)zek)#Qc#_i4uH43 z@T5SZBrhNCiK~~esjsO9!qBpaWK<`>!-`b71Y5ReXQ4AJU~T2Njri1CEp5oKw;Lnm)-Y@Z3sEY}XIgSy%xo=uek(kAAH5MsV$V3uTUsoTzxp_rF=tx zV07vlJNKtJhCu`b}*#m&5LV4TAE&%KtHViDAdv#c^x`J7bg z&N;#I2GkF@SIGht6p-V}`!F_~lCXjl1BdTLIjD2hH$J^YFN`7f{Q?OHPFEM$65^!u zNwkelo*5+$ZT|oQ%o%;rBX$+?xhvjb)SHgNHE_yP%wYkkvXHS{Bf$OiKJ5d1gI0j< zF6N}Aq=(WDo(J{e-uOecxPD>XZ@|u-tgTR<972`q8;&ZD!cep^@B5CaqFz|oU!iFj zU0;6fQX&~15E53EW&w1s9gQQ~Zk16X%6 zjG`j0yq}4deX2?Tr(03kg>C(!7a|b9qFI?jcE^Y>-VhudI@&LI6Qa}WQ>4H_!UVyF z((cm&!3gmq@;BD#5P~0;_2qgZhtJS|>WdtjY=q zLnHH~Fm!cxw|Z?Vw8*~?I$g#9j&uvgm7vPr#&iZgPP~v~BI4jOv;*OQ?jYJtzO<^y z7-#C={r7CO810!^s(MT!@@Vz_SVU)7VBi(e1%1rvS!?PTa}Uv`J!EP3s6Y!xUgM^8 z4f!fq<3Wer_#;u!5ECZ|^c1{|q_lh3m^9|nsMR1#Qm|?4Yp5~|er2?W^7~cl;_r4WSme_o68J9p03~Hc%X#VcX!xAu%1`R!dfGJCp zV*&m47>s^%Ib0~-2f$6oSgn3jg8m%UA;ArcdcRyM5;}|r;)?a^D*lel5C`V5G=c~k zy*w_&BfySOxE!(~PI$*dwG><+-%KT5p?whOUMA*k<9*gi#T{h3DAxzAPxN&Xws8o9Cp*`PA5>d9*Z-ynV# z9yY*1WR^D8|C%I@vo+d8r^pjJ$>eo|j>XiLWvTWLl(^;JHCsoPgem6PvegHb-OTf| zvTgsHSa;BkbG=(NgPO|CZu9gUCGr$8*EoH2_Z#^BnxF0yM~t`|9ws_xZ8X8iZYqh! zAh;HXJ)3P&)Q0(&F>!LN0g#bdbis-cQxyGn9Qgh`q+~49Fqd2epikEUw9caM%V6WgP)532RMRW}8gNS%V%Hx7apSz}tn@bQy!<=lbhmAH=FsMD?leawbnP5BWM0 z5{)@EEIYMu5;u)!+HQWhQ;D3_Cm_NADNeb-f56}<{41aYq8p4=93d=-=q0Yx#knGYfXVt z+kMxlus}t2T5FEyCN~!}90O_X@@PQpuy;kuGz@bWft%diBTx?d)_xWd_-(!LmVrh**oKg!1CNF&LX4{*j|) zIvjCR0I2UUuuEXh<9}oT_zT#jOrJAHNLFT~Ilh9hGJPI1<5`C-WA{tUYlyMeoy!+U zhA#=p!u1R7DNg9u4|QfED-2TuKI}>p#2P9--z;Bbf4Op*;Q9LCbO&aL2i<0O$ByoI z!9;Ght733FC>Pz>$_mw(F`zU?`m@>gE`9_p*=7o=7av`-&ifU(^)UU`Kg3Kw`h9-1 z6`e6+im=|m2v`pN(2dE%%n8YyQz;#3Q-|x`91z?gj68cMrHl}C25|6(_dIGk*8cA3 zRHB|Nwv{@sP4W+YZM)VKI>RlB`n=Oj~Rzx~M+Khz$N$45rLn6k1nvvD^&HtsMA4`s=MmuOJID@$s8Ph4E zAmSV^+s-z8cfv~Yd(40Sh4JG#F~aB>WFoX7ykaOr3JaJ&Lb49=B8Vk-SQT9%7TYhv z?-Pprt{|=Y5ZQ1?od|A<_IJU93|l4oAfBm?3-wk{O<8ea+`}u%(kub(LFo2zFtd?4 zwpN|2mBNywv+d^y_8#<$r>*5+$wRTCygFLcrwT(qc^n&@9r+}Kd_u@Ithz(6Qb4}A zWo_HdBj#V$VE#l6pD0a=NfB0l^6W^g`vm^sta>Tly?$E&{F?TTX~DsKF~poFfmN%2 z4x`Dc{u{Lkqz&y!33;X}weD}&;7p>xiI&ZUb1H9iD25a(gI|`|;G^NwJPv=1S5e)j z;U;`?n}jnY6rA{V^ zxTd{bK)Gi^odL3l989DQlN+Zs39Xe&otGeY(b5>rlIqfc7Ap4}EC?j<{M=hlH{1+d zw|c}}yx88_xQr`{98Z!d^FNH77=u(p-L{W6RvIn40f-BldeF-YD>p6#)(Qzf)lfZj z?3wAMtPPp>vMehkT`3gToPd%|D8~4`5WK{`#+}{L{jRUMt zrFz+O$C7y8$M&E4@+p+oV5c%uYzbqd2Y%SSgYy#xh4G3hQv>V*BnuKQhBa#=oZB~w{azUB+q%bRe_R^ z>fHBilnRTUfaJ201czL8^~Ix#+qOHSO)A|xWLqOxB$dT2W~)e-r9;bm=;p;RjYahB z*1hegN(VKK+ztr~h1}YP@6cfj{e#|sS`;3tJhIJK=tVJ-*h-5y9n*&cYCSdg#EHE# zSIx=r#qOaLJoVVf6v;(okg6?*L_55atl^W(gm^yjR?$GplNP>BZsBYEf_>wM0Lc;T zhf&gpzOWNxS>m+mN92N0{;4uw`P+9^*|-1~$uXpggj4- z^SFc4`uzj2OwdEVT@}Q`(^EcQ_5(ZtXTql*yGzdS&vrS_w>~~ra|Nb5abwf}Y!uq6R5f&6g2ge~2p(%c< z@O)cz%%rr4*cRJ5f`n@lvHNk@lE1a*96Kw6lJ~B-XfJW%?&-y?;E&?1AacU@`N`!O z6}V>8^%RZ7SQnZ-z$(jsX`amu*5Fj8g!3RTRwK^`2_QHe;_2y_n|6gSaGyPmI#kA0sYV<_qOZc#-2BO%hX)f$s-Z3xlI!ub z^;3ru11DA`4heAu%}HIXo&ctujzE2!6DIGE{?Zs>2}J+p&C$rc7gJC35gxhflorvsb%sGOxpuWhF)dL_&7&Z99=5M0b~Qa;Mo!j&Ti_kXW!86N%n= zSC@6Lw>UQ__F&+&Rzv?gscwAz8IP!n63>SP)^62(HK98nGjLY2*e^OwOq`3O|C92? z;TVhZ2SK%9AGW4ZavTB9?)mUbOoF`V7S=XM;#3EUpR+^oHtdV!GK^nXzCu>tpR|89 zdD{fnvCaN^^LL%amZ^}-E+214g&^56rpdc@yv0b<3}Ys?)f|fXN4oHf$six)-@<;W&&_kj z-B}M5U*1sb4)77aR=@%I?|Wkn-QJVuA96an25;~!gq(g1@O-5VGo7y&E_srxL6ZfS z*R%$gR}dyONgju*D&?geiSj7SZ@ftyA|}(*Y4KbvU!YLsi1EDQQCnb+-cM=K1io78o!v*);o<XwjaQH%)uIP&Zm?)Nfbfn;jIr z)d#!$gOe3QHp}2NBak@yYv3m(CPKkwI|{;d=gi552u?xj9ObCU^DJFQp4t4e1tPzM zvsRIGZ6VF+{6PvqsplMZWhz10YwS={?`~O0Ec$`-!klNUYtzWA^f9m7tkEzCy<_nS z=&<(awFeZvt51>@o_~>PLs05CY)$;}Oo$VDO)?l-{CS1Co=nxjqben*O1BR>#9`0^ zkwk^k-wcLCLGh|XLjdWv0_Hg54B&OzCE^3NCP}~OajK-LuRW53CkV~Su0U>zN%yQP zH8UH#W5P3-!ToO-2k&)}nFe`t+mdqCxxAHgcifup^gKpMObbox9LFK;LP3}0dP-UW z?Zo*^nrQ6*$FtZ(>kLCc2LY*|{!dUn$^RW~m9leoF|@Jy|M5p-G~j%+P0_#orRKf8 zvuu5<*XO!B?1E}-*SY~MOa$6c%2cM+xa8}_8x*aVn~57v&W(0mqN1W`5a7*VN{SUH zXz98DDyCnX2EPl-`Lesf`=AQT%YSDb`$%;(jUTrNen$NPJrlpPDP}prI>Ml!r6bCT;mjsg@X^#&<}CGf0JtR{Ecwd&)2zuhr#nqdgHj+g2n}GK9CHuwO zk>oZxy{vcOL)$8-}L^iVfJHAGfwN$prHjYV0ju}8%jWquw>}_W6j~m<}Jf!G?~r5&Rx)!9JNX!ts#SGe2HzobV5); zpj@&`cNcO&q+%*<%D7za|?m5qlmFK$=MJ_iv{aRs+BGVrs)98BlN^nMr{V_fcl_;jkzRju+c-y?gqBC_@J0dFLq-D9@VN&-`R9U;nv$Hg?>$oe4N&Ht$V_(JR3TG^! zzJsbQbi zFE6-{#9{G{+Z}ww!ycl*7rRdmU#_&|DqPfX3CR1I{Kk;bHwF6jh0opI`UV2W{*|nn zf_Y@%wW6APb&9RrbEN=PQRBEpM(N1w`81s=(xQj6 z-eO0k9=Al|>Ej|Mw&G`%q8e$2xVz1v4DXAi8G};R$y)ww638Y=9y$ZYFDM$}vzusg zUf+~BPX>(SjA|tgaFZr_e0{)+z9i6G#lgt=F_n$d=beAt0Sa0a7>z-?vcjl3e+W}+ z1&9=|vC=$co}-Zh*%3588G?v&U7%N1Qf-wNWJ)(v`iO5KHSkC5&g7CrKu8V}uQGcfcz zmBz#Lbqwqy#Z~UzHgOQ;Q-rPxrRNvl(&u6ts4~0=KkeS;zqURz%!-ERppmd%0v>iRlEf+H$yl{_8TMJzo0 z>n)`On|7=WQdsqhXI?#V{>+~}qt-cQbokEbgwV3QvSP7&hK4R{Z{aGHVS3;+h{|Hz z6$Js}_AJr383c_+6sNR|$qu6dqHXQTc6?(XWPCVZv=)D#6_;D_8P-=zOGEN5&?~8S zl5jQ?NL$c%O)*bOohdNwGIKM#jSAC?BVY={@A#c9GmX0=T(0G}xs`-%f3r=m6-cpK z!%waekyAvm9C3%>sixdZj+I(wQlbB4wv9xKI*T13DYG^T%}zZYJ|0$Oj^YtY+d$V$ zAVudSc-)FMl|54n=N{BnZTM|!>=bhaja?o7s+v1*U$!v!qQ%`T-6fBvmdPbVmro&d zk07TOp*KuxRUSTLRrBj{mjsnF8`d}rMViY8j`jo~Hp$fkv9F_g(jUo#Arp;Xw0M$~ zRIN!B22~$kx;QYmOkos@%|5k)!QypDMVe}1M9tZfkpXKGOxvKXB!=lo`p?|R1l=tA zp(1}c6T3Fwj_CPJwVsYtgeRKg?9?}%oRq0F+r+kdB=bFUdVDRPa;E~~>2$w}>O>v=?|e>#(-Lyx?nbg=ckJ#5U6;RT zNvHhXk$P}m9wSvFyU3}=7!y?Y z=fg$PbV8d7g25&-jOcs{%}wTDKm>!Vk);&rr;O1nvO0VrU&Q?TtYVU=ir`te8SLlS zKSNmV=+vF|ATGg`4$N1uS|n??f}C_4Sz!f|4Ly8#yTW-FBfvS48Tef|-46C(wEO_%pPhUC5$-~Y?!0vFZ^Gu`x=m7X99_?C-`|h zfmMM&Y@zdfitA@KPw4Mc(YHcY1)3*1xvW9V-r4n-9ZuBpFcf{yz+SR{ zo$ZSU_|fgwF~aakGr(9Be`~A|3)B=9`$M-TWKipq-NqRDRQc}ABo*s_5kV%doIX7LRLRau_gd@Rd_aLFXGSU+U?uAqh z8qusWWcvgQ&wu{|sRXmv?sl=xc<$6AR$+cl& zFNh5q1~kffG{3lDUdvEZu5c(aAG~+64FxdlfwY^*;JSS|m~CJusvi-!$XR`6@XtY2 znDHSz7}_Bx7zGq-^5{stTRy|I@N=>*y$zz>m^}^{d&~h;0kYiq8<^Wq7Dz0w31ShO^~LUfW6rfitR0(=3;Uue`Y%y@ex#eKPOW zO~V?)M#AeHB2kovn1v=n^D?2{2jhIQd9t|_Q+c|ZFaWt+r&#yrOu-!4pXAJuxM+Cx z*H&>eZ0v8Y`t}8{TV6smOj=__gFC=eah)mZt9gwz>>W$!>b3O;Rm^Ig*POZP8Rl0f zT~o=Nu1J|lO>}xX&#P58%Yl z83`HRs5#32Qm9mdCrMlV|NKNC+Z~ z9OB8xk5HJ>gBLi+m@(pvpw)1(OaVJKs*$Ou#@Knd#bk+V@y;YXT?)4eP9E5{J%KGtYinNYJUH9PU3A}66c>Xn zZ{Bn0<;8$WCOAL$^NqTjwM?5d=RHgw3!72WRo0c;+houoUA@HWLZM;^U$&sycWrFd zE7ekt9;kb0`lps{>R(}YnXlyGY}5pPd9zBpgXeJTY_jwaJGSJQC#-KJqmh-;ad&F- z-Y)E>!&`Rz!HtCz>%yOJ|v(u7P*I$jqEY3}(Z-orn4 zlI?CYKNl`6I){#2P1h)y(6?i;^z`N3bxTV%wNvQW+eu|x=kbj~s8rhCR*0H=iGkSj zk23lr9kr|p7#qKL=UjgO`@UnvzU)`&fI>1Qs7ubq{@+lK{hH* zvl6eSb9%yngRn^T<;jG1SVa)eA>T^XX=yUS@NCKpk?ovCW1D@!=@kn;l_BrG;hOTC z6K&H{<8K#dI(A+zw-MWxS+~{g$tI7|SfP$EYKxA}LlVO^sT#Oby^grkdZ^^lA}uEF zBSj$weBJG{+Bh@Yffzsw=HyChS(dtLE3i*}Zj@~!_T-Ay7z=B)+*~3|?w`Zd)Co2t zC&4DyB!o&YgSw+fJn6`sn$e)29`kUwAc+1MND7YjV%lO;H2}fNy>hD#=gT ze+-aFNpyKIoXY~Vq-}OWPBe?Rfu^{ps8>Xy%42r@RV#*QV~P83jdlFNgkPN=T|Kt7 zV*M`Rh*30&AWlb$;ae130e@}Tqi3zx2^JQHpM>j$6x`#{mu%tZlwx9Gj@Hc92IuY* zarmT|*d0E~vt6<+r?W^UW0&#U&)8B6+1+;k^2|FWBRP9?C4Rk)HAh&=AS8FS|NQaZ z2j!iZ)nbEyg4ZTp-zHwVlfLC~tXIrv(xrP8PAtR{*c;T24ycA-;auWsya-!kF~CWZ zw_uZ|%urXgUbc@x=L=_g@QJ@m#5beS@6W195Hn7>_}z@Xt{DIEA`A&V82bc^#!q8$ zFh?z_Vn|ozJ;NPd^5uu(9tspo8t%&-U9Ckay-s@DnM*R5rtu|4)~e)`z0P-sy?)kc zs_k&J@0&0!q4~%cKL)2l;N*T&0;mqX5T{Qy60%JtKTQZ-xb%KOcgqwJmb%MOOKk7N zgq})R_6**{8A|6H?fO+2`#QU)p$Ei2&nbj6TpLSIT^D$|`TcSeh+)}VMb}LmvZ{O| ze*1IdCt3+yhdYVxcM)Q_V0bIXLgr6~%JS<<&dxIgfL=Vnx4YHuU@I34JXA|+$_S3~ zy~X#gO_X!cSs^XM{yzDGNM>?v(+sF#<0;AH^YrE8smx<36bUsHbN#y57K8WEu(`qHvQ6cAZPo=J5C(lSmUCZ57Rj6cx!e^rfaI5%w}unz}4 zoX=nt)FVNV%QDJH`o!u9olLD4O5fl)xp+#RloZlaA92o3x4->?rB4`gS$;WO{R;Z3>cG3IgFX2EA?PK^M}@%1%A;?f6}s&CV$cIyEr#q5;yHdNZ9h{| z-=dX+a5elJoDo?Eq&Og!nN6A)5yYpnGEp}?=!C-V)(*~z-+?kY1Q7qs#Rsy%hu_60rdbB+QQNr?S1 z?;xtjUv|*E3}HmuNyB9aFL5H~3Ho0UsmuMZELp1a#CA1g`P{-mT?BchuLEtK}!QZ=3AWakRu~?f9V~3F;TV`5%9Pcs_$gq&CcU}r8gOO zC2&SWPsSG{&o-LIGTBqp6SLQZPvYKp$$7L4WRRZ0BR$Kf0I0SCFkqveCp@f)o8W)! z$%7D1R`&j7W9Q9CGus_)b%+B#J2G;l*FLz#s$hw{BHS~WNLODV#(!u_2Pe&tMsq={ zdm7>_WecWF#D=?eMjLj=-_z`aHMZ=3_-&E8;ibPmM}61i6J3is*=dKf%HC>=xbj4$ zS|Q-hWQ8T5mWde6h@;mS+?k=89?1FU<%qH9B(l&O>k|u_aD|DY*@~(`_pb|B#rJ&g zR0(~(68fpUPz6TdS@4JT5MOPrqDh5_H(eX1$P2SQrkvN8sTxwV>l0)Qq z0pzTuvtEAKRDkKGhhv^jk%|HQ1DdF%5oKq5BS>szk-CIke{%js?~%@$uaN3^Uz6Wf z_iyx{bZ(;9y4X&>LPV=L=d+A}7I4GkK0c1Xts{rrW1Q7apHf-))`BgC^0^F(>At1* za@e7{lq%yAkn*NH8Q1{@{lKhRg*^TfGvv!Sn*ed*x@6>M%aaqySxR|oNadYt1mpUZ z6H(rupHYf&Z z29$5g#|0MX#aR6TZ$@eGxxABRKakDYtD%5BmKp;HbG_ZbT+=81E&=XRk6m_3t9PvD zr5Cqy(v?gHcYvYvXkNH@S#Po~q(_7MOuCAB8G$a9BC##gw^5mW16cML=T=ERL7wsk zzNEayTG?mtB=x*wc@ifBCJ|irFVMOvH)AFRW8WE~U()QT=HBCe@s$dA9O!@`zAAT) zaOZ7l6vyR+Nk_OOF!ZlZmjoImKh)dxFbbR~z(cMhfeX1l7S_`;h|v3gI}n9$sSQ>+3@AFAy9=B_y$)q;Wdl|C-X|VV3w8 z2S#>|5dGA8^9%Bu&fhmVRrTX>Z7{~3V&0UpJNEl0=N32euvDGCJ>#6dUSi&PxFW*s zS`}TB>?}H(T2lxBJ!V#2taV;q%zd6fOr=SGHpoSG*4PDaiG0pdb5`jelVipkEk%FV zThLc@Hc_AL1#D&T4D=w@UezYNJ%0=f3iVRuVL5H?eeZM}4W*bomebEU@e2d`M<~uW zf#Bugwf`VezG|^Qbt6R_=U0}|=k;mIIakz99*>FrsQR{0aQRP6ko?5<7bkDN8evZ& zB@_KqQG?ErKL=1*ZM9_5?Pq%lcS4uLSzN(Mr5=t6xHLS~Ym`UgM@D&VNu8e?_=nSFtF$u@hpPSmI4Vo_t&v?>$~K4y(O~Rb*(MFy_igM7 z*~yYUyR6yQgzWnWMUgDov!!g=lInM+=lOmOk4L`O?{i&qxy&D*_qorRbDwj6?)!ef z#JLd7F6Z2I$S0iYI={rZNk*<{HtIl^mx=h>Cim*04K4+Z4IJtd*-)%6XV2(MCscPiw_a+y*?BKbTS@BZ3AUao^%Zi#PhoY9Vib4N>SE%4>=Jco0v zH_Miey{E;FkdlZSq)e<{`+S3W=*ttvD#hB8w=|2aV*D=yOV}(&p%0LbEWH$&@$X3x~CiF-?ejQ*N+-M zc8zT@3iwkdRT2t(XS`d7`tJQAjRmKAhiw{WOqpuvFp`i@Q@!KMhwKgsA}%@sw8Xo5Y=F zhRJZg)O4uqNWj?V&&vth*H#je6T}}p_<>!Dr#89q@uSjWv~JuW(>FqoJ5^ho0%K?E z9?x_Q;kmcsQ@5=}z@tdljMSt9-Z3xn$k)kEjK|qXS>EfuDmu(Z8|(W?gY6-l z@R_#M8=vxKMAoi&PwnaIYw2COJM@atcgfr=zK1bvjW?9B`-+Voe$Q+H$j!1$Tjn+* z&LY<%)L@;zhnJlB^Og6I&BOR-m?{IW;tyYC%FZ!&Z>kGjHJ6cqM-F z&19n+e1=9AH1VrVeHrIzqlC`w9=*zfmrerF?JMzO&|Mmv;!4DKc(sp+jy^Dx?(8>1 zH&yS_4yL7m&GWX~mdfgH*AB4{CKo;+egw=PrvkTaoBU+P-4u?E|&!c z)DKc;>$$B6u*Zr1SjUh2)FeuWLWHl5TH(UHWkf zLs>7px!c5n;rbe^lO@qlYLzlDVp(z?6rPZel=YB)Uv&n!2{+Mb$-vQl=xKw( zve&>xYx+jW_NJh!FV||r?;hdP*jOXYcLCp>DOtJ?2S^)DkM{{Eb zS$!L$e_o0(^}n3tA1R3-$SNvgBq;DOEo}fNc|tB%%#g4RA3{|euq)p+xd3I8^4E&m zFrD%}nvG^HUAIKe9_{tXB;tl|G<%>yk6R;8L2)KUJw4yHJXUOPM>(-+jxq4R;z8H#>rnJy*)8N+$wA$^F zN+H*3t)eFEgxLw+Nw3};4WV$qj&_D`%ADV2%r zJCPCo%{=z7;`F98(us5JnT(G@sKTZ^;2FVitXyLe-S5(hV&Ium+1pIUB(CZ#h|g)u zSLJJ<@HgrDiA-}V_6B^x1>c9B6%~847JkQ!^KLZ2skm;q*edo;UA)~?SghG8;QbHh z_6M;ouo_1rq9=x$<`Y@EA{C%6-pEV}B(1#sDoe_e1s3^Y>n#1Sw;N|}8D|s|VPd+g z-_$QhCz`vLxxrVMx3ape1xu3*wjx=yKSlM~nFgkNWb4?DDr*!?U)L_VeffF<+!j|b zZ$Wn2$TDv3C3V@BHpSgv3JUif8%hk%OsGZ=OxH@8&4`bbf$`aAMchl^qN>Eyu3JH} z9-S!x8-s4fE=lad%Pkp8hAs~u?|uRnL48O|;*DEU! zuS0{cpk%1E0nc__2%;apFsTm0bKtd&A0~S3Cj^?72-*Owk3V!ZG*PswDfS~}2<8le z5+W^`Y(&R)yVF*tU_s!XMcJS`;(Tr`J0%>p=Z&InR%D3@KEzzI+-2)HK zuoNZ&o=wUC&+*?ofPb0a(E6(<2Amd6%uSu_^-<1?hsxs~0K5^f(LsGqgEF^+0_H=uNk9S0bb!|O8d?m5gQjUKevPaO+*VfSn^2892K~%crWM8+6 z25@V?Y@J<9w%@NXh-2!}SK_(X)O4AM1-WTg>sj1{lj5@=q&dxE^9xng1_z9w9DK>| z6Iybcd0e zyi;Ew!KBRIfGPGytQ6}z}MeXCfLY0?9%RiyagSp_D1?N&c{ zyo>VbJ4Gy`@Fv+5cKgUgs~na$>BV{*em7PU3%lloy_aEovR+J7TfQKh8BJXyL6|P8un-Jnq(ghd!_HEOh$zlv2$~y3krgeH;9zC}V3f`uDtW(%mT#944DQa~^8ZI+zAUu4U(j0YcDfKR$bK#gvn_{JZ>|gZ5+)u?T$w7Q%F^;!Wk?G z(le7r!ufT*cxS}PR6hIVtXa)i`d$-_1KkyBU>qmgz-=T};uxx&sKgv48akIWQ89F{ z0XiY?WM^~;|T8zBOr zs#zuOONzH?svv*jokd5SK8wG>+yMC)LYL|vLqm^PMHcT=`}V$=nIRHe2?h)8WQa6O zPAU}d`1y(>kZiP~Gr=mtJLMu`i<2CspL|q2DqAgAD^7*$xzM`PU4^ga`ilE134XBQ z99P(LhHU@7qvl9Yzg$M`+dlS=x^(m-_3t|h>S}E0bcFMn=C|KamQ)=w2^e)35p`zY zRV8X?d;s^>Cof2SPR&nP3E+-LCkS0J$H!eh8~k0qo$}00b=7!H_I2O+Ro@3O$nPdm ztmbOO^B+IHzQ5w>@@@J4cKw5&^_w6s!s=H%&byAbUtczPQ7}wfTqxxtQNfn*u73Qw zGuWsrky_ajPx-5`R<)6xHf>C(oqGf_Fw|-U*GfS?xLML$kv;h_pZ@Kk$y0X(S+K80 z6^|z)*`5VUkawg}=z`S;VhZhxyDfrE0$(PMurAxl~<>lfZa>JZ288ULK7D` zl9|#L^JL}Y$j*j`0-K6kH#?bRmg#5L3iB4Z)%iF@SqT+Lp|{i`m%R-|ZE94Np7Pa5 zCqC^V3}B(FR340pmF*qaa}M}+h6}mqE~7Sh!9bDv9YRT|>vBNAqv09zXHMlcuhKD| zcjjA(b*XCIwJ33?CB!+;{)vX@9xns_b-VO{i0y?}{!sdXj1GM8+$#v>W7nw;+O_9B z_{4L;C6ol?(?W0<6taGEn1^uG=?Q3i29sE`RfYCaV$3DKc_;?HsL?D_fSYg}SuO5U zOB_f4^vZ_x%o`5|C@9C5+o=mFy@au{s)sKw!UgC&L35aH(sgDxRE2De%(%OT=VUdN ziVLEmdOvJ&5*tCMKRyXctCwQu_RH%;m*$YK&m;jtbdH#Ak~13T1^f89tn`A%QEHWs~jnY~E}p_Z$XC z=?YXLCkzVSK+Id`xZYTegb@W8_baLt-Fq`Tv|=)JPbFsKRm)4UW;yT+J`<)%#ue9DPOkje)YF2fsCilK9MIIK>p*`fkoD5nGfmLwt)!KOT+> zOFq*VZktDDyM3P5UOg`~XL#cbzC}eL%qMB=Q5$d89MKuN#$6|4gx_Jt0Gfn8w&q}%lq4QU%6#jT*MRT% zrLz~C8FYKHawn-EQWN1B75O&quS+Z81(zN)G>~vN8VwC+e+y(`>HcxC{MrJ;H1Z4k zZWuv$w_F0-Ub%MVcpIc){4PGL^I7M{>;hS?;eH!;gmcOE66z3;Z1Phqo(t zVP(Hg6q#0gIKgsg7L7WE!{Y#1nI(45tx2{$34dDd#!Z0NIyrm)HOn5W#7;f4pQci# zDW!FI(g4e668kI9{2+mLwB+=#9bfqgX%!B34V-$wwSN(_cm*^{y0jQtv*4}eO^sOV z*9xoNvX)c9isB}Tgx&ZRjp3kwhTVK?r9;n!x>^XYT z@Q^7zp{rkIs{2mUSE^2!Gf6$6;j~&4=-0cSJJDizZp6LTe8b45;{AKM%v99}{{FfC zz709%u0mC=1KXTo(=TqmZQ;c?$M3z(!xah>aywrj40sc2y3rKFw4jCq+Y+u=CH@_V zxz|qeTwa>+<|H%8Dz5u>ZI5MmjTFwXS-Fv!TDd*`>3{krWoNVx$<133`(ftS?ZPyY z&4@ah^3^i`vL$BZa>O|Nt?ucewzsF)0zX3qmM^|waXr=T0pfIb0*$AwU=?Ipl|1Y; z*Pk6{C-p4MY;j@IJ|DW>QHZQJcp;Z~?8(Q+Kk3^0qJ}SCk^*n4W zu9ZFwLHUx-$6xvaQ)SUQcYd6fF8&x)V`1bIuX@>{mE$b|Yd(qomn3;bPwnDUc0F=; zh*6_((%bqAYQWQ~odER?h>1mkL4kpb3s7`0m@rDKGU*oyF)$j~Ffd4fXV$?`f~rHf zB%Y)@5SXZvfwm10RY5X?TEo)PK_`L6qgBp=#>fO49$D zDq8Ozj0q6213tV5Qq=;fZ0$|KroY{Dz=l@lU^J)?Ko@ti20TRplXzphBi>XGx4bou zEWrkNjz0t5j!_ke{g5I#PUlEU$Km8g8TE|XK=MkU@PT4T><2OVamoK;wJ}3X0L$vX zgd7gNa359*nc)R-0!`2X@FOTB`+oETOPc=ubp5R)VQgY+5BTZZJ2?9QwnO=dnulIUF3gFn;BODC2)65)HeVd%t86sL7Rv^Y+nbn+&l z6BAJY(ETvwI)Ts$aiE8rht4KD*qNyE{8{x6R|%akbTBzw;2+6Echkt+W+`u^XX z_z&x%n '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# 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 ;; #( +MSYS* | 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 +if ! command -v java >/dev/null 2>&1 +then +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 +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/okhttp/gradlew.bat b/samples/client/petstore/java/okhttp/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/client/petstore/java/okhttp/gradlew.bat @@ -0,0 +1,92 @@ +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 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! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/petstore/java/okhttp/pom.xml b/samples/client/petstore/java/okhttp/pom.xml new file mode 100644 index 000000000000..52225681d7cf --- /dev/null +++ b/samples/client/petstore/java/okhttp/pom.xml @@ -0,0 +1,290 @@ + + 4.0.0 + org.openapitools + petstore-okhttp + jar + petstore-okhttp + 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-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.6.1 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + 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-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + org.apache.commons + commons-lang3 + ${commons-lang3-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.9.0 + 5.4.0 + 2.10.1 + 3.18.0 + 1.3.5 + 5.10.3 + 1.10.0 + UTF-8 + + diff --git a/samples/client/petstore/java/okhttp/settings.gradle b/samples/client/petstore/java/okhttp/settings.gradle new file mode 100644 index 000000000000..3c778001cf97 --- /dev/null +++ b/samples/client/petstore/java/okhttp/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-okhttp" \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp/src/main/AndroidManifest.xml b/samples/client/petstore/java/okhttp/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiCallback.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiCallback.java new file mode 100644 index 000000000000..e9ab7a8d7a60 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiCallback.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; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..86f742d40253 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1801 @@ +/* + * 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 okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +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.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + protected String basePath = "http://petstore.swagger.io:80/v2"; + 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" + ) + ) + )); + }} + ), + new ServerConfiguration( + "https://127.0.0.1/no_variable", + "The local server without variables", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + protected String tlsServerName; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = ""; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.IMPLICIT, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + protected void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + protected void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://petstore.swagger.io:80/v2) + * @return An instance of ApiClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return ApiClient + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + * Get TLS server name for SNI (Server Name Indication). + * + * @return The TLS server name + */ + public String getTlsServerName() { + return tlsServerName; + } + + /** + * Set TLS server name for SNI (Server Name Indication). + * This is used to verify the server certificate against a specific hostname + * instead of the hostname in the URL. + * + * @param tlsServerName The TLS server name to use for certificate verification + * @return ApiClient + */ + public ApiClient setTlsServerName(String tlsServerName) { + this.tlsServerName = tlsServerName; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + 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 access token for the first Bearer authentication. + * @param bearerToken Bearer token + */ + public void setBearerToken(String bearerToken) { + setBearerToken(() -> bearerToken); + } + + /** + * Helper method to set the supplier of access tokens for Bearer authentication. + * + * @param tokenSupplier The supplier of bearer tokens + */ + public void setBearerToken(Supplier tokenSupplier) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(tokenSupplier); + return; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + 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 void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + 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 ApiClient + */ + 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 ApiClient + */ + 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 enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = 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 temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceFirst("^.*[/\\\\]", ""); + } + + /** + * 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 (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + 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, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + 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 to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Use String-based deserialize for String return type with fallback + return json.deserialize(respBodyString, returnType); + } else { + // Use InputStream-based deserialize which supports responses > 2GB + return json.deserialize(respBody.byteStream(), returnType); + } + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws org.openapitools.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("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 = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + 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); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws org.openapitools.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws org.openapitools.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + java.util.Locale.ROOT, + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format(java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws org.openapitools.client.ApiException If fails to update the parameters + */ + public 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) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + protected Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + protected void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + if (tlsServerName != null && !tlsServerName.isEmpty()) { + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + // Verify the certificate against tlsServerName instead of the actual hostname + return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session); + } + }; + } else { + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..0c0f52846910 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,167 @@ +/* + * 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; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + 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; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format(java.util.Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..fb13945bd775 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * 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. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @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); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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 the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..79955372fb33 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,63 @@ +/* + * 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.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..0d7d801ceab4 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,692 @@ +/* + * 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 org.openapitools.client.model.AbstractOpenApiSchema; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + public JSON() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Animal.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Cat", org.openapitools.client.model.Cat.class); + classByDiscriminatorValue.put("Dog", org.openapitools.client.model.Dog.class); + classByDiscriminatorValue.put("Animal", org.openapitools.client.model.Animal.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Cat.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Cat", org.openapitools.client.model.Cat.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Dog.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Dog", org.openapitools.client.model.Dog.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.EnumStringDiscriminator.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("EnumStringDiscriminator", org.openapitools.client.model.EnumStringDiscriminator.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "enum_str_type")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.GrandparentAnimal.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ParentPet", org.openapitools.client.model.ParentPet.class); + classByDiscriminatorValue.put("GrandparentAnimal", org.openapitools.client.model.GrandparentAnimal.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "pet_type")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Mammal.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Pig", org.openapitools.client.model.Pig.class); + classByDiscriminatorValue.put("whale", org.openapitools.client.model.Whale.class); + classByDiscriminatorValue.put("zebra", org.openapitools.client.model.Zebra.class); + classByDiscriminatorValue.put("mammal", org.openapitools.client.model.Mammal.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.MammalAnyof.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Pig", org.openapitools.client.model.Pig.class); + classByDiscriminatorValue.put("whale", org.openapitools.client.model.Whale.class); + classByDiscriminatorValue.put("zebra", org.openapitools.client.model.Zebra.class); + classByDiscriminatorValue.put("mammal_anyof", org.openapitools.client.model.MammalAnyof.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.NullableShape.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Quadrilateral", org.openapitools.client.model.Quadrilateral.class); + classByDiscriminatorValue.put("Triangle", org.openapitools.client.model.Triangle.class); + classByDiscriminatorValue.put("NullableShape", org.openapitools.client.model.NullableShape.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "shapeType")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.ParentPet.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ParentPet", org.openapitools.client.model.ParentPet.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "pet_type")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Pig.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BasquePig", org.openapitools.client.model.BasquePig.class); + classByDiscriminatorValue.put("DanishPig", org.openapitools.client.model.DanishPig.class); + classByDiscriminatorValue.put("Pig", org.openapitools.client.model.Pig.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Quadrilateral.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ComplexQuadrilateral", org.openapitools.client.model.ComplexQuadrilateral.class); + classByDiscriminatorValue.put("SimpleQuadrilateral", org.openapitools.client.model.SimpleQuadrilateral.class); + classByDiscriminatorValue.put("Quadrilateral", org.openapitools.client.model.Quadrilateral.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "quadrilateralType")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Shape.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Quadrilateral", org.openapitools.client.model.Quadrilateral.class); + classByDiscriminatorValue.put("Triangle", org.openapitools.client.model.Triangle.class); + classByDiscriminatorValue.put("Shape", org.openapitools.client.model.Shape.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "shapeType")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.ShapeOrNull.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Quadrilateral", org.openapitools.client.model.Quadrilateral.class); + classByDiscriminatorValue.put("Triangle", org.openapitools.client.model.Triangle.class); + classByDiscriminatorValue.put("ShapeOrNull", org.openapitools.client.model.ShapeOrNull.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "shapeType")); + } + }); + fireBuilder.registerTypeSelector(org.openapitools.client.model.Triangle.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("EquilateralTriangle", org.openapitools.client.model.EquilateralTriangle.class); + classByDiscriminatorValue.put("IsoscelesTriangle", org.openapitools.client.model.IsoscelesTriangle.class); + classByDiscriminatorValue.put("ScaleneTriangle", org.openapitools.client.model.ScaleneTriangle.class); + classByDiscriminatorValue.put("Triangle", org.openapitools.client.model.Triangle.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "triangleType")); + } + }); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + builder.registerTypeAdapter(Date.class, dateTypeAdapter); + builder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + builder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + builder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + builder.registerTypeAdapter(byte[].class, byteArrayAdapter); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AdditionalPropertiesClass.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfModelArrayAnyOf.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributes.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributesC.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1Value.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfRefToDouble.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfRefToFloat.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfRefToLong.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Apple.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.AppleReq.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayAnyOf.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayDefault.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayOfArrayOfNumberOnly.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayOfInlineAllOf.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayOfInlineAllOfArrayAllofDogPropertyInner.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayOfNumberOnly.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayOneOf.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayTest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Banana.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.BananaReq.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.BasquePig.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Capitalization.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Cat.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Category.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ClassModel.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Client.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ComplexQuadrilateral.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.DanishPig.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.DeprecatedObject.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Dog.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Drawing.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.EnumArrays.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.EnumStringDiscriminator.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.EnumTest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.EquilateralTriangle.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FakeAnyOfWIthSameErasureGet200Response.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FakeOneOfWIthSameErasureGet200Response.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FakeRefParameterPetIdParameter.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FileSchemaTestClass.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Foo.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FooGetDefaultResponse.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FormatTest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FreeFormObjectTestClass.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FreeFormObjectTestClassProperties.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Fruit.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.FruitReq.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.GmFruit.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.HasOnlyReadOnly.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.HealthCheckResult.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.IsoscelesTriangle.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Mammal.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.MammalAnyof.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.MapTest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.MixedPropertiesAndAdditionalPropertiesClass.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Model200Response.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelApiResponse.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelFile.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelList.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelReturn.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelWithOneOfAnyOfProperties.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Name.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NestedArrayWithDefaultValues.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NewPet.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NewPetCategoryInlineAllof.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NewPetCategoryInlineAllofAllOfCategoryTag.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NullableClass.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NullableFieldsMapError.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NullableFieldsMapResponse.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NullableFieldsMapSuccess.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NullableFieldsValue.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NullableShape.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.NumberOnly.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ObjectWithDeprecatedFields.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Order.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.OuterComposite.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ParentPet.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Pet.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.PetComposition.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.PetRef.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.PetUsingAllOf.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.PetWithRequiredTags.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Pig.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.PropertyNameCollision.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Quadrilateral.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.QuadrilateralInterface.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ReadOnlyFirst.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.RequiredNullableBody.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Scalar.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ScalarAnyOf.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ScaleneTriangle.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Shape.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ShapeInterface.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.ShapeOrNull.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.SimpleQuadrilateral.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.SpecialModelName.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Tag.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Triangle.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.TriangleInterface.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.User.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Value.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Variable.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Whale.CustomTypeAdapterFactory()); + builder.registerTypeAdapterFactory(new org.openapitools.client.model.Zebra.CustomTypeAdapterFactory()); + gson = builder.create(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + /** + * Get the internal serialization object. + * + * @return serialization object + */ + public static Object getSerializer() { + return gson; + } + + /** + * Set the internal serialization object. + * + * @param serializer serialization object + */ + public static void setSerializer(Object serializer) { + JSON.gson = (Gson) serializer; + } + + public static Gson getGson() { + return gson; + } + + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + JSON.isLenientOnJson = lenientOnJson; + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } + + public static boolean isInstanceOf(Class type, Object instance, Set> visited) { + if (instance == null) { + return true; + } + if (type.isInstance(instance)) { + return true; + } + if (instance instanceof AbstractOpenApiSchema) { + AbstractOpenApiSchema schema = (AbstractOpenApiSchema) instance; + visited.add(schema.getClass()); + for (Class allowedType : schema.getSchemas().values()) { + if (visited.contains(allowedType)) { + continue; + } + if (isInstanceOf(type, schema.getActualInstance(), visited)) { + return true; + } + } + } + return false; + } + + + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + /** + * Gson TypeAdapter for java.sql.Date type + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..505e6f786f4c --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,37 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ProgressRequestBody.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ProgressRequestBody.java new file mode 100644 index 000000000000..924dd8668973 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * 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 okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ProgressResponseBody.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ProgressResponseBody.java new file mode 100644 index 000000000000..eee56669a4a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * 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 okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..1787a231e76b --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * 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; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description 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 IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..bc81f54d83a6 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * 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.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..6473166843d5 --- /dev/null +++ b/samples/client/petstore/java/okhttp/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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/AnotherFakeApi.java new file mode 100644 index 000000000000..62d0167ff1bf --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -0,0 +1,458 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AnotherFakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AnotherFakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public AnotherFakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for call123testSpecialTags + * @param client client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = client; + + // create path and map variables + String localVarPath = "/another-fake/dummy"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call call123testSpecialTagsValidateBeforeCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException("Missing the required parameter 'client' when calling call123testSpecialTags(Async)"); + } + + return call123testSpecialTagsCall(client, _callback); + + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client call123testSpecialTags(@javax.annotation.Nonnull Client client) throws ApiException { + ApiResponse localVarResp = call123testSpecialTagsWithHttpInfo(client); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(client, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test special tags (asynchronously) + * To test special tags and operation ID starting with number + * @param client client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call call123testSpecialTagsAsync(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = call123testSpecialTagsValidateBeforeCall(client, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getParameterArrayNumber + * @param array array integer (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterArrayNumberCall(@javax.annotation.Nonnull List array, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/parameter-array-number"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (array != null) { + localVarHeaderParams.put("array", localVarApiClient.parameterToString(array)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getParameterArrayNumberValidateBeforeCall(@javax.annotation.Nonnull List array, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'array' is set + if (array == null) { + throw new ApiException("Missing the required parameter 'array' when calling getParameterArrayNumber(Async)"); + } + + return getParameterArrayNumberCall(array, _callback); + + } + + /** + * parameter array number default value + * + * @param array array integer (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getParameterArrayNumber(@javax.annotation.Nonnull List array) throws ApiException { + getParameterArrayNumberWithHttpInfo(array); + } + + /** + * parameter array number default value + * + * @param array array integer (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getParameterArrayNumberWithHttpInfo(@javax.annotation.Nonnull List array) throws ApiException { + okhttp3.Call localVarCall = getParameterArrayNumberValidateBeforeCall(array, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * parameter array number default value (asynchronously) + * + * @param array array integer (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterArrayNumberAsync(@javax.annotation.Nonnull List array, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getParameterArrayNumberValidateBeforeCall(array, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getParameterStringNumber + * @param stringNumber string number (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterStringNumberCall(@javax.annotation.Nonnull BigDecimal stringNumber, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/parameter-string-number"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (stringNumber != null) { + localVarHeaderParams.put("string_number", localVarApiClient.parameterToString(stringNumber)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getParameterStringNumberValidateBeforeCall(@javax.annotation.Nonnull BigDecimal stringNumber, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'stringNumber' is set + if (stringNumber == null) { + throw new ApiException("Missing the required parameter 'stringNumber' when calling getParameterStringNumber(Async)"); + } + + return getParameterStringNumberCall(stringNumber, _callback); + + } + + /** + * parameter string number + * + * @param stringNumber string number (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getParameterStringNumber(@javax.annotation.Nonnull BigDecimal stringNumber) throws ApiException { + getParameterStringNumberWithHttpInfo(stringNumber); + } + + /** + * parameter string number + * + * @param stringNumber string number (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getParameterStringNumberWithHttpInfo(@javax.annotation.Nonnull BigDecimal stringNumber) throws ApiException { + okhttp3.Call localVarCall = getParameterStringNumberValidateBeforeCall(stringNumber, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * parameter string number (asynchronously) + * + * @param stringNumber string number (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterStringNumberAsync(@javax.annotation.Nonnull BigDecimal stringNumber, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getParameterStringNumberValidateBeforeCall(stringNumber, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..fa4bbab756c5 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,563 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.FakeAnyOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FakeOneOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FooGetDefaultResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DefaultApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for fakeAnyOfWIthSameErasureGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeAnyOfWIthSameErasureGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/anyOfWIthSameErasure"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeAnyOfWIthSameErasureGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeAnyOfWIthSameErasureGetCall(_callback); + + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return FakeAnyOfWIthSameErasureGet200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public FakeAnyOfWIthSameErasureGet200Response fakeAnyOfWIthSameErasureGet() throws ApiException { + ApiResponse localVarResp = fakeAnyOfWIthSameErasureGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return ApiResponse<FakeAnyOfWIthSameErasureGet200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public ApiResponse fakeAnyOfWIthSameErasureGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeAnyOfWIthSameErasureGetValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test route, this shouldn't cause a compiler error + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeAnyOfWIthSameErasureGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeAnyOfWIthSameErasureGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeFreeFormQueryParametersGet + * @param fixed (optional) + * @param freeForm (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call fakeFreeFormQueryParametersGetCall(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/free-form-query-parameters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (fixed != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fixed", fixed)); + } + + if (freeForm != null) { + localVarQueryParams.addAll(localVarApiClient.freeFormParameterToPairs(freeForm)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeFreeFormQueryParametersGetValidateBeforeCall(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm, final ApiCallback _callback) throws ApiException { + return fakeFreeFormQueryParametersGetCall(fixed, freeForm, _callback); + + } + + /** + * + * + * @param fixed (optional) + * @param freeForm (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void fakeFreeFormQueryParametersGet(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm) throws ApiException { + fakeFreeFormQueryParametersGetWithHttpInfo(fixed, freeForm); + } + + /** + * + * + * @param fixed (optional) + * @param freeForm (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse fakeFreeFormQueryParametersGetWithHttpInfo(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm) throws ApiException { + okhttp3.Call localVarCall = fakeFreeFormQueryParametersGetValidateBeforeCall(fixed, freeForm, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param fixed (optional) + * @param freeForm (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call fakeFreeFormQueryParametersGetAsync(@javax.annotation.Nullable String fixed, @javax.annotation.Nullable Object freeForm, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeFreeFormQueryParametersGetValidateBeforeCall(fixed, freeForm, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for fakeOneOfWIthSameErasureGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeOneOfWIthSameErasureGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/oneOfWIthSameErasure"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOneOfWIthSameErasureGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeOneOfWIthSameErasureGetCall(_callback); + + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return FakeOneOfWIthSameErasureGet200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public FakeOneOfWIthSameErasureGet200Response fakeOneOfWIthSameErasureGet() throws ApiException { + ApiResponse localVarResp = fakeOneOfWIthSameErasureGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * Test route, this shouldn't cause a compiler error + * @return ApiResponse<FakeOneOfWIthSameErasureGet200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public ApiResponse fakeOneOfWIthSameErasureGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeOneOfWIthSameErasureGetValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test route, this shouldn't cause a compiler error + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful response -
+ */ + public okhttp3.Call fakeOneOfWIthSameErasureGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOneOfWIthSameErasureGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fooGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public okhttp3.Call fooGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/foo"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fooGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fooGetCall(_callback); + + } + + /** + * + * + * @return FooGetDefaultResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public FooGetDefaultResponse fooGet() throws ApiException { + ApiResponse localVarResp = fooGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * + * @return ApiResponse<FooGetDefaultResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public ApiResponse fooGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fooGetValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 response -
+ */ + public okhttp3.Call fooGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fooGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 000000000000..1f1cedfe3c09 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,3457 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import org.openapitools.client.model.FakeRefParameterPetIdParameter; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.FreeFormObjectTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.NullableFieldsMapResponse; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.RequiredNullableBody; +import org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for fakeGetFreeFormObjectGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call fakeGetFreeFormObjectGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/get-free-form-object"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeGetFreeFormObjectGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeGetFreeFormObjectGetCall(_callback); + + } + + /** + * + * Get a free form object or Json string + * @return FreeFormObjectTestClass + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public FreeFormObjectTestClass fakeGetFreeFormObjectGet() throws ApiException { + ApiResponse localVarResp = fakeGetFreeFormObjectGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * Get a free form object or Json string + * @return ApiResponse<FreeFormObjectTestClass> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse fakeGetFreeFormObjectGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeGetFreeFormObjectGetValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get a free form object or Json string + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call fakeGetFreeFormObjectGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeGetFreeFormObjectGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterBooleanSerialize + * @param body Input boolean as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeCall(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterBooleanSerializeValidateBeforeCall(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + return fakeOuterBooleanSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public Boolean fakeOuterBooleanSerialize(@javax.annotation.Nullable Boolean body) throws ApiException { + ApiResponse localVarResp = fakeOuterBooleanSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return ApiResponse<Boolean> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(@javax.annotation.Nullable Boolean body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterBooleanSerializeValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output boolean -
+ */ + public okhttp3.Call fakeOuterBooleanSerializeAsync(@javax.annotation.Nullable Boolean body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterBooleanSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterCompositeSerialize + * @param outerComposite Input composite as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeCall(@javax.annotation.Nullable OuterComposite outerComposite, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = outerComposite; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterCompositeSerializeValidateBeforeCall(@javax.annotation.Nullable OuterComposite outerComposite, final ApiCallback _callback) throws ApiException { + return fakeOuterCompositeSerializeCall(outerComposite, _callback); + + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public OuterComposite fakeOuterCompositeSerialize(@javax.annotation.Nullable OuterComposite outerComposite) throws ApiException { + ApiResponse localVarResp = fakeOuterCompositeSerializeWithHttpInfo(outerComposite); + return localVarResp.getData(); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return ApiResponse<OuterComposite> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(@javax.annotation.Nullable OuterComposite outerComposite) throws ApiException { + okhttp3.Call localVarCall = fakeOuterCompositeSerializeValidateBeforeCall(outerComposite, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output composite -
+ */ + public okhttp3.Call fakeOuterCompositeSerializeAsync(@javax.annotation.Nullable OuterComposite outerComposite, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterCompositeSerializeValidateBeforeCall(outerComposite, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterNumberSerialize + * @param body Input number as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeCall(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterNumberSerializeValidateBeforeCall(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + return fakeOuterNumberSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public BigDecimal fakeOuterNumberSerialize(@javax.annotation.Nullable BigDecimal body) throws ApiException { + ApiResponse localVarResp = fakeOuterNumberSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return ApiResponse<BigDecimal> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public ApiResponse fakeOuterNumberSerializeWithHttpInfo(@javax.annotation.Nullable BigDecimal body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterNumberSerializeValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output number -
+ */ + public okhttp3.Call fakeOuterNumberSerializeAsync(@javax.annotation.Nullable BigDecimal body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterNumberSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeOuterStringSerialize + * @param body Input string as post body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeCall(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeOuterStringSerializeValidateBeforeCall(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + return fakeOuterStringSerializeCall(body, _callback); + + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public String fakeOuterStringSerialize(@javax.annotation.Nullable String body) throws ApiException { + ApiResponse localVarResp = fakeOuterStringSerializeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public ApiResponse fakeOuterStringSerializeWithHttpInfo(@javax.annotation.Nullable String body) throws ApiException { + okhttp3.Call localVarCall = fakeOuterStringSerializeValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Output string -
+ */ + public okhttp3.Call fakeOuterStringSerializeAsync(@javax.annotation.Nullable String body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeOuterStringSerializeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeRefParameter + * @param petId to test oneOf in parameter $ref (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeRefParameterCall(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/pet/{petId}/reference/parameter" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeRefParameterValidateBeforeCall(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling fakeRefParameter(Async)"); + } + + return fakeRefParameterCall(petId, _callback); + + } + + /** + * fake reference parameter + * + * @param petId to test oneOf in parameter $ref (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void fakeRefParameter(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId) throws ApiException { + fakeRefParameterWithHttpInfo(petId); + } + + /** + * fake reference parameter + * + * @param petId to test oneOf in parameter $ref (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse fakeRefParameterWithHttpInfo(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId) throws ApiException { + okhttp3.Call localVarCall = fakeRefParameterValidateBeforeCall(petId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * fake reference parameter (asynchronously) + * + * @param petId to test oneOf in parameter $ref (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeRefParameterAsync(@javax.annotation.Nonnull FakeRefParameterPetIdParameter petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeRefParameterValidateBeforeCall(petId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for fakeRequiredNullableBodyGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public okhttp3.Call fakeRequiredNullableBodyGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/required-nullable-body"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeRequiredNullableBodyGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return fakeRequiredNullableBodyGetCall(_callback); + + } + + /** + * fields in the response body, required and nullable are both true + * + * @return RequiredNullableBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public RequiredNullableBody fakeRequiredNullableBodyGet() throws ApiException { + ApiResponse localVarResp = fakeRequiredNullableBodyGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * fields in the response body, required and nullable are both true + * + * @return ApiResponse<RequiredNullableBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public ApiResponse fakeRequiredNullableBodyGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = fakeRequiredNullableBodyGetValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * fields in the response body, required and nullable are both true (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 success -
+ */ + public okhttp3.Call fakeRequiredNullableBodyGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeRequiredNullableBodyGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for fakeUploadRefRequestBodies + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeUploadRefRequestBodiesCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call fakeUploadRefRequestBodiesValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling fakeUploadRefRequestBodies(Async)"); + } + + return fakeUploadRefRequestBodiesCall(petId, additionalMetadata, _file, _callback); + + } + + /** + * fake reference parameter + * + * @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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse fakeUploadRefRequestBodies(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = fakeUploadRefRequestBodiesWithHttpInfo(petId, additionalMetadata, _file); + return localVarResp.getData(); + } + + /** + * fake reference parameter + * + * @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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse fakeUploadRefRequestBodiesWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = fakeUploadRefRequestBodiesValidateBeforeCall(petId, additionalMetadata, _file, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * fake reference parameter (asynchronously) + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call fakeUploadRefRequestBodiesAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = fakeUploadRefRequestBodiesValidateBeforeCall(petId, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getFakeArrayofenums + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public okhttp3.Call getFakeArrayofenumsCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/array-of-enums"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFakeArrayofenumsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getFakeArrayofenumsCall(_callback); + + } + + /** + * Array of Enums + * + * @return List<OuterEnum> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public List getFakeArrayofenums() throws ApiException { + ApiResponse> localVarResp = getFakeArrayofenumsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Array of Enums + * + * @return ApiResponse<List<OuterEnum>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public ApiResponse> getFakeArrayofenumsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getFakeArrayofenumsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Array of Enums (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public okhttp3.Call getFakeArrayofenumsAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getFakeArrayofenumsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getFakeHealth + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public okhttp3.Call getFakeHealthCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/health"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFakeHealthValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getFakeHealthCall(_callback); + + } + + /** + * Health check endpoint + * + * @return HealthCheckResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public HealthCheckResult getFakeHealth() throws ApiException { + ApiResponse localVarResp = getFakeHealthWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Health check endpoint + * + * @return ApiResponse<HealthCheckResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public ApiResponse getFakeHealthWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getFakeHealthValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Health check endpoint (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public okhttp3.Call getFakeHealthAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getFakeHealthValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getParameterNameMapping + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterNameMappingCall(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/parameter-name-mapping"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (type != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("type", type)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (underscoreType != null) { + localVarHeaderParams.put("_type", localVarApiClient.parameterToString(underscoreType)); + } + + + if (typeWithUnderscore != null) { + localVarHeaderParams.put("type_", localVarApiClient.parameterToString(typeWithUnderscore)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getParameterNameMappingValidateBeforeCall(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'underscoreType' is set + if (underscoreType == null) { + throw new ApiException("Missing the required parameter 'underscoreType' when calling getParameterNameMapping(Async)"); + } + + // verify the required parameter 'type' is set + if (type == null) { + throw new ApiException("Missing the required parameter 'type' when calling getParameterNameMapping(Async)"); + } + + // verify the required parameter 'typeWithUnderscore' is set + if (typeWithUnderscore == null) { + throw new ApiException("Missing the required parameter 'typeWithUnderscore' when calling getParameterNameMapping(Async)"); + } + + return getParameterNameMappingCall(underscoreType, type, typeWithUnderscore, _callback); + + } + + /** + * parameter name mapping test + * + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getParameterNameMapping(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore) throws ApiException { + getParameterNameMappingWithHttpInfo(underscoreType, type, typeWithUnderscore); + } + + /** + * parameter name mapping test + * + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getParameterNameMappingWithHttpInfo(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore) throws ApiException { + okhttp3.Call localVarCall = getParameterNameMappingValidateBeforeCall(underscoreType, type, typeWithUnderscore, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * parameter name mapping test (asynchronously) + * + * @param underscoreType _type (required) + * @param type type (required) + * @param typeWithUnderscore type_ (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getParameterNameMappingAsync(@javax.annotation.Nonnull Long underscoreType, @javax.annotation.Nonnull String type, @javax.annotation.Nonnull String typeWithUnderscore, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getParameterNameMappingValidateBeforeCall(underscoreType, type, typeWithUnderscore, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testAdditionalPropertiesReference + * @param requestBody request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testAdditionalPropertiesReferenceCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/fake/additionalProperties-reference"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testAdditionalPropertiesReferenceValidateBeforeCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference(Async)"); + } + + return testAdditionalPropertiesReferenceCall(requestBody, _callback); + + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testAdditionalPropertiesReference(@javax.annotation.Nonnull Map requestBody) throws ApiException { + testAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testAdditionalPropertiesReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { + okhttp3.Call localVarCall = testAdditionalPropertiesReferenceValidateBeforeCall(requestBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test referenced additionalProperties (asynchronously) + * + * @param requestBody request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testAdditionalPropertiesReferenceAsync(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testAdditionalPropertiesReferenceValidateBeforeCall(requestBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testBodyWithFileSchema + * @param fileSchemaTestClass (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaCall(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = fileSchemaTestClass; + + // create path and map variables + String localVarPath = "/fake/body-with-file-schema"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithFileSchemaValidateBeforeCall(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) { + throw new ApiException("Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema(Async)"); + } + + return testBodyWithFileSchemaCall(fileSchemaTestClass, _callback); + + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithFileSchema(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithFileSchemaWithHttpInfo(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass) throws ApiException { + okhttp3.Call localVarCall = testBodyWithFileSchemaValidateBeforeCall(fileSchemaTestClass, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithFileSchemaAsync(@javax.annotation.Nonnull FileSchemaTestClass fileSchemaTestClass, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyWithFileSchemaValidateBeforeCall(fileSchemaTestClass, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testBodyWithQueryParams + * @param query (required) + * @param user (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsCall(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (query != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testBodyWithQueryParamsValidateBeforeCall(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException("Missing the required parameter 'query' when calling testBodyWithQueryParams(Async)"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling testBodyWithQueryParams(Async)"); + } + + return testBodyWithQueryParamsCall(query, user, _callback); + + } + + /** + * + * + * @param query (required) + * @param user (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithQueryParams(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(query, user); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = testBodyWithQueryParamsValidateBeforeCall(query, user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * + * @param query (required) + * @param user (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testBodyWithQueryParamsAsync(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testBodyWithQueryParamsValidateBeforeCall(query, user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testClientModel + * @param client client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = client; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClientModelValidateBeforeCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException("Missing the required parameter 'client' when calling testClientModel(Async)"); + } + + return testClientModelCall(client, _callback); + + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClientModel(@javax.annotation.Nonnull Client client) throws ApiException { + ApiResponse localVarResp = testClientModelWithHttpInfo(client); + return localVarResp.getData(); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return ApiResponse<Client> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClientModelWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { + okhttp3.Call localVarCall = testClientModelValidateBeforeCall(client, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test \"client\" model (asynchronously) + * To test \"client\" model + * @param client client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClientModelAsync(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testClientModelValidateBeforeCall(client, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testEndpointParameters + * @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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersCall(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "http_basic_test" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEndpointParametersValidateBeforeCall(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException("Missing the required parameter 'number' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException("Missing the required parameter '_double' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) { + throw new ApiException("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters(Async)"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException("Missing the required parameter '_byte' when calling testEndpointParameters(Async)"); + } + + return testEndpointParametersCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, _callback); + + } + + /** + * 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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void testEndpointParameters(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable 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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse testEndpointParametersWithHttpInfo(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) throws ApiException { + okhttp3.Call localVarCall = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 (asynchronously) + * 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-01T10:20:10.111110+01:00) + * @param password None (optional) + * @param paramCallback None (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call testEndpointParametersAsync(@javax.annotation.Nonnull BigDecimal number, @javax.annotation.Nonnull Double _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull byte[] _byte, @javax.annotation.Nullable Integer integer, @javax.annotation.Nullable Integer int32, @javax.annotation.Nullable Long int64, @javax.annotation.Nullable Float _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable File binary, @javax.annotation.Nullable LocalDate date, @javax.annotation.Nullable OffsetDateTime dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEndpointParametersValidateBeforeCall(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testEnumParameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersCall(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (enumFormStringArray != null) { + localVarFormParams.put("enum_form_string_array", enumFormStringArray); + } + + if (enumFormString != null) { + localVarFormParams.put("enum_form_string", enumFormString); + } + + if (enumQueryStringArray != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "enum_query_string_array", enumQueryStringArray)); + } + + if (enumQueryString != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_string", enumQueryString)); + } + + if (enumQueryInteger != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_integer", enumQueryInteger)); + } + + if (enumQueryDouble != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enum_query_double", enumQueryDouble)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (enumHeaderStringArray != null) { + localVarHeaderParams.put("enum_header_string_array", localVarApiClient.parameterToString(enumHeaderStringArray)); + } + + + if (enumHeaderString != null) { + localVarHeaderParams.put("enum_header_string", localVarApiClient.parameterToString(enumHeaderString)); + } + + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testEnumParametersValidateBeforeCall(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + return testEnumParametersCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, _callback); + + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public void testEnumParameters(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable 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) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public ApiResponse testEnumParametersWithHttpInfo(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString) throws ApiException { + okhttp3.Call localVarCall = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * To test enum parameters (asynchronously) + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @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) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public okhttp3.Call testEnumParametersAsync(@javax.annotation.Nullable List enumHeaderStringArray, @javax.annotation.Nullable String enumHeaderString, @javax.annotation.Nullable List enumQueryStringArray, @javax.annotation.Nullable String enumQueryString, @javax.annotation.Nullable Integer enumQueryInteger, @javax.annotation.Nullable Double enumQueryDouble, @javax.annotation.Nullable List enumFormStringArray, @javax.annotation.Nullable String enumFormString, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testEnumParametersValidateBeforeCall(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + private okhttp3.Call testGroupParametersCall(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (requiredStringGroup != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("required_string_group", requiredStringGroup)); + } + + if (requiredInt64Group != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("required_int64_group", requiredInt64Group)); + } + + if (stringGroup != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("string_group", stringGroup)); + } + + if (int64Group != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("int64_group", int64Group)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (requiredBooleanGroup != null) { + localVarHeaderParams.put("required_boolean_group", localVarApiClient.parameterToString(requiredBooleanGroup)); + } + + + if (booleanGroup != null) { + localVarHeaderParams.put("boolean_group", localVarApiClient.parameterToString(booleanGroup)); + } + + + String[] localVarAuthNames = new String[] { "bearer_test" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testGroupParametersValidateBeforeCall(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requiredStringGroup' is set + if (requiredStringGroup == null) { + throw new ApiException("Missing the required parameter 'requiredStringGroup' when calling testGroupParameters(Async)"); + } + + // verify the required parameter 'requiredBooleanGroup' is set + if (requiredBooleanGroup == null) { + throw new ApiException("Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters(Async)"); + } + + // verify the required parameter 'requiredInt64Group' is set + if (requiredInt64Group == null) { + throw new ApiException("Missing the required parameter 'requiredInt64Group' when calling testGroupParameters(Async)"); + } + + return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + + } + + + private ApiResponse testGroupParametersWithHttpInfo(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group) throws ApiException { + okhttp3.Call localVarCall = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call testGroupParametersAsync(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group, @javax.annotation.Nullable Integer stringGroup, @javax.annotation.Nullable Boolean booleanGroup, @javax.annotation.Nullable Long int64Group, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testGroupParametersValidateBeforeCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APItestGroupParametersRequest { + @javax.annotation.Nonnull + private final Integer requiredStringGroup; + @javax.annotation.Nonnull + private final Boolean requiredBooleanGroup; + @javax.annotation.Nonnull + private final Long requiredInt64Group; + @javax.annotation.Nullable + private Integer stringGroup; + @javax.annotation.Nullable + private Boolean booleanGroup; + @javax.annotation.Nullable + private Long int64Group; + + private APItestGroupParametersRequest(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group) { + this.requiredStringGroup = requiredStringGroup; + this.requiredBooleanGroup = requiredBooleanGroup; + this.requiredInt64Group = requiredInt64Group; + } + + /** + * Set stringGroup + * @param stringGroup String in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest stringGroup(@javax.annotation.Nullable Integer stringGroup) { + this.stringGroup = stringGroup; + return this; + } + + /** + * Set booleanGroup + * @param booleanGroup Boolean in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest booleanGroup(@javax.annotation.Nullable Boolean booleanGroup) { + this.booleanGroup = booleanGroup; + return this; + } + + /** + * Set int64Group + * @param int64Group Integer in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest int64Group(@javax.annotation.Nullable Long int64Group) { + this.int64Group = int64Group; + return this; + } + + /** + * Build call for testGroupParameters + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return testGroupParametersCall(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + } + + /** + * Execute testGroupParameters request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public void execute() throws ApiException { + testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /** + * Execute testGroupParameters request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /** + * Execute testGroupParameters request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return testGroupParametersAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _callback); + } + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @return APItestGroupParametersRequest + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Something wrong -
+ */ + public APItestGroupParametersRequest testGroupParameters(@javax.annotation.Nonnull Integer requiredStringGroup, @javax.annotation.Nonnull Boolean requiredBooleanGroup, @javax.annotation.Nonnull Long requiredInt64Group) { + return new APItestGroupParametersRequest(requiredStringGroup, requiredBooleanGroup, requiredInt64Group); + } + /** + * Build call for testInlineAdditionalProperties + * @param requestBody request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineAdditionalPropertiesCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/fake/inline-additionalProperties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testInlineAdditionalPropertiesValidateBeforeCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties(Async)"); + } + + return testInlineAdditionalPropertiesCall(requestBody, _callback); + + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testInlineAdditionalProperties(@javax.annotation.Nonnull Map requestBody) throws ApiException { + testInlineAdditionalPropertiesWithHttpInfo(requestBody); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { + okhttp3.Call localVarCall = testInlineAdditionalPropertiesValidateBeforeCall(requestBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test inline additionalProperties (asynchronously) + * + * @param requestBody request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineAdditionalPropertiesAsync(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testInlineAdditionalPropertiesValidateBeforeCall(requestBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testInlineFreeformAdditionalProperties + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineFreeformAdditionalPropertiesCall(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = testInlineFreeformAdditionalPropertiesRequest; + + // create path and map variables + String localVarPath = "/fake/inline-freeform-additionalProperties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testInlineFreeformAdditionalPropertiesValidateBeforeCall(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set + if (testInlineFreeformAdditionalPropertiesRequest == null) { + throw new ApiException("Missing the required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling testInlineFreeformAdditionalProperties(Async)"); + } + + return testInlineFreeformAdditionalPropertiesCall(testInlineFreeformAdditionalPropertiesRequest, _callback); + + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testInlineFreeformAdditionalProperties(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { + testInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest); + } + + /** + * test inline free-form additionalProperties + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testInlineFreeformAdditionalPropertiesWithHttpInfo(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) throws ApiException { + okhttp3.Call localVarCall = testInlineFreeformAdditionalPropertiesValidateBeforeCall(testInlineFreeformAdditionalPropertiesRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test inline free-form additionalProperties (asynchronously) + * + * @param testInlineFreeformAdditionalPropertiesRequest request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testInlineFreeformAdditionalPropertiesAsync(@javax.annotation.Nonnull TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testInlineFreeformAdditionalPropertiesValidateBeforeCall(testInlineFreeformAdditionalPropertiesRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testJsonFormData + * @param param field1 (required) + * @param param2 field2 (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testJsonFormDataCall(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/jsonFormData"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testJsonFormDataValidateBeforeCall(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'param' is set + if (param == null) { + throw new ApiException("Missing the required parameter 'param' when calling testJsonFormData(Async)"); + } + + // verify the required parameter 'param2' is set + if (param2 == null) { + throw new ApiException("Missing the required parameter 'param2' when calling testJsonFormData(Async)"); + } + + return testJsonFormDataCall(param, param2, _callback); + + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testJsonFormData(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testJsonFormDataWithHttpInfo(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2) throws ApiException { + okhttp3.Call localVarCall = testJsonFormDataValidateBeforeCall(param, param2, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test json serialization of form data (asynchronously) + * + * @param param field1 (required) + * @param param2 field2 (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testJsonFormDataAsync(@javax.annotation.Nonnull String param, @javax.annotation.Nonnull String param2, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testJsonFormDataValidateBeforeCall(param, param2, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testNullableRequiredFieldsAnyOf + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testNullableRequiredFieldsAnyOfCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/nullable-required-fields-anyof"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testNullableRequiredFieldsAnyOfValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return testNullableRequiredFieldsAnyOfCall(_callback); + + } + + /** + * test anyOf with map of objects containing nullable required fields + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * @return NullableFieldsMapResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public NullableFieldsMapResponse testNullableRequiredFieldsAnyOf() throws ApiException { + ApiResponse localVarResp = testNullableRequiredFieldsAnyOfWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * test anyOf with map of objects containing nullable required fields + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * @return ApiResponse<NullableFieldsMapResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testNullableRequiredFieldsAnyOfWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = testNullableRequiredFieldsAnyOfValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * test anyOf with map of objects containing nullable required fields (asynchronously) + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testNullableRequiredFieldsAnyOfAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testNullableRequiredFieldsAnyOfValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for testQueryParameterCollectionFormat + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testQueryParameterCollectionFormatCall(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/test-query-parameters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pipe != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "pipe", pipe)); + } + + if (ioutil != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "ioutil", ioutil)); + } + + if (http != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("ssv", "http", http)); + } + + if (url != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "url", url)); + } + + if (context != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "context", context)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testQueryParameterCollectionFormatValidateBeforeCall(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pipe' is set + if (pipe == null) { + throw new ApiException("Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) { + throw new ApiException("Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'http' is set + if (http == null) { + throw new ApiException("Missing the required parameter 'http' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'url' is set + if (url == null) { + throw new ApiException("Missing the required parameter 'url' when calling testQueryParameterCollectionFormat(Async)"); + } + + // verify the required parameter 'context' is set + if (context == null) { + throw new ApiException("Missing the required parameter 'context' when calling testQueryParameterCollectionFormat(Async)"); + } + + return testQueryParameterCollectionFormatCall(pipe, ioutil, http, url, context, _callback); + + } + + /** + * + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public void testQueryParameterCollectionFormat(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context) throws ApiException { + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Success -
+ */ + public okhttp3.Call testQueryParameterCollectionFormatAsync(@javax.annotation.Nonnull List pipe, @javax.annotation.Nonnull List ioutil, @javax.annotation.Nonnull List http, @javax.annotation.Nonnull List url, @javax.annotation.Nonnull List context, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testQueryParameterCollectionFormatValidateBeforeCall(pipe, ioutil, http, url, context, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for testStringMapReference + * @param requestBody request body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testStringMapReferenceCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/fake/stringMap-reference"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testStringMapReferenceValidateBeforeCall(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling testStringMapReference(Async)"); + } + + return testStringMapReferenceCall(requestBody, _callback); + + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public void testStringMapReference(@javax.annotation.Nonnull Map requestBody) throws ApiException { + testStringMapReferenceWithHttpInfo(requestBody); + } + + /** + * test referenced string map + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testStringMapReferenceWithHttpInfo(@javax.annotation.Nonnull Map requestBody) throws ApiException { + okhttp3.Call localVarCall = testStringMapReferenceValidateBeforeCall(requestBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * test referenced string map (asynchronously) + * + * @param requestBody request body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testStringMapReferenceAsync(@javax.annotation.Nonnull Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testStringMapReferenceValidateBeforeCall(requestBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java new file mode 100644 index 000000000000..37d77f84a8da --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,205 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Client; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeClassnameTags123Api { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for testClassname + * @param client client model (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = client; + + // create path and map variables + String localVarPath = "/fake_classname_test"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key_query" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call testClassnameValidateBeforeCall(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException("Missing the required parameter 'client' when calling testClassname(Async)"); + } + + return testClassnameCall(client, _callback); + + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClassname(@javax.annotation.Nonnull Client client) throws ApiException { + ApiResponse localVarResp = testClassnameWithHttpInfo(client); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClassnameWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { + okhttp3.Call localVarCall = testClassnameValidateBeforeCall(client, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * To test class name in snake case (asynchronously) + * To test class name in snake case + * @param client client model (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call testClassnameAsync(@javax.annotation.Nonnull Client client, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = testClassnameValidateBeforeCall(client, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..079c4bc07209 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,1329 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PetApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addPet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call addPetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addPetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling addPet(Async)"); + } + + return addPetCall(pet, _callback); + + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void addPet(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Add a new pet to the store (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call addPetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addPetValidateBeforeCall(pet, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deletePet + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (apiKey != null) { + localVarHeaderParams.put("api_key", localVarApiClient.parameterToString(apiKey)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePetValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)"); + } + + return deletePetCall(petId, apiKey, _callback); + + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deletes a pet (asynchronously) + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public okhttp3.Call deletePetAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePetValidateBeforeCall(petId, apiKey, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for findPetsByStatus + * @param status Status values that need to be considered for filter (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "status", status)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByStatusValidateBeforeCall(@javax.annotation.Nonnull List status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)"); + } + + return findPetsByStatusCall(status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(@javax.annotation.Nonnull List status) throws ApiException { + ApiResponse> localVarResp = findPetsByStatusWithHttpInfo(status); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List status) throws ApiException { + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by status (asynchronously) + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public okhttp3.Call findPetsByStatusAsync(@javax.annotation.Nonnull List status, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByStatusValidateBeforeCall(status, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for findPetsByTags + * @param tags Tags to filter by (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call findPetsByTagsValidateBeforeCall(@javax.annotation.Nonnull List tags, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)"); + } + + return findPetsByTagsCall(tags, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public List findPetsByTags(@javax.annotation.Nonnull List tags) throws ApiException { + ApiResponse> localVarResp = findPetsByTagsWithHttpInfo(tags); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List tags) throws ApiException { + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Finds Pets by tags (asynchronously) + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call findPetsByTagsAsync(@javax.annotation.Nonnull List tags, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = findPetsByTagsValidateBeforeCall(tags, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPetById + * @param petId ID of pet to return (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPetByIdValidateBeforeCall(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)"); + } + + return getPetByIdCall(petId, _callback); + + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { + ApiResponse localVarResp = getPetByIdWithHttpInfo(petId); + return localVarResp.getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find pet by ID (asynchronously) + * Returns a single pet + * @param petId ID of pet to return (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public okhttp3.Call getPetByIdAsync(@javax.annotation.Nonnull Long petId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPetByIdValidateBeforeCall(petId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePet + * @param pet Pet object that needs to be added to the store (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pet; + + // create path and map variables + String localVarPath = "/pet"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetValidateBeforeCall(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException("Missing the required parameter 'pet' when calling updatePet(Async)"); + } + + return updatePetCall(pet, _callback); + + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public void updatePet(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public ApiResponse updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update an existing pet (asynchronously) + * + * @param pet Pet object that needs to be added to the store (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public okhttp3.Call updatePetAsync(@javax.annotation.Nonnull Pet pet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetValidateBeforeCall(pet, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updatePetWithForm + * @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) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePetWithFormValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)"); + } + + return updatePetWithFormCall(petId, name, status, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updates a pet in the store with form data (asynchronously) + * + * @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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
405 Invalid input -
+ */ + public okhttp3.Call updatePetWithFormAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePetWithFormValidateBeforeCall(petId, name, status, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for uploadFile + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (contentType != null) { + localVarHeaderParams.put("Content-Type", localVarApiClient.parameterToString(contentType)); + } + + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)"); + } + + return uploadFileCall(petId, contentType, additionalMetadata, _file, _callback); + + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + ApiResponse localVarResp = uploadFileWithHttpInfo(petId, contentType, additionalMetadata, _file); + return localVarResp.getData(); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, contentType, additionalMetadata, _file, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (asynchronously) + * + * @param petId ID of pet to update (required) + * @param contentType Content type header parameter (optional) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _file file to upload (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String contentType, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileValidateBeforeCall(petId, contentType, additionalMetadata, _file, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for uploadFileWithRequiredFile + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" + .replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = 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 = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadFileWithRequiredFileValidateBeforeCall(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException("Missing the required parameter 'petId' when calling uploadFileWithRequiredFile(Async)"); + } + + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) { + throw new ApiException("Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile(Async)"); + } + + return uploadFileWithRequiredFileCall(petId, requiredFile, additionalMetadata, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + ApiResponse localVarResp = uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { + okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * uploads an image (required) (asynchronously) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call uploadFileWithRequiredFileAsync(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadFileWithRequiredFileValidateBeforeCall(petId, requiredFile, additionalMetadata, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..14fb6a5f9b1a --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,593 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Order; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class StoreApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteOrder + * @param orderId ID of the order that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replace("{" + "order_id" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOrderValidateBeforeCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); + } + + return deleteOrderCall(orderId, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete purchase order by ID (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call deleteOrderAsync(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getInventory + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getInventoryCall(_callback); + + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public Map getInventory() throws ApiException { + ApiResponse> localVarResp = getInventoryWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Returns pet inventories by status (asynchronously) + * Returns a map of status codes to quantities + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
+ */ + public okhttp3.Call getInventoryAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderById + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replace("{" + "order_id" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderByIdValidateBeforeCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); + } + + return getOrderByIdCall(orderId, _callback); + + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { + ApiResponse localVarResp = getOrderByIdWithHttpInfo(orderId); + return localVarResp.getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Find purchase order by ID (asynchronously) + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public okhttp3.Call getOrderByIdAsync(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for placeOrder + * @param order order placed for purchasing the pet (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = order; + + // create path and map variables + String localVarPath = "/store/order"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException("Missing the required parameter 'order' when calling placeOrder(Async)"); + } + + return placeOrderCall(order, _callback); + + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { + ApiResponse localVarResp = placeOrderWithHttpInfo(order); + return localVarResp.getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Place an order for a pet (asynchronously) + * + * @param order order placed for purchasing the pet (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public okhttp3.Call placeOrderAsync(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..8198104c9fa7 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,1105 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UserApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createUser + * @param user Created user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUserValidateBeforeCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUser(Async)"); + } + + return createUserCall(user, _callback); + + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create user (asynchronously) + * This can only be done by the logged in user. + * @param user Created user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUserAsync(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUserValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithArrayInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithArrayInput(Async)"); + } + + return createUsersWithArrayInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithArrayInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createUsersWithListInput + * @param user List of user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/createWithList"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createUsersWithListInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling createUsersWithListInput(Async)"); + } + + return createUsersWithListInputCall(user, _callback); + + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Creates list of users with given input array (asynchronously) + * + * @param user List of user object (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call createUsersWithListInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteUser + * @param username The name that needs to be deleted (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteUserValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); + } + + return deleteUserCall(username, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(@javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete user (asynchronously) + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call deleteUserAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getUserByName + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByNameValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); + } + + return getUserByNameCall(username, _callback); + + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { + ApiResponse localVarResp = getUserByNameWithHttpInfo(username); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get user by user name (asynchronously) + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public okhttp3.Call getUserByNameAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for loginUser + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
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 okhttp3.Call loginUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/login"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (username != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); + } + + if (password != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("password", password)); + } + + final String[] localVarAccepts = { + "application/xml", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call loginUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); + } + + return loginUserCall(username, password, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + ApiResponse localVarResp = loginUserWithHttpInfo(username, password); + return localVarResp.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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
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(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Logs user into the system (asynchronously) + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
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 okhttp3.Call loginUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for logoutUser + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return logoutUserCall(_callback); + + } + + /** + * Logs out current logged in user session + * + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Logs out current logged in user session (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
0 successful operation -
+ */ + public okhttp3.Call logoutUserAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateUser + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = user; + + // create path and map variables + String localVarPath = "/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException("Missing the required parameter 'user' when calling updateUser(Async)"); + } + + return updateUserCall(username, user, _callback); + + } + + /** + * 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull 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 fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Updated user (asynchronously) + * 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) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public okhttp3.Call updateUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/ValuesApi.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/ValuesApi.java new file mode 100644 index 000000000000..d05854b9f3e9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/api/ValuesApi.java @@ -0,0 +1,199 @@ +/* + * 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.api; + +import org.openapitools.client.ApiCallback; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.JSON; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.ProgressRequestBody; +import org.openapitools.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.client.model.Variable; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ValuesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ValuesApi() { + this(Configuration.getDefaultApiClient()); + } + + public ValuesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getSomeValues + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public okhttp3.Call getSomeValuesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/values"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSomeValuesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getSomeValuesCall(_callback); + + } + + /** + * Get some primitive variable values + * + * @return Variable + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public Variable getSomeValues() throws ApiException { + ApiResponse localVarResp = getSomeValuesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get some primitive variable values + * + * @return ApiResponse<Variable> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public ApiResponse getSomeValuesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getSomeValuesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + + + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get some primitive variable values (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Value -
+ */ + public okhttp3.Call getSomeValuesAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSomeValuesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..ed5f5fbc16ef --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * 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.ApiException; +import org.openapitools.client.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..bd5e463d0b42 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..f655936f3a78 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,54 @@ +/* + * 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 okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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; + } + headerParams.put("Authorization", Credentials.basic(username == null ? "" : username, password == null ? "" : password)); + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..5aff174aff81 --- /dev/null +++ b/samples/client/petstore/java/okhttp/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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 AdditionalHeader. + * + * @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 AdditionalHeader. + * + * @param bearerToken The bearer token + */ + 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/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..6f945f45ed46 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,43 @@ +/* + * 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; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken == null) { + return; + } + headerParams.put("Authorization", "Bearer " + accessToken); + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..59009502c11e --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * 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; + +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 000000000000..cefbf4af907b --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * 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 okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 000000000000..5521ee31599c --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * 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.ApiException; +import org.openapitools.client.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..fc0f2c973b8d --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.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 org.openapitools.client.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +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 oneOf/anyOf composed 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 + */ + 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 instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * 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(Object o) { + return o == null ? "null" : 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 nullable + * + * @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/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..9a942f853305 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,503 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AdditionalPropertiesClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AdditionalPropertiesClass { + public static final String SERIALIZED_NAME_MAP_PROPERTY = "map_property"; + @SerializedName(SERIALIZED_NAME_MAP_PROPERTY) + @javax.annotation.Nullable + private Map mapProperty = new HashMap<>(); + + public static final String SERIALIZED_NAME_MAP_OF_MAP_PROPERTY = "map_of_map_property"; + @SerializedName(SERIALIZED_NAME_MAP_OF_MAP_PROPERTY) + @javax.annotation.Nullable + private Map> mapOfMapProperty = new HashMap<>(); + + public static final String SERIALIZED_NAME_ANYTYPE1 = "anytype_1"; + @SerializedName(SERIALIZED_NAME_ANYTYPE1) + @javax.annotation.Nullable + private Object anytype1 = null; + + public static final String SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1 = "map_with_undeclared_properties_anytype_1"; + @SerializedName(SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1) + @javax.annotation.Nullable + private Object mapWithUndeclaredPropertiesAnytype1; + + public static final String SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2 = "map_with_undeclared_properties_anytype_2"; + @SerializedName(SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2) + @javax.annotation.Nullable + private Object mapWithUndeclaredPropertiesAnytype2; + + public static final String SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3 = "map_with_undeclared_properties_anytype_3"; + @SerializedName(SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3) + @javax.annotation.Nullable + private Map mapWithUndeclaredPropertiesAnytype3 = new HashMap<>(); + + public static final String SERIALIZED_NAME_EMPTY_MAP = "empty_map"; + @SerializedName(SERIALIZED_NAME_EMPTY_MAP) + @javax.annotation.Nullable + private Object emptyMap; + + public static final String SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_STRING = "map_with_undeclared_properties_string"; + @SerializedName(SERIALIZED_NAME_MAP_WITH_UNDECLARED_PROPERTIES_STRING) + @javax.annotation.Nullable + private Map mapWithUndeclaredPropertiesString = new HashMap<>(); + + public AdditionalPropertiesClass() { + } + + public AdditionalPropertiesClass mapProperty(@javax.annotation.Nullable 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 + + public Map getMapProperty() { + return mapProperty; + } + + public void setMapProperty(@javax.annotation.Nullable Map mapProperty) { + this.mapProperty = mapProperty; + } + + + public AdditionalPropertiesClass mapOfMapProperty(@javax.annotation.Nullable 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 + + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + public void setMapOfMapProperty(@javax.annotation.Nullable Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + public AdditionalPropertiesClass anytype1(@javax.annotation.Nullable Object anytype1) { + this.anytype1 = anytype1; + return this; + } + + /** + * Get anytype1 + * @return anytype1 + */ + @javax.annotation.Nullable + + public Object getAnytype1() { + return anytype1; + } + + public void setAnytype1(@javax.annotation.Nullable Object anytype1) { + this.anytype1 = anytype1; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype1(@javax.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype1) { + this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; + return this; + } + + /** + * Get mapWithUndeclaredPropertiesAnytype1 + * @return mapWithUndeclaredPropertiesAnytype1 + */ + @javax.annotation.Nullable + + public Object getMapWithUndeclaredPropertiesAnytype1() { + return mapWithUndeclaredPropertiesAnytype1; + } + + public void setMapWithUndeclaredPropertiesAnytype1(@javax.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype1) { + this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype2(@javax.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype2) { + this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; + return this; + } + + /** + * Get mapWithUndeclaredPropertiesAnytype2 + * @return mapWithUndeclaredPropertiesAnytype2 + */ + @javax.annotation.Nullable + + public Object getMapWithUndeclaredPropertiesAnytype2() { + return mapWithUndeclaredPropertiesAnytype2; + } + + public void setMapWithUndeclaredPropertiesAnytype2(@javax.annotation.Nullable Object mapWithUndeclaredPropertiesAnytype2) { + this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype3(@javax.annotation.Nullable 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 + + public Map getMapWithUndeclaredPropertiesAnytype3() { + return mapWithUndeclaredPropertiesAnytype3; + } + + public void setMapWithUndeclaredPropertiesAnytype3(@javax.annotation.Nullable Map mapWithUndeclaredPropertiesAnytype3) { + this.mapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; + } + + + public AdditionalPropertiesClass emptyMap(@javax.annotation.Nullable 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 + + public Object getEmptyMap() { + return emptyMap; + } + + public void setEmptyMap(@javax.annotation.Nullable Object emptyMap) { + this.emptyMap = emptyMap; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesString(@javax.annotation.Nullable 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 + + public Map getMapWithUndeclaredPropertiesString() { + return mapWithUndeclaredPropertiesString; + } + + public void setMapWithUndeclaredPropertiesString(@javax.annotation.Nullable Map mapWithUndeclaredPropertiesString) { + this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdditionalPropertiesClass instance itself + */ + public AdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("map_property", "map_of_map_property", "anytype_1", "map_with_undeclared_properties_anytype_1", "map_with_undeclared_properties_anytype_2", "map_with_undeclared_properties_anytype_3", "empty_map", "map_with_undeclared_properties_string")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertiesClass + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AdditionalPropertiesClass is not found in the empty JSON string", AdditionalPropertiesClass.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertiesClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertiesClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertiesClass.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertiesClass value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertiesClass read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AdditionalPropertiesClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertiesClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertiesClass + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertiesClass + */ + public static AdditionalPropertiesClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertiesClass.class); + } + + /** + * Convert an instance of AdditionalPropertiesClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java new file mode 100644 index 000000000000..cb9f28576030 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java @@ -0,0 +1,373 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributes; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfModelArrayAnyOf + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfModelArrayAnyOf { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name = "default-name"; + + public static final String SERIALIZED_NAME_LINK_LIST_COLUMN1 = "linkListColumn1"; + @SerializedName(SERIALIZED_NAME_LINK_LIST_COLUMN1) + @javax.annotation.Nullable + private AllOfModelArrayAnyOfAllOfLinkListColumn1 linkListColumn1; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nullable + private AllOfModelArrayAnyOfAllOfAttributes attributes; + + public AllOfModelArrayAnyOf() { + } + + public AllOfModelArrayAnyOf id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public AllOfModelArrayAnyOf name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public AllOfModelArrayAnyOf linkListColumn1(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfLinkListColumn1 linkListColumn1) { + this.linkListColumn1 = linkListColumn1; + return this; + } + + /** + * Get linkListColumn1 + * @return linkListColumn1 + */ + @javax.annotation.Nullable + + public AllOfModelArrayAnyOfAllOfLinkListColumn1 getLinkListColumn1() { + return linkListColumn1; + } + + public void setLinkListColumn1(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfLinkListColumn1 linkListColumn1) { + this.linkListColumn1 = linkListColumn1; + } + + + public AllOfModelArrayAnyOf attributes(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get attributes + * @return attributes + */ + @javax.annotation.Nullable + + public AllOfModelArrayAnyOfAllOfAttributes getAttributes() { + return attributes; + } + + public void setAttributes(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributes attributes) { + this.attributes = attributes; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfModelArrayAnyOf instance itself + */ + public AllOfModelArrayAnyOf putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfModelArrayAnyOf {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" linkListColumn1: ").append(toIndentedString(linkListColumn1)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name", "linkListColumn1", "attributes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllOfModelArrayAnyOf + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllOfModelArrayAnyOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AllOfModelArrayAnyOf is not found in the empty JSON string", AllOfModelArrayAnyOf.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllOfModelArrayAnyOf.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `linkListColumn1` + if (jsonObj.get("linkListColumn1") != null && !jsonObj.get("linkListColumn1").isJsonNull()) { + AllOfModelArrayAnyOfAllOfLinkListColumn1.validateJsonElement(jsonObj.get("linkListColumn1")); + } + // validate the optional field `attributes` + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + AllOfModelArrayAnyOfAllOfAttributes.validateJsonElement(jsonObj.get("attributes")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllOfModelArrayAnyOf.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllOfModelArrayAnyOf' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllOfModelArrayAnyOf.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllOfModelArrayAnyOf value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AllOfModelArrayAnyOf read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AllOfModelArrayAnyOf instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllOfModelArrayAnyOf given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllOfModelArrayAnyOf + * @throws IOException if the JSON string is invalid with respect to AllOfModelArrayAnyOf + */ + public static AllOfModelArrayAnyOf fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllOfModelArrayAnyOf.class); + } + + /** + * Convert an instance of AllOfModelArrayAnyOf to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java new file mode 100644 index 000000000000..42492a7bba37 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java @@ -0,0 +1,280 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributesC; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfModelArrayAnyOfAllOfAttributes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfModelArrayAnyOfAllOfAttributes { + public static final String SERIALIZED_NAME_C = "C"; + @SerializedName(SERIALIZED_NAME_C) + @javax.annotation.Nullable + private AllOfModelArrayAnyOfAllOfAttributesC C; + + public AllOfModelArrayAnyOfAllOfAttributes() { + } + + public AllOfModelArrayAnyOfAllOfAttributes C(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributesC C) { + this.C = C; + return this; + } + + /** + * Get C + * @return C + */ + @javax.annotation.Nullable + + public AllOfModelArrayAnyOfAllOfAttributesC getC() { + return C; + } + + public void setC(@javax.annotation.Nullable AllOfModelArrayAnyOfAllOfAttributesC C) { + this.C = C; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfModelArrayAnyOfAllOfAttributes instance itself + */ + public AllOfModelArrayAnyOfAllOfAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfModelArrayAnyOfAllOfAttributes {\n"); + sb.append(" C: ").append(toIndentedString(C)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("C")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllOfModelArrayAnyOfAllOfAttributes + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllOfModelArrayAnyOfAllOfAttributes.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AllOfModelArrayAnyOfAllOfAttributes is not found in the empty JSON string", AllOfModelArrayAnyOfAllOfAttributes.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `C` + if (jsonObj.get("C") != null && !jsonObj.get("C").isJsonNull()) { + AllOfModelArrayAnyOfAllOfAttributesC.validateJsonElement(jsonObj.get("C")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllOfModelArrayAnyOfAllOfAttributes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllOfModelArrayAnyOfAllOfAttributes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllOfModelArrayAnyOfAllOfAttributes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllOfModelArrayAnyOfAllOfAttributes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AllOfModelArrayAnyOfAllOfAttributes read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AllOfModelArrayAnyOfAllOfAttributes instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllOfModelArrayAnyOfAllOfAttributes given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllOfModelArrayAnyOfAllOfAttributes + * @throws IOException if the JSON string is invalid with respect to AllOfModelArrayAnyOfAllOfAttributes + */ + public static AllOfModelArrayAnyOfAllOfAttributes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllOfModelArrayAnyOfAllOfAttributes.class); + } + + /** + * Convert an instance of AllOfModelArrayAnyOfAllOfAttributes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java new file mode 100644 index 000000000000..ca40d898e196 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java @@ -0,0 +1,277 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Order; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfModelArrayAnyOfAllOfAttributesC extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AllOfModelArrayAnyOfAllOfAttributesC.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllOfModelArrayAnyOfAllOfAttributesC + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize Pet + try { + // validate the JSON object to see if any exception is thrown + Pet.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Pet failed with `%s`.", e.getMessage())); + } + + // deserialize Order + try { + // validate the JSON object to see if any exception is thrown + Order.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Order failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for AllOfModelArrayAnyOfAllOfAttributesC: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllOfModelArrayAnyOfAllOfAttributesC.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllOfModelArrayAnyOfAllOfAttributesC' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPet = gson.getDelegateAdapter(this, TypeToken.get(Pet.class)); + final TypeAdapter adapterOrder = gson.getDelegateAdapter(this, TypeToken.get(Order.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllOfModelArrayAnyOfAllOfAttributesC value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Pet` + if (value.getActualInstance() instanceof Pet) { + JsonElement element = adapterPet.toJsonTree((Pet)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `Order` + if (value.getActualInstance() instanceof Order) { + JsonElement element = adapterOrder.toJsonTree((Order)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Order, Pet"); + } + + @Override + public AllOfModelArrayAnyOfAllOfAttributesC read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize Pet + try { + // validate the JSON object to see if any exception is thrown + Pet.validateJsonElement(jsonElement); + actualAdapter = adapterPet; + match++; + log.log(Level.FINER, "Input data matches schema 'Pet'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Pet failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Pet'", e); + } + + // deserialize Order + try { + // validate the JSON object to see if any exception is thrown + Order.validateJsonElement(jsonElement); + actualAdapter = adapterOrder; + match++; + log.log(Level.FINER, "Input data matches schema 'Order'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Order failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Order'", e); + } + + if (match == 1) { + AllOfModelArrayAnyOfAllOfAttributesC ret = new AllOfModelArrayAnyOfAllOfAttributesC(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for AllOfModelArrayAnyOfAllOfAttributesC: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public AllOfModelArrayAnyOfAllOfAttributesC() { + super("oneOf", Boolean.FALSE); + } + + public AllOfModelArrayAnyOfAllOfAttributesC(Order o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public AllOfModelArrayAnyOfAllOfAttributesC(Pet o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Order", Order.class); + schemas.put("Pet", Pet.class); + } + + @Override + public Map> getSchemas() { + return AllOfModelArrayAnyOfAllOfAttributesC.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Order, Pet + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Order.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Pet.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Order, Pet"); + } + + /** + * Get the actual instance, which can be the following: + * Order, Pet + * + * @return The actual instance (Order, Pet) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Order`. If the actual instance is not `Order`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Order` + * @throws ClassCastException if the instance is not `Order` + */ + public Order getOrder() throws ClassCastException { + return (Order)super.getActualInstance(); + } + + /** + * Get the actual instance of `Pet`. If the actual instance is not `Pet`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Pet` + * @throws ClassCastException if the instance is not `Pet` + */ + public Pet getPet() throws ClassCastException { + return (Pet)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java new file mode 100644 index 000000000000..7af298e4c85a --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java @@ -0,0 +1,304 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1Value; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfModelArrayAnyOfAllOfLinkListColumn1 { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private List value = new ArrayList<>(); + + public AllOfModelArrayAnyOfAllOfLinkListColumn1() { + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1 value(@javax.annotation.Nonnull List value) { + this.value = value; + return this; + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1 addValueItem(AllOfModelArrayAnyOfAllOfLinkListColumn1Value valueItem) { + if (this.value == null) { + this.value = new ArrayList<>(); + } + this.value.add(valueItem); + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + + public List getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull List value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfModelArrayAnyOfAllOfLinkListColumn1 instance itself + */ + public AllOfModelArrayAnyOfAllOfLinkListColumn1 putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfModelArrayAnyOfAllOfLinkListColumn1 {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("value")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllOfModelArrayAnyOfAllOfLinkListColumn1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AllOfModelArrayAnyOfAllOfLinkListColumn1 is not found in the empty JSON string", AllOfModelArrayAnyOfAllOfLinkListColumn1.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllOfModelArrayAnyOfAllOfLinkListColumn1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("value") != null) { + if (!jsonObj.get("value").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `value` to be an array in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + JsonArray jsonArrayvalue = jsonObj.getAsJsonArray("value"); + // validate the required field `value` (array) + for (int i = 0; i < jsonArrayvalue.size(); i++) { + AllOfModelArrayAnyOfAllOfLinkListColumn1Value.validateJsonElement(jsonArrayvalue.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllOfModelArrayAnyOfAllOfLinkListColumn1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllOfModelArrayAnyOfAllOfLinkListColumn1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllOfModelArrayAnyOfAllOfLinkListColumn1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllOfModelArrayAnyOfAllOfLinkListColumn1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AllOfModelArrayAnyOfAllOfLinkListColumn1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AllOfModelArrayAnyOfAllOfLinkListColumn1 instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllOfModelArrayAnyOfAllOfLinkListColumn1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllOfModelArrayAnyOfAllOfLinkListColumn1 + * @throws IOException if the JSON string is invalid with respect to AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ + public static AllOfModelArrayAnyOfAllOfLinkListColumn1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllOfModelArrayAnyOfAllOfLinkListColumn1.class); + } + + /** + * Convert an instance of AllOfModelArrayAnyOfAllOfLinkListColumn1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java new file mode 100644 index 000000000000..7d275b241bc1 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java @@ -0,0 +1,263 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Tag; +import org.openapitools.client.model.User; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfModelArrayAnyOfAllOfLinkListColumn1Value extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AllOfModelArrayAnyOfAllOfLinkListColumn1Value.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllOfModelArrayAnyOfAllOfLinkListColumn1Value + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + List errorMessages = new ArrayList<>(); + int matches = 0; + + try { + // validate the JSON object to see if any exception is thrown + User.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for User failed with `%s`.", e.getMessage())); + } + + try { + // validate the JSON object to see if any exception is thrown + Tag.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Tag failed with `%s`.", e.getMessage())); + } + + + if (matches == 0) { + throw new IOException(String.format("Failed deserialization for AllOfModelArrayAnyOfAllOfLinkListColumn1Value: no match found. %s", errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllOfModelArrayAnyOfAllOfLinkListColumn1Value.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllOfModelArrayAnyOfAllOfLinkListColumn1Value' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterUser = gson.getDelegateAdapter(this, TypeToken.get(User.class)); + final TypeAdapter adapterTag = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllOfModelArrayAnyOfAllOfLinkListColumn1Value value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `User` + if (value.getActualInstance() instanceof User) { + JsonElement element = adapterUser.toJsonTree((User)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `Tag` + if (value.getActualInstance() instanceof Tag) { + JsonElement element = adapterTag.toJsonTree((Tag)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: Tag, User"); + } + + @Override + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize User + try { + // validate the JSON object to see if any exception is thrown + User.validateJsonElement(jsonElement); + AllOfModelArrayAnyOfAllOfLinkListColumn1Value ret = new AllOfModelArrayAnyOfAllOfLinkListColumn1Value(); + ret.setActualInstance(adapterUser.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for User failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'User'", e); + } + + // deserialize Tag + try { + // validate the JSON object to see if any exception is thrown + Tag.validateJsonElement(jsonElement); + AllOfModelArrayAnyOfAllOfLinkListColumn1Value ret = new AllOfModelArrayAnyOfAllOfLinkListColumn1Value(); + ret.setActualInstance(adapterTag.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Tag failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Tag'", e); + } + + + throw new IOException(String.format("Failed deserialization for AllOfModelArrayAnyOfAllOfLinkListColumn1Value: no match found. %s", errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value() { + super("anyOf", Boolean.FALSE); + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(Tag o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(User o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Tag", Tag.class); + schemas.put("User", User.class); + } + + @Override + public Map> getSchemas() { + return AllOfModelArrayAnyOfAllOfLinkListColumn1Value.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Tag, User + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Tag.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(User.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Tag, User"); + } + + /** + * Get the actual instance, which can be the following: + * Tag, User + * + * @return The actual instance (Tag, User) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Tag`. If the actual instance is not `Tag`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Tag` + * @throws ClassCastException if the instance is not `Tag` + */ + public Tag getTag() throws ClassCastException { + return (Tag)super.getActualInstance(); + } + + /** + * Get the actual instance of `User`. If the actual instance is not `User`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `User` + * @throws ClassCastException if the instance is not `User` + */ + public User getUser() throws ClassCastException { + return (User)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java new file mode 100644 index 000000000000..7ea931ebc3c1 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -0,0 +1,275 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to double + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfRefToDouble { + public static final String SERIALIZED_NAME_HEIGHT = "height"; + @SerializedName(SERIALIZED_NAME_HEIGHT) + @javax.annotation.Nullable + private Double height = 32.1d; + + public AllOfRefToDouble() { + } + + public AllOfRefToDouble height(@javax.annotation.Nullable Double height) { + this.height = height; + return this; + } + + /** + * Height as double + * @return height + */ + @javax.annotation.Nullable + + public Double getHeight() { + return height; + } + + public void setHeight(@javax.annotation.Nullable Double height) { + this.height = height; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToDouble instance itself + */ + public AllOfRefToDouble putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToDouble {\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("height")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllOfRefToDouble + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllOfRefToDouble.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AllOfRefToDouble is not found in the empty JSON string", AllOfRefToDouble.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllOfRefToDouble.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllOfRefToDouble' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllOfRefToDouble.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllOfRefToDouble value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AllOfRefToDouble read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AllOfRefToDouble instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllOfRefToDouble given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllOfRefToDouble + * @throws IOException if the JSON string is invalid with respect to AllOfRefToDouble + */ + public static AllOfRefToDouble fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllOfRefToDouble.class); + } + + /** + * Convert an instance of AllOfRefToDouble to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java new file mode 100644 index 000000000000..142d5b5fb97c --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -0,0 +1,275 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to float + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfRefToFloat { + public static final String SERIALIZED_NAME_WEIGHT = "weight"; + @SerializedName(SERIALIZED_NAME_WEIGHT) + @javax.annotation.Nullable + private Float weight = 7.89f; + + public AllOfRefToFloat() { + } + + public AllOfRefToFloat weight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + return this; + } + + /** + * Weight as float + * @return weight + */ + @javax.annotation.Nullable + + public Float getWeight() { + return weight; + } + + public void setWeight(@javax.annotation.Nullable Float weight) { + this.weight = weight; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToFloat instance itself + */ + public AllOfRefToFloat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToFloat {\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("weight")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllOfRefToFloat + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllOfRefToFloat.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AllOfRefToFloat is not found in the empty JSON string", AllOfRefToFloat.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllOfRefToFloat.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllOfRefToFloat' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllOfRefToFloat.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllOfRefToFloat value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AllOfRefToFloat read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AllOfRefToFloat instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllOfRefToFloat given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllOfRefToFloat + * @throws IOException if the JSON string is invalid with respect to AllOfRefToFloat + */ + public static AllOfRefToFloat fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllOfRefToFloat.class); + } + + /** + * Convert an instance of AllOfRefToFloat to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToLong.java new file mode 100644 index 000000000000..0839c14fec78 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -0,0 +1,275 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with allOf ref to long + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AllOfRefToLong { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id = 10l; + + public AllOfRefToLong() { + } + + public AllOfRefToLong id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Id as long + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AllOfRefToLong instance itself + */ + public AllOfRefToLong putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfRefToLong {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllOfRefToLong + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllOfRefToLong.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AllOfRefToLong is not found in the empty JSON string", AllOfRefToLong.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllOfRefToLong.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllOfRefToLong' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllOfRefToLong.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllOfRefToLong value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AllOfRefToLong read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AllOfRefToLong instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllOfRefToLong given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllOfRefToLong + * @throws IOException if the JSON string is invalid with respect to AllOfRefToLong + */ + public static AllOfRefToLong fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllOfRefToLong.class); + } + + /** + * Convert an instance of AllOfRefToLong to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 000000000000..ea75748cb338 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Animal.java @@ -0,0 +1,242 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Animal + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Animal { + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @SerializedName(SERIALIZED_NAME_CLASS_NAME) + @javax.annotation.Nonnull + protected String className; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + @javax.annotation.Nullable + private String color = "red"; + + public Animal() { + this.className = this.getClass().getSimpleName(); + } + + public Animal className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + + public String getClassName() { + return className; + } + + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + + public Animal color(@javax.annotation.Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @javax.annotation.Nullable + + public String getColor() { + return color; + } + + public void setColor(@javax.annotation.Nullable String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Animal instance itself + */ + public Animal putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Animal + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Animal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Animal is not found in the empty JSON string", Animal.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("className").getAsString(); + switch (discriminatorValue) { + case "Cat": + Cat.validateJsonElement(jsonElement); + break; + case "Dog": + Dog.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The value of the `className` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Animal given an JSON string + * + * @param jsonString JSON string + * @return An instance of Animal + * @throws IOException if the JSON string is invalid with respect to Animal + */ + public static Animal fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Animal.class); + } + + /** + * Convert an instance of Animal to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Apple.java new file mode 100644 index 000000000000..95c35d8413c8 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Apple.java @@ -0,0 +1,307 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Apple + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Apple { + public static final String SERIALIZED_NAME_CULTIVAR = "cultivar"; + @SerializedName(SERIALIZED_NAME_CULTIVAR) + @javax.annotation.Nullable + private String cultivar; + + public static final String SERIALIZED_NAME_ORIGIN = "origin"; + @SerializedName(SERIALIZED_NAME_ORIGIN) + @javax.annotation.Nullable + private String origin; + + public Apple() { + } + + public Apple cultivar(@javax.annotation.Nullable String cultivar) { + this.cultivar = cultivar; + return this; + } + + /** + * Get cultivar + * @return cultivar + */ + @javax.annotation.Nullable + + public String getCultivar() { + return cultivar; + } + + public void setCultivar(@javax.annotation.Nullable String cultivar) { + this.cultivar = cultivar; + } + + + public Apple origin(@javax.annotation.Nullable String origin) { + this.origin = origin; + return this; + } + + /** + * Get origin + * @return origin + */ + @javax.annotation.Nullable + + public String getOrigin() { + return origin; + } + + public void setOrigin(@javax.annotation.Nullable String origin) { + this.origin = origin; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Apple instance itself + */ + public Apple putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("cultivar", "origin")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Apple + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Apple.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Apple is not found in the empty JSON string", Apple.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("cultivar") != null && !jsonObj.get("cultivar").isJsonNull()) && !jsonObj.get("cultivar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `cultivar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cultivar").toString())); + } + if ((jsonObj.get("origin") != null && !jsonObj.get("origin").isJsonNull()) && !jsonObj.get("origin").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `origin` to be a primitive type in the JSON string but got `%s`", jsonObj.get("origin").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Apple.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Apple' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Apple.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Apple value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Apple read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Apple instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Apple given an JSON string + * + * @param jsonString JSON string + * @return An instance of Apple + * @throws IOException if the JSON string is invalid with respect to Apple + */ + public static Apple fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Apple.class); + } + + /** + * Convert an instance of Apple to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AppleReq.java new file mode 100644 index 000000000000..0b1f7a338d39 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AppleReq.java @@ -0,0 +1,311 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * AppleReq + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class AppleReq { + public static final String SERIALIZED_NAME_CULTIVAR = "cultivar"; + @SerializedName(SERIALIZED_NAME_CULTIVAR) + @javax.annotation.Nonnull + private String cultivar; + + public static final String SERIALIZED_NAME_MEALY = "mealy"; + @SerializedName(SERIALIZED_NAME_MEALY) + @javax.annotation.Nullable + private Boolean mealy; + + public AppleReq() { + } + + public AppleReq cultivar(@javax.annotation.Nonnull String cultivar) { + this.cultivar = cultivar; + return this; + } + + /** + * Get cultivar + * @return cultivar + */ + @javax.annotation.Nonnull + + public String getCultivar() { + return cultivar; + } + + public void setCultivar(@javax.annotation.Nonnull String cultivar) { + this.cultivar = cultivar; + } + + + public AppleReq mealy(@javax.annotation.Nullable Boolean mealy) { + this.mealy = mealy; + return this; + } + + /** + * Get mealy + * @return mealy + */ + @javax.annotation.Nullable + + public Boolean getMealy() { + return mealy; + } + + public void setMealy(@javax.annotation.Nullable Boolean mealy) { + this.mealy = mealy; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AppleReq instance itself + */ + public AppleReq putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("cultivar", "mealy")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("cultivar")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AppleReq + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AppleReq.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AppleReq is not found in the empty JSON string", AppleReq.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AppleReq.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("cultivar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `cultivar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cultivar").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AppleReq.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AppleReq' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AppleReq.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AppleReq value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AppleReq read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AppleReq instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AppleReq given an JSON string + * + * @param jsonString JSON string + * @return An instance of AppleReq + * @throws IOException if the JSON string is invalid with respect to AppleReq + */ + public static AppleReq fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AppleReq.class); + } + + /** + * Convert an instance of AppleReq to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayAnyOf.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayAnyOf.java new file mode 100644 index 000000000000..0e036d0c0b01 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayAnyOf.java @@ -0,0 +1,264 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayAnyOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ArrayAnyOf.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayAnyOf + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + List errorMessages = new ArrayList<>(); + int matches = 0; + + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + } + + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + } + + + if (matches == 0) { + throw new IOException(String.format("Failed deserialization for ArrayAnyOf: no match found. %s", errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayAnyOf.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayAnyOf' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterInteger = gson.getDelegateAdapter(this, TypeToken.get(Integer.class)); + final Type typeInstanceListString = new TypeToken>(){}.getType(); + final TypeAdapter> adapterListString = (TypeAdapter>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayAnyOf value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Integer` + if (value.getActualInstance() instanceof Integer) { + JsonPrimitive primitive = adapterInteger.toJsonTree((Integer)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + // check if the actual instance is of the type `List` + if (value.getActualInstance() instanceof List) { + JsonPrimitive primitive = adapterListString.toJsonTree((List)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: Integer, List"); + } + + @Override + public ArrayAnyOf read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + ArrayAnyOf ret = new ArrayAnyOf(); + ret.setActualInstance(adapterInteger.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + // deserialize List + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + ArrayAnyOf ret = new ArrayAnyOf(); + ret.setActualInstance(adapterListString.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + + throw new IOException(String.format("Failed deserialization for ArrayAnyOf: no match found. %s", errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public ArrayAnyOf() { + super("anyOf", Boolean.FALSE); + } + + public ArrayAnyOf(Integer o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ArrayAnyOf(List o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("List", List.class); + } + + @Override + public Map> getSchemas() { + return ArrayAnyOf.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Integer, List + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, List"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, List + * + * @return The actual instance (Integer, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayDefault.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayDefault.java new file mode 100644 index 000000000000..c636a81e6cdb --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayDefault.java @@ -0,0 +1,328 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayDefault + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayDefault { + public static final String SERIALIZED_NAME_WITH_DEFAULT_EMPTY_BRACKET = "WithDefaultEmptyBracket"; + @SerializedName(SERIALIZED_NAME_WITH_DEFAULT_EMPTY_BRACKET) + @javax.annotation.Nullable + private List withDefaultEmptyBracket = new ArrayList<>(); + + public static final String SERIALIZED_NAME_WITHOUT_DEFAULT = "WithoutDefault"; + @SerializedName(SERIALIZED_NAME_WITHOUT_DEFAULT) + @javax.annotation.Nullable + private List withoutDefault = new ArrayList<>(); + + public ArrayDefault() { + } + + public ArrayDefault withDefaultEmptyBracket(@javax.annotation.Nullable List withDefaultEmptyBracket) { + this.withDefaultEmptyBracket = withDefaultEmptyBracket; + return this; + } + + public ArrayDefault addWithDefaultEmptyBracketItem(String withDefaultEmptyBracketItem) { + if (this.withDefaultEmptyBracket == null) { + this.withDefaultEmptyBracket = new ArrayList<>(); + } + this.withDefaultEmptyBracket.add(withDefaultEmptyBracketItem); + return this; + } + + /** + * Get withDefaultEmptyBracket + * @return withDefaultEmptyBracket + */ + @javax.annotation.Nullable + + public List getWithDefaultEmptyBracket() { + return withDefaultEmptyBracket; + } + + public void setWithDefaultEmptyBracket(@javax.annotation.Nullable List withDefaultEmptyBracket) { + this.withDefaultEmptyBracket = withDefaultEmptyBracket; + } + + + public ArrayDefault withoutDefault(@javax.annotation.Nullable List withoutDefault) { + this.withoutDefault = withoutDefault; + return this; + } + + public ArrayDefault addWithoutDefaultItem(String withoutDefaultItem) { + if (this.withoutDefault == null) { + this.withoutDefault = new ArrayList<>(); + } + this.withoutDefault.add(withoutDefaultItem); + return this; + } + + /** + * Get withoutDefault + * @return withoutDefault + */ + @javax.annotation.Nullable + + public List getWithoutDefault() { + return withoutDefault; + } + + public void setWithoutDefault(@javax.annotation.Nullable List withoutDefault) { + this.withoutDefault = withoutDefault; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayDefault instance itself + */ + public ArrayDefault putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayDefault {\n"); + sb.append(" withDefaultEmptyBracket: ").append(toIndentedString(withDefaultEmptyBracket)).append("\n"); + sb.append(" withoutDefault: ").append(toIndentedString(withoutDefault)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("WithDefaultEmptyBracket", "WithoutDefault")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayDefault + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayDefault.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayDefault is not found in the empty JSON string", ArrayDefault.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("WithDefaultEmptyBracket") != null && !jsonObj.get("WithDefaultEmptyBracket").isJsonNull() && !jsonObj.get("WithDefaultEmptyBracket").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `WithDefaultEmptyBracket` to be an array in the JSON string but got `%s`", jsonObj.get("WithDefaultEmptyBracket").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("WithoutDefault") != null && !jsonObj.get("WithoutDefault").isJsonNull() && !jsonObj.get("WithoutDefault").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `WithoutDefault` to be an array in the JSON string but got `%s`", jsonObj.get("WithoutDefault").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayDefault.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayDefault' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayDefault.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayDefault value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ArrayDefault read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayDefault instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayDefault given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayDefault + * @throws IOException if the JSON string is invalid with respect to ArrayDefault + */ + public static ArrayDefault fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayDefault.class); + } + + /** + * Convert an instance of ArrayDefault to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..16a26c30c502 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,291 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfArrayOfNumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOfArrayOfNumberOnly { + public static final String SERIALIZED_NAME_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_NUMBER) + @javax.annotation.Nullable + private List> arrayArrayNumber = new ArrayList<>(); + + public ArrayOfArrayOfNumberOnly() { + } + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(@javax.annotation.Nullable 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 + + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + public void setArrayArrayNumber(@javax.annotation.Nullable List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfArrayOfNumberOnly instance itself + */ + public ArrayOfArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ArrayArrayNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayOfArrayOfNumberOnly + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayOfArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayOfArrayOfNumberOnly is not found in the empty JSON string", ArrayOfArrayOfNumberOnly.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("ArrayArrayNumber") != null && !jsonObj.get("ArrayArrayNumber").isJsonNull() && !jsonObj.get("ArrayArrayNumber").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `ArrayArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayArrayNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayOfArrayOfNumberOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayOfArrayOfNumberOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayOfArrayOfNumberOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayOfArrayOfNumberOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ArrayOfArrayOfNumberOnly read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayOfArrayOfNumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayOfArrayOfNumberOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayOfArrayOfNumberOnly + * @throws IOException if the JSON string is invalid with respect to ArrayOfArrayOfNumberOnly + */ + public static ArrayOfArrayOfNumberOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayOfArrayOfNumberOnly.class); + } + + /** + * Convert an instance of ArrayOfArrayOfNumberOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java new file mode 100644 index 000000000000..eb4f1bbb8620 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java @@ -0,0 +1,363 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ArrayOfInlineAllOfArrayAllofDogPropertyInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfInlineAllOf + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOfInlineAllOf { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_ARRAY_ALLOF_DOG_PROPERTY = "array_allof_dog_property"; + @SerializedName(SERIALIZED_NAME_ARRAY_ALLOF_DOG_PROPERTY) + @javax.annotation.Nullable + private List arrayAllofDogProperty = new ArrayList<>(); + + public ArrayOfInlineAllOf() { + } + + public ArrayOfInlineAllOf id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public ArrayOfInlineAllOf name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public ArrayOfInlineAllOf arrayAllofDogProperty(@javax.annotation.Nullable List arrayAllofDogProperty) { + this.arrayAllofDogProperty = arrayAllofDogProperty; + return this; + } + + public ArrayOfInlineAllOf addArrayAllofDogPropertyItem(ArrayOfInlineAllOfArrayAllofDogPropertyInner arrayAllofDogPropertyItem) { + if (this.arrayAllofDogProperty == null) { + this.arrayAllofDogProperty = new ArrayList<>(); + } + this.arrayAllofDogProperty.add(arrayAllofDogPropertyItem); + return this; + } + + /** + * Get arrayAllofDogProperty + * @return arrayAllofDogProperty + */ + @javax.annotation.Nullable + + public List getArrayAllofDogProperty() { + return arrayAllofDogProperty; + } + + public void setArrayAllofDogProperty(@javax.annotation.Nullable List arrayAllofDogProperty) { + this.arrayAllofDogProperty = arrayAllofDogProperty; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfInlineAllOf instance itself + */ + public ArrayOfInlineAllOf putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfInlineAllOf {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" arrayAllofDogProperty: ").append(toIndentedString(arrayAllofDogProperty)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name", "array_allof_dog_property")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayOfInlineAllOf + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayOfInlineAllOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayOfInlineAllOf is not found in the empty JSON string", ArrayOfInlineAllOf.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ArrayOfInlineAllOf.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (jsonObj.get("array_allof_dog_property") != null && !jsonObj.get("array_allof_dog_property").isJsonNull()) { + JsonArray jsonArrayarrayAllofDogProperty = jsonObj.getAsJsonArray("array_allof_dog_property"); + if (jsonArrayarrayAllofDogProperty != null) { + // ensure the json data is an array + if (!jsonObj.get("array_allof_dog_property").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_allof_dog_property` to be an array in the JSON string but got `%s`", jsonObj.get("array_allof_dog_property").toString())); + } + + // validate the optional field `array_allof_dog_property` (array) + for (int i = 0; i < jsonArrayarrayAllofDogProperty.size(); i++) { + ArrayOfInlineAllOfArrayAllofDogPropertyInner.validateJsonElement(jsonArrayarrayAllofDogProperty.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayOfInlineAllOf.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayOfInlineAllOf' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayOfInlineAllOf.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayOfInlineAllOf value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ArrayOfInlineAllOf read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayOfInlineAllOf instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayOfInlineAllOf given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayOfInlineAllOf + * @throws IOException if the JSON string is invalid with respect to ArrayOfInlineAllOf + */ + public static ArrayOfInlineAllOf fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayOfInlineAllOf.class); + } + + /** + * Convert an instance of ArrayOfInlineAllOf to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java new file mode 100644 index 000000000000..97c4683361d5 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java @@ -0,0 +1,307 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOfInlineAllOfArrayAllofDogPropertyInner { + public static final String SERIALIZED_NAME_BREED = "breed"; + @SerializedName(SERIALIZED_NAME_BREED) + @javax.annotation.Nullable + private String breed; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + @javax.annotation.Nullable + private String color; + + public ArrayOfInlineAllOfArrayAllofDogPropertyInner() { + } + + public ArrayOfInlineAllOfArrayAllofDogPropertyInner breed(@javax.annotation.Nullable String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + */ + @javax.annotation.Nullable + + public String getBreed() { + return breed; + } + + public void setBreed(@javax.annotation.Nullable String breed) { + this.breed = breed; + } + + + public ArrayOfInlineAllOfArrayAllofDogPropertyInner color(@javax.annotation.Nullable String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @javax.annotation.Nullable + + public String getColor() { + return color; + } + + public void setColor(@javax.annotation.Nullable String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfInlineAllOfArrayAllofDogPropertyInner instance itself + */ + public ArrayOfInlineAllOfArrayAllofDogPropertyInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfInlineAllOfArrayAllofDogPropertyInner {\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("breed", "color")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayOfInlineAllOfArrayAllofDogPropertyInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayOfInlineAllOfArrayAllofDogPropertyInner is not found in the empty JSON string", ArrayOfInlineAllOfArrayAllofDogPropertyInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("breed") != null && !jsonObj.get("breed").isJsonNull()) && !jsonObj.get("breed").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `breed` to be a primitive type in the JSON string but got `%s`", jsonObj.get("breed").toString())); + } + if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayOfInlineAllOfArrayAllofDogPropertyInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayOfInlineAllOfArrayAllofDogPropertyInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayOfInlineAllOfArrayAllofDogPropertyInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayOfInlineAllOfArrayAllofDogPropertyInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ArrayOfInlineAllOfArrayAllofDogPropertyInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayOfInlineAllOfArrayAllofDogPropertyInner instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayOfInlineAllOfArrayAllofDogPropertyInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayOfInlineAllOfArrayAllofDogPropertyInner + * @throws IOException if the JSON string is invalid with respect to ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ + public static ArrayOfInlineAllOfArrayAllofDogPropertyInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayOfInlineAllOfArrayAllofDogPropertyInner.class); + } + + /** + * Convert an instance of ArrayOfInlineAllOfArrayAllofDogPropertyInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..ee2a27a3f4e5 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -0,0 +1,291 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayOfNumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOfNumberOnly { + public static final String SERIALIZED_NAME_ARRAY_NUMBER = "ArrayNumber"; + @SerializedName(SERIALIZED_NAME_ARRAY_NUMBER) + @javax.annotation.Nullable + private List arrayNumber = new ArrayList<>(); + + public ArrayOfNumberOnly() { + } + + public ArrayOfNumberOnly arrayNumber(@javax.annotation.Nullable 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 + + public List getArrayNumber() { + return arrayNumber; + } + + public void setArrayNumber(@javax.annotation.Nullable List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayOfNumberOnly instance itself + */ + public ArrayOfNumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ArrayNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayOfNumberOnly + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayOfNumberOnly is not found in the empty JSON string", ArrayOfNumberOnly.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("ArrayNumber") != null && !jsonObj.get("ArrayNumber").isJsonNull() && !jsonObj.get("ArrayNumber").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `ArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayOfNumberOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayOfNumberOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayOfNumberOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayOfNumberOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ArrayOfNumberOnly read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayOfNumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayOfNumberOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayOfNumberOnly + * @throws IOException if the JSON string is invalid with respect to ArrayOfNumberOnly + */ + public static ArrayOfNumberOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayOfNumberOnly.class); + } + + /** + * Convert an instance of ArrayOfNumberOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOneOf.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOneOf.java new file mode 100644 index 000000000000..e59166ba77e4 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOneOf.java @@ -0,0 +1,273 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayOneOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ArrayOneOf.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayOneOf + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + } + + // deserialize List + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for ArrayOneOf: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayOneOf.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayOneOf' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterInteger = gson.getDelegateAdapter(this, TypeToken.get(Integer.class)); + final Type typeInstanceListString = new TypeToken>(){}.getType(); + final TypeAdapter> adapterListString = (TypeAdapter>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayOneOf value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Integer` + if (value.getActualInstance() instanceof Integer) { + JsonPrimitive primitive = adapterInteger.toJsonTree((Integer)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + // check if the actual instance is of the type `List` + if (value.getActualInstance() instanceof List) { + JsonPrimitive primitive = adapterListString.toJsonTree((List)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Integer, List"); + } + + @Override + public ArrayOneOf read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterInteger; + match++; + log.log(Level.FINER, "Input data matches schema 'Integer'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + // deserialize List + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterListString; + match++; + log.log(Level.FINER, "Input data matches schema 'List'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + if (match == 1) { + ArrayOneOf ret = new ArrayOneOf(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for ArrayOneOf: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public ArrayOneOf() { + super("oneOf", Boolean.FALSE); + } + + public ArrayOneOf(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public ArrayOneOf(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("List", List.class); + } + + @Override + public Map> getSchemas() { + return ArrayOneOf.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Integer, List + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, List"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, List + * + * @return The actual instance (Integer, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayTest.java new file mode 100644 index 000000000000..e5c2af23fb29 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayTest.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ArrayTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ArrayTest { + public static final String SERIALIZED_NAME_ARRAY_OF_STRING = "array_of_string"; + @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRING) + @javax.annotation.Nullable + private List arrayOfString = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_OF_INTEGER) + @javax.annotation.Nullable + private List> arrayArrayOfInteger = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL) + @javax.annotation.Nullable + private List> arrayArrayOfModel = new ArrayList<>(); + + public ArrayTest() { + } + + public ArrayTest arrayOfString(@javax.annotation.Nullable 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 + + public List getArrayOfString() { + return arrayOfString; + } + + public void setArrayOfString(@javax.annotation.Nullable List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + + public ArrayTest arrayArrayOfInteger(@javax.annotation.Nullable 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 + + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + public void setArrayArrayOfInteger(@javax.annotation.Nullable List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + + public ArrayTest arrayArrayOfModel(@javax.annotation.Nullable 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 + + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + public void setArrayArrayOfModel(@javax.annotation.Nullable List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ArrayTest instance itself + */ + public ArrayTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("array_of_string", "array_array_of_integer", "array_array_of_model")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayTest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ArrayTest is not found in the empty JSON string", ArrayTest.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("array_of_string") != null && !jsonObj.get("array_of_string").isJsonNull() && !jsonObj.get("array_of_string").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_of_string` to be an array in the JSON string but got `%s`", jsonObj.get("array_of_string").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_array_of_integer") != null && !jsonObj.get("array_array_of_integer").isJsonNull() && !jsonObj.get("array_array_of_integer").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_array_of_integer` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_integer").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_array_of_model") != null && !jsonObj.get("array_array_of_model").isJsonNull() && !jsonObj.get("array_array_of_model").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_array_of_model` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_model").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayTest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayTest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayTest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayTest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ArrayTest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ArrayTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayTest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayTest + * @throws IOException if the JSON string is invalid with respect to ArrayTest + */ + public static ArrayTest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayTest.class); + } + + /** + * Convert an instance of ArrayTest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Banana.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Banana.java new file mode 100644 index 000000000000..a010046995ff --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Banana.java @@ -0,0 +1,276 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Banana + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Banana { + public static final String SERIALIZED_NAME_LENGTH_CM = "lengthCm"; + @SerializedName(SERIALIZED_NAME_LENGTH_CM) + @javax.annotation.Nullable + private BigDecimal lengthCm; + + public Banana() { + } + + public Banana lengthCm(@javax.annotation.Nullable BigDecimal lengthCm) { + this.lengthCm = lengthCm; + return this; + } + + /** + * Get lengthCm + * @return lengthCm + */ + @javax.annotation.Nullable + + public BigDecimal getLengthCm() { + return lengthCm; + } + + public void setLengthCm(@javax.annotation.Nullable BigDecimal lengthCm) { + this.lengthCm = lengthCm; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Banana instance itself + */ + public Banana putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Banana {\n"); + sb.append(" lengthCm: ").append(toIndentedString(lengthCm)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("lengthCm")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Banana + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Banana.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Banana is not found in the empty JSON string", Banana.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Banana.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Banana' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Banana.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Banana value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Banana read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Banana instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Banana given an JSON string + * + * @param jsonString JSON string + * @return An instance of Banana + * @throws IOException if the JSON string is invalid with respect to Banana + */ + public static Banana fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Banana.class); + } + + /** + * Convert an instance of Banana to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BananaReq.java new file mode 100644 index 000000000000..279c7d3dcece --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BananaReq.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BananaReq + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class BananaReq { + public static final String SERIALIZED_NAME_LENGTH_CM = "lengthCm"; + @SerializedName(SERIALIZED_NAME_LENGTH_CM) + @javax.annotation.Nonnull + private BigDecimal lengthCm; + + public static final String SERIALIZED_NAME_SWEET = "sweet"; + @SerializedName(SERIALIZED_NAME_SWEET) + @javax.annotation.Nullable + private Boolean sweet; + + public BananaReq() { + } + + public BananaReq lengthCm(@javax.annotation.Nonnull BigDecimal lengthCm) { + this.lengthCm = lengthCm; + return this; + } + + /** + * Get lengthCm + * @return lengthCm + */ + @javax.annotation.Nonnull + + public BigDecimal getLengthCm() { + return lengthCm; + } + + public void setLengthCm(@javax.annotation.Nonnull BigDecimal lengthCm) { + this.lengthCm = lengthCm; + } + + + public BananaReq sweet(@javax.annotation.Nullable Boolean sweet) { + this.sweet = sweet; + return this; + } + + /** + * Get sweet + * @return sweet + */ + @javax.annotation.Nullable + + public Boolean getSweet() { + return sweet; + } + + public void setSweet(@javax.annotation.Nullable Boolean sweet) { + this.sweet = sweet; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BananaReq instance itself + */ + public BananaReq putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("lengthCm", "sweet")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("lengthCm")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BananaReq + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BananaReq.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in BananaReq is not found in the empty JSON string", BananaReq.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BananaReq.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BananaReq.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BananaReq' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BananaReq.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BananaReq value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BananaReq read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BananaReq instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BananaReq given an JSON string + * + * @param jsonString JSON string + * @return An instance of BananaReq + * @throws IOException if the JSON string is invalid with respect to BananaReq + */ + public static BananaReq fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BananaReq.class); + } + + /** + * Convert an instance of BananaReq to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BasquePig.java new file mode 100644 index 000000000000..2f1619523ed5 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BasquePig.java @@ -0,0 +1,285 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * BasquePig + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class BasquePig { + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @SerializedName(SERIALIZED_NAME_CLASS_NAME) + @javax.annotation.Nonnull + private String className; + + public BasquePig() { + } + + public BasquePig className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + + public String getClassName() { + return className; + } + + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BasquePig instance itself + */ + public BasquePig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BasquePig {\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BasquePig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BasquePig.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in BasquePig is not found in the empty JSON string", BasquePig.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BasquePig.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("className").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `className` to be a primitive type in the JSON string but got `%s`", jsonObj.get("className").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BasquePig.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BasquePig' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BasquePig.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BasquePig value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BasquePig read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BasquePig instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BasquePig given an JSON string + * + * @param jsonString JSON string + * @return An instance of BasquePig + * @throws IOException if the JSON string is invalid with respect to BasquePig + */ + public static BasquePig fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BasquePig.class); + } + + /** + * Convert an instance of BasquePig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Capitalization.java new file mode 100644 index 000000000000..65be8dfbd6f1 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Capitalization.java @@ -0,0 +1,423 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Capitalization + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Capitalization { + public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; + @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) + @javax.annotation.Nullable + private String smallCamel; + + public static final String SERIALIZED_NAME_CAPITAL_CAMEL = "CapitalCamel"; + @SerializedName(SERIALIZED_NAME_CAPITAL_CAMEL) + @javax.annotation.Nullable + private String capitalCamel; + + public static final String SERIALIZED_NAME_SMALL_SNAKE = "small_Snake"; + @SerializedName(SERIALIZED_NAME_SMALL_SNAKE) + @javax.annotation.Nullable + private String smallSnake; + + public static final String SERIALIZED_NAME_CAPITAL_SNAKE = "Capital_Snake"; + @SerializedName(SERIALIZED_NAME_CAPITAL_SNAKE) + @javax.annotation.Nullable + private String capitalSnake; + + public static final String SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + @SerializedName(SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS) + @javax.annotation.Nullable + private String scAETHFlowPoints; + + public static final String SERIALIZED_NAME_A_T_T_N_A_M_E = "ATT_NAME"; + @SerializedName(SERIALIZED_NAME_A_T_T_N_A_M_E) + @javax.annotation.Nullable + private String ATT_NAME; + + public Capitalization() { + } + + public Capitalization smallCamel(@javax.annotation.Nullable String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + */ + @javax.annotation.Nullable + + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(@javax.annotation.Nullable String smallCamel) { + this.smallCamel = smallCamel; + } + + + public Capitalization capitalCamel(@javax.annotation.Nullable String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + */ + @javax.annotation.Nullable + + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(@javax.annotation.Nullable String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + + public Capitalization smallSnake(@javax.annotation.Nullable String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + */ + @javax.annotation.Nullable + + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(@javax.annotation.Nullable String smallSnake) { + this.smallSnake = smallSnake; + } + + + public Capitalization capitalSnake(@javax.annotation.Nullable String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + */ + @javax.annotation.Nullable + + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(@javax.annotation.Nullable String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + + public Capitalization scAETHFlowPoints(@javax.annotation.Nullable String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + */ + @javax.annotation.Nullable + + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(@javax.annotation.Nullable String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + + public Capitalization ATT_NAME(@javax.annotation.Nullable String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + */ + @javax.annotation.Nullable + + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(@javax.annotation.Nullable String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Capitalization instance itself + */ + public Capitalization putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Capitalization + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Capitalization.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Capitalization is not found in the empty JSON string", Capitalization.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("smallCamel") != null && !jsonObj.get("smallCamel").isJsonNull()) && !jsonObj.get("smallCamel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `smallCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("smallCamel").toString())); + } + if ((jsonObj.get("CapitalCamel") != null && !jsonObj.get("CapitalCamel").isJsonNull()) && !jsonObj.get("CapitalCamel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `CapitalCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("CapitalCamel").toString())); + } + if ((jsonObj.get("small_Snake") != null && !jsonObj.get("small_Snake").isJsonNull()) && !jsonObj.get("small_Snake").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `small_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("small_Snake").toString())); + } + if ((jsonObj.get("Capital_Snake") != null && !jsonObj.get("Capital_Snake").isJsonNull()) && !jsonObj.get("Capital_Snake").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `Capital_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Capital_Snake").toString())); + } + if ((jsonObj.get("SCA_ETH_Flow_Points") != null && !jsonObj.get("SCA_ETH_Flow_Points").isJsonNull()) && !jsonObj.get("SCA_ETH_Flow_Points").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `SCA_ETH_Flow_Points` to be a primitive type in the JSON string but got `%s`", jsonObj.get("SCA_ETH_Flow_Points").toString())); + } + if ((jsonObj.get("ATT_NAME") != null && !jsonObj.get("ATT_NAME").isJsonNull()) && !jsonObj.get("ATT_NAME").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `ATT_NAME` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ATT_NAME").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Capitalization.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Capitalization' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Capitalization.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Capitalization value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Capitalization read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Capitalization instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Capitalization given an JSON string + * + * @param jsonString JSON string + * @return An instance of Capitalization + * @throws IOException if the JSON string is invalid with respect to Capitalization + */ + public static Capitalization fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Capitalization.class); + } + + /** + * Convert an instance of Capitalization to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 000000000000..db41997dfb06 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,285 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Map; +import org.openapitools.client.model.Animal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Cat + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Cat extends Animal { + public static final String SERIALIZED_NAME_DECLAWED = "declawed"; + @SerializedName(SERIALIZED_NAME_DECLAWED) + @javax.annotation.Nullable + private Boolean declawed; + + public Cat() { + this.className = this.getClass().getSimpleName(); + } + + public Cat declawed(@javax.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + */ + @javax.annotation.Nullable + + public Boolean getDeclawed() { + return declawed; + } + + public void setDeclawed(@javax.annotation.Nullable Boolean declawed) { + this.declawed = declawed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Cat instance itself + */ + public Cat putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "declawed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Cat + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Cat.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Cat is not found in the empty JSON string", Cat.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Cat.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Cat.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Cat' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Cat.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Cat value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Cat read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Cat instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Cat given an JSON string + * + * @param jsonString JSON string + * @return An instance of Cat + * @throws IOException if the JSON string is invalid with respect to Cat + */ + public static Cat fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Cat.class); + } + + /** + * Convert an instance of Cat to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..b7c91558201d --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,311 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Category + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Category { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name = "default-name"; + + public Category() { + } + + public Category id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Category name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Category instance itself + */ + public Category putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Category + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Category.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Category.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Category' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Category.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Category value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Category read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Category instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Category given an JSON string + * + * @param jsonString JSON string + * @return An instance of Category + * @throws IOException if the JSON string is invalid with respect to Category + */ + public static Category fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Category.class); + } + + /** + * Convert an instance of Category to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ClassModel.java new file mode 100644 index 000000000000..eca1910a42b3 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ClassModel.java @@ -0,0 +1,278 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model with \"_class\" property + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ClassModel { + public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; + @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) + @javax.annotation.Nullable + private String propertyClass; + + public ClassModel() { + } + + public ClassModel propertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @javax.annotation.Nullable + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ClassModel instance itself + */ + public ClassModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("_class")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ClassModel is not found in the empty JSON string", ClassModel.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("_class") != null && !jsonObj.get("_class").isJsonNull()) && !jsonObj.get("_class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `_class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_class").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ClassModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ClassModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassModel + * @throws IOException if the JSON string is invalid with respect to ClassModel + */ + public static ClassModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassModel.class); + } + + /** + * Convert an instance of ClassModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Client.java new file mode 100644 index 000000000000..4b8c454f80fd --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Client.java @@ -0,0 +1,278 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Client { + public static final String SERIALIZED_NAME_CLIENT = "client"; + @SerializedName(SERIALIZED_NAME_CLIENT) + @javax.annotation.Nullable + private String client; + + public Client() { + } + + public Client client(@javax.annotation.Nullable String client) { + this.client = client; + return this; + } + + /** + * Get client + * @return client + */ + @javax.annotation.Nullable + + public String getClient() { + return client; + } + + public void setClient(@javax.annotation.Nullable String client) { + this.client = client; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Client instance itself + */ + public Client putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("client")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Client + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Client.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Client is not found in the empty JSON string", Client.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("client") != null && !jsonObj.get("client").isJsonNull()) && !jsonObj.get("client").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `client` to be a primitive type in the JSON string but got `%s`", jsonObj.get("client").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Client.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Client' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Client.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Client value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Client read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Client instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Client given an JSON string + * + * @param jsonString JSON string + * @return An instance of Client + * @throws IOException if the JSON string is invalid with respect to Client + */ + public static Client fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Client.class); + } + + /** + * Convert an instance of Client to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java new file mode 100644 index 000000000000..402051a3bcaf --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -0,0 +1,314 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ComplexQuadrilateral + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ComplexQuadrilateral { + public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; + @SerializedName(SERIALIZED_NAME_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String SERIALIZED_NAME_QUADRILATERAL_TYPE = "quadrilateralType"; + @SerializedName(SERIALIZED_NAME_QUADRILATERAL_TYPE) + @javax.annotation.Nonnull + private String quadrilateralType; + + public ComplexQuadrilateral() { + } + + public ComplexQuadrilateral shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + + public String getShapeType() { + return shapeType; + } + + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public ComplexQuadrilateral quadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + */ + @javax.annotation.Nonnull + + public String getQuadrilateralType() { + return quadrilateralType; + } + + public void setQuadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ComplexQuadrilateral instance itself + */ + public ComplexQuadrilateral putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ComplexQuadrilateral + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ComplexQuadrilateral.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ComplexQuadrilateral is not found in the empty JSON string", ComplexQuadrilateral.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ComplexQuadrilateral.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("shapeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); + } + if (!jsonObj.get("quadrilateralType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `quadrilateralType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("quadrilateralType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ComplexQuadrilateral.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ComplexQuadrilateral' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ComplexQuadrilateral.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ComplexQuadrilateral value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ComplexQuadrilateral read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ComplexQuadrilateral instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ComplexQuadrilateral given an JSON string + * + * @param jsonString JSON string + * @return An instance of ComplexQuadrilateral + * @throws IOException if the JSON string is invalid with respect to ComplexQuadrilateral + */ + public static ComplexQuadrilateral fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ComplexQuadrilateral.class); + } + + /** + * Convert an instance of ComplexQuadrilateral to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DanishPig.java new file mode 100644 index 000000000000..a58a020e2a85 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DanishPig.java @@ -0,0 +1,285 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DanishPig + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class DanishPig { + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @SerializedName(SERIALIZED_NAME_CLASS_NAME) + @javax.annotation.Nonnull + private String className; + + public DanishPig() { + } + + public DanishPig className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + + public String getClassName() { + return className; + } + + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DanishPig instance itself + */ + public DanishPig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DanishPig {\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DanishPig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DanishPig.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in DanishPig is not found in the empty JSON string", DanishPig.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DanishPig.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("className").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `className` to be a primitive type in the JSON string but got `%s`", jsonObj.get("className").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DanishPig.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DanishPig' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DanishPig.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DanishPig value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public DanishPig read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DanishPig instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DanishPig given an JSON string + * + * @param jsonString JSON string + * @return An instance of DanishPig + * @throws IOException if the JSON string is invalid with respect to DanishPig + */ + public static DanishPig fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DanishPig.class); + } + + /** + * Convert an instance of DanishPig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DeprecatedObject.java new file mode 100644 index 000000000000..972df8fdd7f0 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -0,0 +1,280 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * DeprecatedObject + * @deprecated + */ +@Deprecated +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class DeprecatedObject { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public DeprecatedObject() { + } + + public DeprecatedObject name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DeprecatedObject instance itself + */ + public DeprecatedObject putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeprecatedObject {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeprecatedObject + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeprecatedObject.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in DeprecatedObject is not found in the empty JSON string", DeprecatedObject.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeprecatedObject.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeprecatedObject' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeprecatedObject.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeprecatedObject value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public DeprecatedObject read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DeprecatedObject instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeprecatedObject given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeprecatedObject + * @throws IOException if the JSON string is invalid with respect to DeprecatedObject + */ + public static DeprecatedObject fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeprecatedObject.class); + } + + /** + * Convert an instance of DeprecatedObject to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 000000000000..e9d79ef18972 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,284 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Dog + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Dog extends Animal { + public static final String SERIALIZED_NAME_BREED = "breed"; + @SerializedName(SERIALIZED_NAME_BREED) + @javax.annotation.Nullable + private String breed; + + public Dog() { + this.className = this.getClass().getSimpleName(); + } + + public Dog breed(@javax.annotation.Nullable String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + */ + @javax.annotation.Nullable + + public String getBreed() { + return breed; + } + + public void setBreed(@javax.annotation.Nullable String breed) { + this.breed = breed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Dog instance itself + */ + public Dog putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("className", "color", "breed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Dog + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Dog.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Dog is not found in the empty JSON string", Dog.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Dog.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Dog.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Dog' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Dog.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Dog value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Dog read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Dog instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Dog given an JSON string + * + * @param jsonString JSON string + * @return An instance of Dog + * @throws IOException if the JSON string is invalid with respect to Dog + */ + public static Dog fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Dog.class); + } + + /** + * Convert an instance of Dog to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Drawing.java new file mode 100644 index 000000000000..a49ee9e2ef66 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Drawing.java @@ -0,0 +1,406 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Fruit; +import org.openapitools.client.model.NullableShape; +import org.openapitools.client.model.Shape; +import org.openapitools.client.model.ShapeOrNull; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Drawing + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Drawing { + public static final String SERIALIZED_NAME_MAIN_SHAPE = "mainShape"; + @SerializedName(SERIALIZED_NAME_MAIN_SHAPE) + @javax.annotation.Nullable + private Shape mainShape; + + public static final String SERIALIZED_NAME_SHAPE_OR_NULL = "shapeOrNull"; + @SerializedName(SERIALIZED_NAME_SHAPE_OR_NULL) + @javax.annotation.Nullable + private ShapeOrNull shapeOrNull; + + public static final String SERIALIZED_NAME_NULLABLE_SHAPE = "nullableShape"; + @SerializedName(SERIALIZED_NAME_NULLABLE_SHAPE) + @javax.annotation.Nullable + private NullableShape nullableShape; + + public static final String SERIALIZED_NAME_SHAPES = "shapes"; + @SerializedName(SERIALIZED_NAME_SHAPES) + @javax.annotation.Nullable + private List shapes = new ArrayList<>(); + + public Drawing() { + } + + public Drawing mainShape(@javax.annotation.Nullable Shape mainShape) { + this.mainShape = mainShape; + return this; + } + + /** + * Get mainShape + * @return mainShape + */ + @javax.annotation.Nullable + + public Shape getMainShape() { + return mainShape; + } + + public void setMainShape(@javax.annotation.Nullable Shape mainShape) { + this.mainShape = mainShape; + } + + + public Drawing shapeOrNull(@javax.annotation.Nullable ShapeOrNull shapeOrNull) { + this.shapeOrNull = shapeOrNull; + return this; + } + + /** + * Get shapeOrNull + * @return shapeOrNull + */ + @javax.annotation.Nullable + + public ShapeOrNull getShapeOrNull() { + return shapeOrNull; + } + + public void setShapeOrNull(@javax.annotation.Nullable ShapeOrNull shapeOrNull) { + this.shapeOrNull = shapeOrNull; + } + + + public Drawing nullableShape(@javax.annotation.Nullable NullableShape nullableShape) { + this.nullableShape = nullableShape; + return this; + } + + /** + * Get nullableShape + * @return nullableShape + */ + @javax.annotation.Nullable + + public NullableShape getNullableShape() { + return nullableShape; + } + + public void setNullableShape(@javax.annotation.Nullable NullableShape nullableShape) { + this.nullableShape = nullableShape; + } + + + public Drawing shapes(@javax.annotation.Nullable 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 + + public List getShapes() { + return shapes; + } + + public void setShapes(@javax.annotation.Nullable List shapes) { + this.shapes = shapes; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Drawing instance itself + */ + public Drawing putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Drawing {\n"); + sb.append(" mainShape: ").append(toIndentedString(mainShape)).append("\n"); + sb.append(" shapeOrNull: ").append(toIndentedString(shapeOrNull)).append("\n"); + sb.append(" nullableShape: ").append(toIndentedString(nullableShape)).append("\n"); + sb.append(" shapes: ").append(toIndentedString(shapes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("mainShape", "shapeOrNull", "nullableShape", "shapes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Drawing + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Drawing.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Drawing is not found in the empty JSON string", Drawing.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `mainShape` + if (jsonObj.get("mainShape") != null && !jsonObj.get("mainShape").isJsonNull()) { + Shape.validateJsonElement(jsonObj.get("mainShape")); + } + // validate the optional field `shapeOrNull` + if (jsonObj.get("shapeOrNull") != null && !jsonObj.get("shapeOrNull").isJsonNull()) { + ShapeOrNull.validateJsonElement(jsonObj.get("shapeOrNull")); + } + // validate the optional field `nullableShape` + if (jsonObj.get("nullableShape") != null && !jsonObj.get("nullableShape").isJsonNull()) { + NullableShape.validateJsonElement(jsonObj.get("nullableShape")); + } + if (jsonObj.get("shapes") != null && !jsonObj.get("shapes").isJsonNull()) { + JsonArray jsonArrayshapes = jsonObj.getAsJsonArray("shapes"); + if (jsonArrayshapes != null) { + // ensure the json data is an array + if (!jsonObj.get("shapes").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `shapes` to be an array in the JSON string but got `%s`", jsonObj.get("shapes").toString())); + } + + // validate the optional field `shapes` (array) + for (int i = 0; i < jsonArrayshapes.size(); i++) { + Shape.validateJsonElement(jsonArrayshapes.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Drawing.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Drawing' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Drawing.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Drawing value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Drawing read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Drawing instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Drawing given an JSON string + * + * @param jsonString JSON string + * @return An instance of Drawing + * @throws IOException if the JSON string is invalid with respect to Drawing + */ + public static Drawing fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Drawing.class); + } + + /** + * Convert an instance of Drawing to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumArrays.java new file mode 100644 index 000000000000..077261bd7378 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -0,0 +1,427 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EnumArrays + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + @JsonAdapter(JustSymbolEnum.Adapter.class) + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final JustSymbolEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public JustSymbolEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return JustSymbolEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + JustSymbolEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_JUST_SYMBOL = "just_symbol"; + @SerializedName(SERIALIZED_NAME_JUST_SYMBOL) + @javax.annotation.Nullable + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + @JsonAdapter(ArrayEnumEnum.Adapter.class) + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ArrayEnumEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ArrayEnumEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ArrayEnumEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ArrayEnumEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ARRAY_ENUM = "array_enum"; + @SerializedName(SERIALIZED_NAME_ARRAY_ENUM) + @javax.annotation.Nullable + private List arrayEnum = new ArrayList<>(); + + public EnumArrays() { + } + + public EnumArrays justSymbol(@javax.annotation.Nullable JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + */ + @javax.annotation.Nullable + + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + public void setJustSymbol(@javax.annotation.Nullable JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + + public EnumArrays arrayEnum(@javax.annotation.Nullable 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 + + public List getArrayEnum() { + return arrayEnum; + } + + public void setArrayEnum(@javax.annotation.Nullable List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumArrays instance itself + */ + public EnumArrays putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("just_symbol", "array_enum")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EnumArrays + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EnumArrays.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in EnumArrays is not found in the empty JSON string", EnumArrays.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonNull()) && !jsonObj.get("just_symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `just_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("just_symbol").toString())); + } + // validate the optional field `just_symbol` + if (jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonNull()) { + JustSymbolEnum.validateJsonElement(jsonObj.get("just_symbol")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_enum") != null && !jsonObj.get("array_enum").isJsonNull() && !jsonObj.get("array_enum").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_enum` to be an array in the JSON string but got `%s`", jsonObj.get("array_enum").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EnumArrays.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EnumArrays' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EnumArrays.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EnumArrays value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EnumArrays read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EnumArrays instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EnumArrays given an JSON string + * + * @param jsonString JSON string + * @return An instance of EnumArrays + * @throws IOException if the JSON string is invalid with respect to EnumArrays + */ + public static EnumArrays fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EnumArrays.class); + } + + /** + * Convert an instance of EnumArrays to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumClass.java new file mode 100644 index 000000000000..10745619ecf9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumClass.java @@ -0,0 +1,82 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets EnumClass + */ +@JsonAdapter(EnumClass.Adapter.class) +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EnumClass fromValue(String value) { + for (EnumClass b : EnumClass.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumClass enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumClass read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumClass.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EnumClass.fromValue(value); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java new file mode 100644 index 000000000000..f84d7fbc3198 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java @@ -0,0 +1,334 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * An object to test discriminator of enum string + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class EnumStringDiscriminator { + /** + * enum string type + */ + @JsonAdapter(EnumStrTypeEnum.Adapter.class) + public enum EnumStrTypeEnum { + A("type_a"), + + B("type_b"); + + private String value; + + EnumStrTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EnumStrTypeEnum fromValue(String value) { + for (EnumStrTypeEnum b : EnumStrTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumStrTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumStrTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumStrTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EnumStrTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_STR_TYPE = "enum_str_type"; + @SerializedName(SERIALIZED_NAME_ENUM_STR_TYPE) + @javax.annotation.Nonnull + protected EnumStrTypeEnum enumStrType; + + public EnumStringDiscriminator() { + + } + + public EnumStringDiscriminator enumStrType(@javax.annotation.Nonnull EnumStrTypeEnum enumStrType) { + this.enumStrType = enumStrType; + return this; + } + + /** + * enum string type + * @return enumStrType + */ + @javax.annotation.Nonnull + + public EnumStrTypeEnum getEnumStrType() { + return enumStrType; + } + + public void setEnumStrType(@javax.annotation.Nonnull EnumStrTypeEnum enumStrType) { + this.enumStrType = enumStrType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumStringDiscriminator instance itself + */ + public EnumStringDiscriminator putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumStringDiscriminator {\n"); + sb.append(" enumStrType: ").append(toIndentedString(enumStrType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("enum_str_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("enum_str_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EnumStringDiscriminator + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EnumStringDiscriminator.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in EnumStringDiscriminator is not found in the empty JSON string", EnumStringDiscriminator.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EnumStringDiscriminator.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EnumStringDiscriminator.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EnumStringDiscriminator' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EnumStringDiscriminator.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EnumStringDiscriminator value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EnumStringDiscriminator read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EnumStringDiscriminator instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EnumStringDiscriminator given an JSON string + * + * @param jsonString JSON string + * @return An instance of EnumStringDiscriminator + * @throws IOException if the JSON string is invalid with respect to EnumStringDiscriminator + */ + public static EnumStringDiscriminator fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EnumStringDiscriminator.class); + } + + /** + * Convert an instance of EnumStringDiscriminator to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumTest.java new file mode 100644 index 000000000000..3fb6a980ddd7 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumTest.java @@ -0,0 +1,815 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +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 org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EnumTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class EnumTest { + /** + * Gets or Sets enumString + */ + @JsonAdapter(EnumStringEnum.Adapter.class) + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumStringEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumStringEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumStringEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EnumStringEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_STRING = "enum_string"; + @SerializedName(SERIALIZED_NAME_ENUM_STRING) + @javax.annotation.Nullable + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + @JsonAdapter(EnumStringRequiredEnum.Adapter.class) + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumStringRequiredEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumStringRequiredEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnumStringRequiredEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EnumStringRequiredEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_STRING_REQUIRED = "enum_string_required"; + @SerializedName(SERIALIZED_NAME_ENUM_STRING_REQUIRED) + @javax.annotation.Nonnull + private EnumStringRequiredEnum enumStringRequired; + + /** + * Gets or Sets enumInteger + */ + @JsonAdapter(EnumIntegerEnum.Adapter.class) + public enum EnumIntegerEnum { + NUMBER_1(1), + + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumIntegerEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumIntegerEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return EnumIntegerEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + EnumIntegerEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_INTEGER = "enum_integer"; + @SerializedName(SERIALIZED_NAME_ENUM_INTEGER) + @javax.annotation.Nullable + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumIntegerOnly + */ + @JsonAdapter(EnumIntegerOnlyEnum.Adapter.class) + public enum EnumIntegerOnlyEnum { + NUMBER_2(2), + + NUMBER_MINUS_2(-2); + + private Integer value; + + EnumIntegerOnlyEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EnumIntegerOnlyEnum fromValue(Integer value) { + for (EnumIntegerOnlyEnum b : EnumIntegerOnlyEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumIntegerOnlyEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumIntegerOnlyEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return EnumIntegerOnlyEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + EnumIntegerOnlyEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_INTEGER_ONLY = "enum_integer_only"; + @SerializedName(SERIALIZED_NAME_ENUM_INTEGER_ONLY) + @javax.annotation.Nullable + private EnumIntegerOnlyEnum enumIntegerOnly; + + /** + * Gets or Sets enumNumber + */ + @JsonAdapter(EnumNumberEnum.Adapter.class) + 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; + } + + public Double getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EnumNumberEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EnumNumberEnum read(final JsonReader jsonReader) throws IOException { + Double value = jsonReader.nextDouble(); + return EnumNumberEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Double value = jsonElement.getAsDouble(); + EnumNumberEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENUM_NUMBER = "enum_number"; + @SerializedName(SERIALIZED_NAME_ENUM_NUMBER) + @javax.annotation.Nullable + private EnumNumberEnum enumNumber; + + public static final String SERIALIZED_NAME_OUTER_ENUM = "outerEnum"; + @SerializedName(SERIALIZED_NAME_OUTER_ENUM) + @javax.annotation.Nullable + private OuterEnum outerEnum; + + public static final String SERIALIZED_NAME_OUTER_ENUM_INTEGER = "outerEnumInteger"; + @Deprecated + @SerializedName(SERIALIZED_NAME_OUTER_ENUM_INTEGER) + @javax.annotation.Nullable + private OuterEnumInteger outerEnumInteger; + + public static final String SERIALIZED_NAME_OUTER_ENUM_DEFAULT_VALUE = "outerEnumDefaultValue"; + @SerializedName(SERIALIZED_NAME_OUTER_ENUM_DEFAULT_VALUE) + @javax.annotation.Nullable + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + + public static final String SERIALIZED_NAME_OUTER_ENUM_INTEGER_DEFAULT_VALUE = "outerEnumIntegerDefaultValue"; + @SerializedName(SERIALIZED_NAME_OUTER_ENUM_INTEGER_DEFAULT_VALUE) + @javax.annotation.Nullable + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + + public EnumTest() { + } + + public EnumTest enumString(@javax.annotation.Nullable EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + */ + @javax.annotation.Nullable + + public EnumStringEnum getEnumString() { + return enumString; + } + + public void setEnumString(@javax.annotation.Nullable EnumStringEnum enumString) { + this.enumString = enumString; + } + + + public EnumTest enumStringRequired(@javax.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + */ + @javax.annotation.Nonnull + + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(@javax.annotation.Nonnull EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + + public EnumTest enumInteger(@javax.annotation.Nullable EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + */ + @javax.annotation.Nullable + + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + public void setEnumInteger(@javax.annotation.Nullable EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + public EnumTest enumIntegerOnly(@javax.annotation.Nullable EnumIntegerOnlyEnum enumIntegerOnly) { + this.enumIntegerOnly = enumIntegerOnly; + return this; + } + + /** + * Get enumIntegerOnly + * @return enumIntegerOnly + */ + @javax.annotation.Nullable + + public EnumIntegerOnlyEnum getEnumIntegerOnly() { + return enumIntegerOnly; + } + + public void setEnumIntegerOnly(@javax.annotation.Nullable EnumIntegerOnlyEnum enumIntegerOnly) { + this.enumIntegerOnly = enumIntegerOnly; + } + + + public EnumTest enumNumber(@javax.annotation.Nullable EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + */ + @javax.annotation.Nullable + + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + public void setEnumNumber(@javax.annotation.Nullable EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + public EnumTest outerEnum(@javax.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + */ + @javax.annotation.Nullable + + public OuterEnum getOuterEnum() { + return outerEnum; + } + + public void setOuterEnum(@javax.annotation.Nullable OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + + @Deprecated + public EnumTest outerEnumInteger(@javax.annotation.Nullable OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return this; + } + + /** + * Get outerEnumInteger + * @return outerEnumInteger + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + @Deprecated + public void setOuterEnumInteger(@javax.annotation.Nullable OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + + public EnumTest outerEnumDefaultValue(@javax.annotation.Nullable OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + /** + * Get outerEnumDefaultValue + * @return outerEnumDefaultValue + */ + @javax.annotation.Nullable + + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + public void setOuterEnumDefaultValue(@javax.annotation.Nullable OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + + public EnumTest outerEnumIntegerDefaultValue(@javax.annotation.Nullable OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + /** + * Get outerEnumIntegerDefaultValue + * @return outerEnumIntegerDefaultValue + */ + @javax.annotation.Nullable + + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + public void setOuterEnumIntegerDefaultValue(@javax.annotation.Nullable OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnumTest instance itself + */ + public EnumTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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(" enumIntegerOnly: ").append(toIndentedString(enumIntegerOnly)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); + sb.append(" outerEnumDefaultValue: ").append(toIndentedString(outerEnumDefaultValue)).append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ").append(toIndentedString(outerEnumIntegerDefaultValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("enum_string", "enum_string_required", "enum_integer", "enum_integer_only", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("enum_string_required")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EnumTest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EnumTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in EnumTest is not found in the empty JSON string", EnumTest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EnumTest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonNull()) && !jsonObj.get("enum_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `enum_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string").toString())); + } + // validate the optional field `enum_string` + if (jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonNull()) { + EnumStringEnum.validateJsonElement(jsonObj.get("enum_string")); + } + if (!jsonObj.get("enum_string_required").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `enum_string_required` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string_required").toString())); + } + // validate the required field `enum_string_required` + EnumStringRequiredEnum.validateJsonElement(jsonObj.get("enum_string_required")); + // validate the optional field `enum_integer` + if (jsonObj.get("enum_integer") != null && !jsonObj.get("enum_integer").isJsonNull()) { + EnumIntegerEnum.validateJsonElement(jsonObj.get("enum_integer")); + } + // validate the optional field `enum_integer_only` + if (jsonObj.get("enum_integer_only") != null && !jsonObj.get("enum_integer_only").isJsonNull()) { + EnumIntegerOnlyEnum.validateJsonElement(jsonObj.get("enum_integer_only")); + } + // validate the optional field `enum_number` + if (jsonObj.get("enum_number") != null && !jsonObj.get("enum_number").isJsonNull()) { + EnumNumberEnum.validateJsonElement(jsonObj.get("enum_number")); + } + // validate the optional field `outerEnum` + if (jsonObj.get("outerEnum") != null && !jsonObj.get("outerEnum").isJsonNull()) { + OuterEnum.validateJsonElement(jsonObj.get("outerEnum")); + } + // validate the optional field `outerEnumInteger` + if (jsonObj.get("outerEnumInteger") != null && !jsonObj.get("outerEnumInteger").isJsonNull()) { + OuterEnumInteger.validateJsonElement(jsonObj.get("outerEnumInteger")); + } + // validate the optional field `outerEnumDefaultValue` + if (jsonObj.get("outerEnumDefaultValue") != null && !jsonObj.get("outerEnumDefaultValue").isJsonNull()) { + OuterEnumDefaultValue.validateJsonElement(jsonObj.get("outerEnumDefaultValue")); + } + // validate the optional field `outerEnumIntegerDefaultValue` + if (jsonObj.get("outerEnumIntegerDefaultValue") != null && !jsonObj.get("outerEnumIntegerDefaultValue").isJsonNull()) { + OuterEnumIntegerDefaultValue.validateJsonElement(jsonObj.get("outerEnumIntegerDefaultValue")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EnumTest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EnumTest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EnumTest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EnumTest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EnumTest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EnumTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EnumTest given an JSON string + * + * @param jsonString JSON string + * @return An instance of EnumTest + * @throws IOException if the JSON string is invalid with respect to EnumTest + */ + public static EnumTest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EnumTest.class); + } + + /** + * Convert an instance of EnumTest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EquilateralTriangle.java new file mode 100644 index 000000000000..6e6e4d97fe4c --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -0,0 +1,314 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * EquilateralTriangle + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class EquilateralTriangle { + public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; + @SerializedName(SERIALIZED_NAME_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String SERIALIZED_NAME_TRIANGLE_TYPE = "triangleType"; + @SerializedName(SERIALIZED_NAME_TRIANGLE_TYPE) + @javax.annotation.Nonnull + private String triangleType; + + public EquilateralTriangle() { + } + + public EquilateralTriangle shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + + public String getShapeType() { + return shapeType; + } + + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public EquilateralTriangle triangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @javax.annotation.Nonnull + + public String getTriangleType() { + return triangleType; + } + + public void setTriangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EquilateralTriangle instance itself + */ + public EquilateralTriangle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EquilateralTriangle + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EquilateralTriangle.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in EquilateralTriangle is not found in the empty JSON string", EquilateralTriangle.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EquilateralTriangle.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("shapeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); + } + if (!jsonObj.get("triangleType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `triangleType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("triangleType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EquilateralTriangle.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EquilateralTriangle' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EquilateralTriangle.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EquilateralTriangle value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EquilateralTriangle read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EquilateralTriangle instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EquilateralTriangle given an JSON string + * + * @param jsonString JSON string + * @return An instance of EquilateralTriangle + * @throws IOException if the JSON string is invalid with respect to EquilateralTriangle + */ + public static EquilateralTriangle fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EquilateralTriangle.class); + } + + /** + * Convert an instance of EquilateralTriangle to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java new file mode 100644 index 000000000000..25943fee31c4 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java @@ -0,0 +1,233 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FakeAnyOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FakeAnyOfWIthSameErasureGet200Response.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FakeAnyOfWIthSameErasureGet200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + List errorMessages = new ArrayList<>(); + int matches = 0; + + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + } + + + if (matches == 0) { + throw new IOException(String.format("Failed deserialization for FakeAnyOfWIthSameErasureGet200Response: no match found. %s", errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FakeAnyOfWIthSameErasureGet200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FakeAnyOfWIthSameErasureGet200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final Type typeInstanceListString = new TypeToken>(){}.getType(); + final TypeAdapter> adapterListString = (TypeAdapter>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance)); + final Type typeInstanceListInteger = new TypeToken>(){}.getType(); + final TypeAdapter> adapterListInteger = (TypeAdapter>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FakeAnyOfWIthSameErasureGet200Response value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `List` + if (value.getActualInstance() instanceof List) { + JsonPrimitive primitive = adapterListString.toJsonTree((List)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: List, List"); + } + + @Override + public FakeAnyOfWIthSameErasureGet200Response read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize List + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + FakeAnyOfWIthSameErasureGet200Response ret = new FakeAnyOfWIthSameErasureGet200Response(); + ret.setActualInstance(adapterListString.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + + throw new IOException(String.format("Failed deserialization for FakeAnyOfWIthSameErasureGet200Response: no match found. %s", errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public FakeAnyOfWIthSameErasureGet200Response() { + super("anyOf", Boolean.FALSE); + } + + public FakeAnyOfWIthSameErasureGet200Response(List o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public FakeAnyOfWIthSameErasureGet200Response(List o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List", List.class); + schemas.put("List", List.class); + } + + @Override + public Map> getSchemas() { + return FakeAnyOfWIthSameErasureGet200Response.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * List, List + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List, List"); + } + + /** + * Get the actual instance, which can be the following: + * List, List + * + * @return The actual instance (List, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java new file mode 100644 index 000000000000..9fcd59fd7e55 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java @@ -0,0 +1,240 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FakeOneOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FakeOneOfWIthSameErasureGet200Response.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FakeOneOfWIthSameErasureGet200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize List + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for FakeOneOfWIthSameErasureGet200Response: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FakeOneOfWIthSameErasureGet200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FakeOneOfWIthSameErasureGet200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final Type typeInstanceListString = new TypeToken>(){}.getType(); + final TypeAdapter> adapterListString = (TypeAdapter>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance)); + final Type typeInstanceListInteger = new TypeToken>(){}.getType(); + final TypeAdapter> adapterListInteger = (TypeAdapter>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FakeOneOfWIthSameErasureGet200Response value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `List` + if (value.getActualInstance() instanceof List) { + JsonPrimitive primitive = adapterListString.toJsonTree((List)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: List, List"); + } + + @Override + public FakeOneOfWIthSameErasureGet200Response read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize List + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterListString; + match++; + log.log(Level.FINER, "Input data matches schema 'List'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + if (match == 1) { + FakeOneOfWIthSameErasureGet200Response ret = new FakeOneOfWIthSameErasureGet200Response(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for FakeOneOfWIthSameErasureGet200Response: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public FakeOneOfWIthSameErasureGet200Response() { + super("oneOf", Boolean.FALSE); + } + + public FakeOneOfWIthSameErasureGet200Response(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public FakeOneOfWIthSameErasureGet200Response(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List", List.class); + schemas.put("List", List.class); + } + + @Override + public Map> getSchemas() { + return FakeOneOfWIthSameErasureGet200Response.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * List, List + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List, List"); + } + + /** + * Get the actual instance, which can be the following: + * List, List + * + * @return The actual instance (List, List) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java new file mode 100644 index 000000000000..6f15c6670464 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java @@ -0,0 +1,271 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FakeRefParameterPetIdParameter extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FakeRefParameterPetIdParameter.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FakeRefParameterPetIdParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + } + + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for FakeRefParameterPetIdParameter: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FakeRefParameterPetIdParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FakeRefParameterPetIdParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final TypeAdapter adapterInteger = gson.getDelegateAdapter(this, TypeToken.get(Integer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FakeRefParameterPetIdParameter value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + // check if the actual instance is of the type `Integer` + if (value.getActualInstance() instanceof Integer) { + JsonPrimitive primitive = adapterInteger.toJsonTree((Integer)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Integer, String"); + } + + @Override + public FakeRefParameterPetIdParameter read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterString; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterInteger; + match++; + log.log(Level.FINER, "Input data matches schema 'Integer'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Integer failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Integer'", e); + } + + if (match == 1) { + FakeRefParameterPetIdParameter ret = new FakeRefParameterPetIdParameter(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for FakeRefParameterPetIdParameter: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public FakeRefParameterPetIdParameter() { + super("oneOf", Boolean.FALSE); + } + + public FakeRefParameterPetIdParameter(Integer o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public FakeRefParameterPetIdParameter(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Integer", Integer.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return FakeRefParameterPetIdParameter.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Integer, String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Integer.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, String"); + } + + /** + * Get the actual instance, which can be the following: + * Integer, String + * + * @return The actual instance (Integer, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..ea7f4733ff1c --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,331 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FileSchemaTestClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FileSchemaTestClass { + public static final String SERIALIZED_NAME_FILE = "file"; + @SerializedName(SERIALIZED_NAME_FILE) + @javax.annotation.Nullable + private ModelFile _file; + + public static final String SERIALIZED_NAME_FILES = "files"; + @SerializedName(SERIALIZED_NAME_FILES) + @javax.annotation.Nullable + private List files = new ArrayList<>(); + + public FileSchemaTestClass() { + } + + public FileSchemaTestClass _file(@javax.annotation.Nullable ModelFile _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + @javax.annotation.Nullable + + public ModelFile getFile() { + return _file; + } + + public void setFile(@javax.annotation.Nullable ModelFile _file) { + this._file = _file; + } + + + public FileSchemaTestClass files(@javax.annotation.Nullable List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(ModelFile filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + */ + @javax.annotation.Nullable + + public List getFiles() { + return files; + } + + public void setFiles(@javax.annotation.Nullable List files) { + this.files = files; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FileSchemaTestClass instance itself + */ + public FileSchemaTestClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("file", "files")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FileSchemaTestClass + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FileSchemaTestClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FileSchemaTestClass is not found in the empty JSON string", FileSchemaTestClass.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `file` + if (jsonObj.get("file") != null && !jsonObj.get("file").isJsonNull()) { + ModelFile.validateJsonElement(jsonObj.get("file")); + } + if (jsonObj.get("files") != null && !jsonObj.get("files").isJsonNull()) { + JsonArray jsonArrayfiles = jsonObj.getAsJsonArray("files"); + if (jsonArrayfiles != null) { + // ensure the json data is an array + if (!jsonObj.get("files").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `files` to be an array in the JSON string but got `%s`", jsonObj.get("files").toString())); + } + + // validate the optional field `files` (array) + for (int i = 0; i < jsonArrayfiles.size(); i++) { + ModelFile.validateJsonElement(jsonArrayfiles.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FileSchemaTestClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FileSchemaTestClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FileSchemaTestClass.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FileSchemaTestClass value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FileSchemaTestClass read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FileSchemaTestClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FileSchemaTestClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of FileSchemaTestClass + * @throws IOException if the JSON string is invalid with respect to FileSchemaTestClass + */ + public static FileSchemaTestClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FileSchemaTestClass.class); + } + + /** + * Convert an instance of FileSchemaTestClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Foo.java new file mode 100644 index 000000000000..81a798767518 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Foo.java @@ -0,0 +1,278 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Foo + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Foo { + public static final String SERIALIZED_NAME_BAR = "bar"; + @SerializedName(SERIALIZED_NAME_BAR) + @javax.annotation.Nullable + private String bar = "bar"; + + public Foo() { + } + + public Foo bar(@javax.annotation.Nullable String bar) { + this.bar = bar; + return this; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + + public String getBar() { + return bar; + } + + public void setBar(@javax.annotation.Nullable String bar) { + this.bar = bar; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Foo instance itself + */ + public Foo putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Foo {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Foo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Foo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Foo is not found in the empty JSON string", Foo.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonNull()) && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Foo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Foo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Foo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Foo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Foo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Foo instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Foo given an JSON string + * + * @param jsonString JSON string + * @return An instance of Foo + * @throws IOException if the JSON string is invalid with respect to Foo + */ + public static Foo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Foo.class); + } + + /** + * Convert an instance of Foo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java new file mode 100644 index 000000000000..113254eade4d --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -0,0 +1,280 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Foo; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FooGetDefaultResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FooGetDefaultResponse { + public static final String SERIALIZED_NAME_STRING = "string"; + @SerializedName(SERIALIZED_NAME_STRING) + @javax.annotation.Nullable + private Foo string; + + public FooGetDefaultResponse() { + } + + public FooGetDefaultResponse string(@javax.annotation.Nullable Foo string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + */ + @javax.annotation.Nullable + + public Foo getString() { + return string; + } + + public void setString(@javax.annotation.Nullable Foo string) { + this.string = string; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FooGetDefaultResponse instance itself + */ + public FooGetDefaultResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("string")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FooGetDefaultResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FooGetDefaultResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FooGetDefaultResponse is not found in the empty JSON string", FooGetDefaultResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `string` + if (jsonObj.get("string") != null && !jsonObj.get("string").isJsonNull()) { + Foo.validateJsonElement(jsonObj.get("string")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FooGetDefaultResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FooGetDefaultResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FooGetDefaultResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FooGetDefaultResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FooGetDefaultResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FooGetDefaultResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FooGetDefaultResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of FooGetDefaultResponse + * @throws IOException if the JSON string is invalid with respect to FooGetDefaultResponse + */ + public static FooGetDefaultResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FooGetDefaultResponse.class); + } + + /** + * Convert an instance of FooGetDefaultResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FormatTest.java new file mode 100644 index 000000000000..6997016b4f46 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FormatTest.java @@ -0,0 +1,731 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.File; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FormatTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FormatTest { + public static final String SERIALIZED_NAME_INTEGER = "integer"; + @SerializedName(SERIALIZED_NAME_INTEGER) + @javax.annotation.Nullable + private Integer integer; + + public static final String SERIALIZED_NAME_INT32 = "int32"; + @SerializedName(SERIALIZED_NAME_INT32) + @javax.annotation.Nullable + private Integer int32; + + public static final String SERIALIZED_NAME_INT64 = "int64"; + @SerializedName(SERIALIZED_NAME_INT64) + @javax.annotation.Nullable + private Long int64; + + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) + @javax.annotation.Nonnull + private BigDecimal number; + + public static final String SERIALIZED_NAME_FLOAT = "float"; + @SerializedName(SERIALIZED_NAME_FLOAT) + @javax.annotation.Nullable + private Float _float; + + public static final String SERIALIZED_NAME_DOUBLE = "double"; + @SerializedName(SERIALIZED_NAME_DOUBLE) + @javax.annotation.Nullable + private Double _double; + + public static final String SERIALIZED_NAME_DECIMAL = "decimal"; + @SerializedName(SERIALIZED_NAME_DECIMAL) + @javax.annotation.Nullable + private BigDecimal decimal; + + public static final String SERIALIZED_NAME_STRING = "string"; + @SerializedName(SERIALIZED_NAME_STRING) + @javax.annotation.Nullable + private String string; + + public static final String SERIALIZED_NAME_BYTE = "byte"; + @SerializedName(SERIALIZED_NAME_BYTE) + @javax.annotation.Nonnull + private byte[] _byte; + + public static final String SERIALIZED_NAME_BINARY = "binary"; + @SerializedName(SERIALIZED_NAME_BINARY) + @javax.annotation.Nullable + private File binary; + + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) + @javax.annotation.Nonnull + private LocalDate date; + + public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; + @SerializedName(SERIALIZED_NAME_DATE_TIME) + @javax.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String SERIALIZED_NAME_UUID = "uuid"; + @SerializedName(SERIALIZED_NAME_UUID) + @javax.annotation.Nullable + private UUID uuid; + + public static final String SERIALIZED_NAME_UUID_WITH_DEFAULT = "uuid_with_default"; + @SerializedName(SERIALIZED_NAME_UUID_WITH_DEFAULT) + @javax.annotation.Nullable + private UUID uuidWithDefault = UUID.fromString("11111111-206d-4f12-9f12-3d1e525a8e84"); + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nonnull + private String password; + + public static final String SERIALIZED_NAME_PATTERN_WITH_DIGITS = "pattern_with_digits"; + @SerializedName(SERIALIZED_NAME_PATTERN_WITH_DIGITS) + @javax.annotation.Nullable + private String patternWithDigits; + + public static final String SERIALIZED_NAME_PATTERN_WITH_DIGITS_AND_DELIMITER = "pattern_with_digits_and_delimiter"; + @SerializedName(SERIALIZED_NAME_PATTERN_WITH_DIGITS_AND_DELIMITER) + @javax.annotation.Nullable + private String patternWithDigitsAndDelimiter; + + public FormatTest() { + } + + public FormatTest integer(@javax.annotation.Nullable Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + */ + @javax.annotation.Nullable + + public Integer getInteger() { + return integer; + } + + public void setInteger(@javax.annotation.Nullable Integer integer) { + this.integer = integer; + } + + + public FormatTest int32(@javax.annotation.Nullable Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + */ + @javax.annotation.Nullable + + public Integer getInt32() { + return int32; + } + + public void setInt32(@javax.annotation.Nullable Integer int32) { + this.int32 = int32; + } + + + public FormatTest int64(@javax.annotation.Nullable Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + */ + @javax.annotation.Nullable + + public Long getInt64() { + return int64; + } + + public void setInt64(@javax.annotation.Nullable Long int64) { + this.int64 = int64; + } + + + public FormatTest number(@javax.annotation.Nonnull BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + */ + @javax.annotation.Nonnull + + public BigDecimal getNumber() { + return number; + } + + public void setNumber(@javax.annotation.Nonnull BigDecimal number) { + this.number = number; + } + + + public FormatTest _float(@javax.annotation.Nullable Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + */ + @javax.annotation.Nullable + + public Float getFloat() { + return _float; + } + + public void setFloat(@javax.annotation.Nullable Float _float) { + this._float = _float; + } + + + public FormatTest _double(@javax.annotation.Nullable Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + */ + @javax.annotation.Nullable + + public Double getDouble() { + return _double; + } + + public void setDouble(@javax.annotation.Nullable Double _double) { + this._double = _double; + } + + + public FormatTest decimal(@javax.annotation.Nullable BigDecimal decimal) { + this.decimal = decimal; + return this; + } + + /** + * Get decimal + * @return decimal + */ + @javax.annotation.Nullable + + public BigDecimal getDecimal() { + return decimal; + } + + public void setDecimal(@javax.annotation.Nullable BigDecimal decimal) { + this.decimal = decimal; + } + + + public FormatTest string(@javax.annotation.Nullable String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + */ + @javax.annotation.Nullable + + public String getString() { + return string; + } + + public void setString(@javax.annotation.Nullable String string) { + this.string = string; + } + + + public FormatTest _byte(@javax.annotation.Nonnull byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + */ + @javax.annotation.Nonnull + + public byte[] getByte() { + return _byte; + } + + public void setByte(@javax.annotation.Nonnull byte[] _byte) { + this._byte = _byte; + } + + + public FormatTest binary(@javax.annotation.Nullable File binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + */ + @javax.annotation.Nullable + + public File getBinary() { + return binary; + } + + public void setBinary(@javax.annotation.Nullable File binary) { + this.binary = binary; + } + + + public FormatTest date(@javax.annotation.Nonnull LocalDate date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + */ + @javax.annotation.Nonnull + + public LocalDate getDate() { + return date; + } + + public void setDate(@javax.annotation.Nonnull LocalDate date) { + this.date = date; + } + + + public FormatTest dateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @javax.annotation.Nullable + + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public FormatTest uuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + + public UUID getUuid() { + return uuid; + } + + public void setUuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + + public FormatTest uuidWithDefault(@javax.annotation.Nullable UUID uuidWithDefault) { + this.uuidWithDefault = uuidWithDefault; + return this; + } + + /** + * Get uuidWithDefault + * @return uuidWithDefault + */ + @javax.annotation.Nullable + + public UUID getUuidWithDefault() { + return uuidWithDefault; + } + + public void setUuidWithDefault(@javax.annotation.Nullable UUID uuidWithDefault) { + this.uuidWithDefault = uuidWithDefault; + } + + + public FormatTest password(@javax.annotation.Nonnull String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nonnull + + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nonnull String password) { + this.password = password; + } + + + public FormatTest patternWithDigits(@javax.annotation.Nullable String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + return this; + } + + /** + * A string that is a 10 digit number. Can have leading zeros. + * @return patternWithDigits + */ + @javax.annotation.Nullable + + public String getPatternWithDigits() { + return patternWithDigits; + } + + public void setPatternWithDigits(@javax.annotation.Nullable String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + } + + + public FormatTest patternWithDigitsAndDelimiter(@javax.annotation.Nullable 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 + + public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; + } + + public void setPatternWithDigitsAndDelimiter(@javax.annotation.Nullable String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FormatTest instance itself + */ + public FormatTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" decimal: ").append(toIndentedString(decimal)).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(" uuidWithDefault: ").append(toIndentedString(uuidWithDefault)).append("\n"); + sb.append(" password: ").append("*").append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer", "int32", "int64", "number", "float", "double", "decimal", "string", "byte", "binary", "date", "dateTime", "uuid", "uuid_with_default", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("number", "byte", "date", "password")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FormatTest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FormatTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FormatTest is not found in the empty JSON string", FormatTest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FormatTest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("string") != null && !jsonObj.get("string").isJsonNull()) && !jsonObj.get("string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string").toString())); + } + if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } + if ((jsonObj.get("uuid_with_default") != null && !jsonObj.get("uuid_with_default").isJsonNull()) && !jsonObj.get("uuid_with_default").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `uuid_with_default` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid_with_default").toString())); + } + if (!jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("pattern_with_digits") != null && !jsonObj.get("pattern_with_digits").isJsonNull()) && !jsonObj.get("pattern_with_digits").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `pattern_with_digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pattern_with_digits").toString())); + } + if ((jsonObj.get("pattern_with_digits_and_delimiter") != null && !jsonObj.get("pattern_with_digits_and_delimiter").isJsonNull()) && !jsonObj.get("pattern_with_digits_and_delimiter").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `pattern_with_digits_and_delimiter` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pattern_with_digits_and_delimiter").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FormatTest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FormatTest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FormatTest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FormatTest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FormatTest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FormatTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FormatTest given an JSON string + * + * @param jsonString JSON string + * @return An instance of FormatTest + * @throws IOException if the JSON string is invalid with respect to FormatTest + */ + public static FormatTest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FormatTest.class); + } + + /** + * Convert an instance of FormatTest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java new file mode 100644 index 000000000000..d059e2f789ba --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.FreeFormObjectTestClassProperties; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * FreeFormObjectTestClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FreeFormObjectTestClass { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + @javax.annotation.Nullable + private FreeFormObjectTestClassProperties properties; + + public FreeFormObjectTestClass() { + } + + public FreeFormObjectTestClass name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public FreeFormObjectTestClass properties(@javax.annotation.Nullable FreeFormObjectTestClassProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get properties + * @return properties + */ + @javax.annotation.Nullable + + public FreeFormObjectTestClassProperties getProperties() { + return properties; + } + + public void setProperties(@javax.annotation.Nullable FreeFormObjectTestClassProperties properties) { + this.properties = properties; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FreeFormObjectTestClass instance itself + */ + public FreeFormObjectTestClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FreeFormObjectTestClass {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "properties")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FreeFormObjectTestClass + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FreeFormObjectTestClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FreeFormObjectTestClass is not found in the empty JSON string", FreeFormObjectTestClass.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `properties` + if (jsonObj.get("properties") != null && !jsonObj.get("properties").isJsonNull()) { + FreeFormObjectTestClassProperties.validateJsonElement(jsonObj.get("properties")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FreeFormObjectTestClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FreeFormObjectTestClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FreeFormObjectTestClass.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FreeFormObjectTestClass value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FreeFormObjectTestClass read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FreeFormObjectTestClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FreeFormObjectTestClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of FreeFormObjectTestClass + * @throws IOException if the JSON string is invalid with respect to FreeFormObjectTestClass + */ + public static FreeFormObjectTestClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FreeFormObjectTestClass.class); + } + + /** + * Convert an instance of FreeFormObjectTestClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java new file mode 100644 index 000000000000..8a57bb75d9a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java @@ -0,0 +1,273 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FreeFormObjectTestClassProperties extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FreeFormObjectTestClassProperties.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FreeFormObjectTestClassProperties + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + } + + // deserialize Map + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Map failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for FreeFormObjectTestClassProperties: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FreeFormObjectTestClassProperties.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FreeFormObjectTestClassProperties' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final Type typeInstanceMapStringObject = new TypeToken>(){}.getType(); + final TypeAdapter> adapterMapStringObject = (TypeAdapter>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FreeFormObjectTestClassProperties value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + // check if the actual instance is of the type `Map` + if (value.getActualInstance() instanceof Map) { + JsonObject object = adapterMapStringObject.toJsonTree((Map)value.getActualInstance()).getAsJsonObject(); + elementAdapter.write(out, object); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Map, String"); + } + + @Override + public FreeFormObjectTestClassProperties read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterString; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize Map + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonObject()) { + throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterMapStringObject; + match++; + log.log(Level.FINER, "Input data matches schema 'Map'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Map failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Map'", e); + } + + if (match == 1) { + FreeFormObjectTestClassProperties ret = new FreeFormObjectTestClassProperties(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for FreeFormObjectTestClassProperties: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public FreeFormObjectTestClassProperties() { + super("oneOf", Boolean.FALSE); + } + + public FreeFormObjectTestClassProperties(Map o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public FreeFormObjectTestClassProperties(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Map", Map.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return FreeFormObjectTestClassProperties.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Map, String + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Map.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Map, String"); + } + + /** + * Get the actual instance, which can be the following: + * Map, String + * + * @return The actual instance (Map, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Map`. If the actual instance is not `Map`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Map` + * @throws ClassCastException if the instance is not `Map` + */ + public Map getMap() throws ClassCastException { + return (Map)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Fruit.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Fruit.java new file mode 100644 index 000000000000..66be88b29f53 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Fruit.java @@ -0,0 +1,272 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Fruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Fruit.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Fruit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize Apple + try { + // validate the JSON object to see if any exception is thrown + Apple.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Apple failed with `%s`.", e.getMessage())); + } + + // deserialize Banana + try { + // validate the JSON object to see if any exception is thrown + Banana.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Banana failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for Fruit: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Fruit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Fruit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterApple = gson.getDelegateAdapter(this, TypeToken.get(Apple.class)); + final TypeAdapter adapterBanana = gson.getDelegateAdapter(this, TypeToken.get(Banana.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Fruit value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Apple` + if (value.getActualInstance() instanceof Apple) { + JsonElement element = adapterApple.toJsonTree((Apple)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `Banana` + if (value.getActualInstance() instanceof Banana) { + JsonElement element = adapterBanana.toJsonTree((Banana)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Apple, Banana"); + } + + @Override + public Fruit read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize Apple + try { + // validate the JSON object to see if any exception is thrown + Apple.validateJsonElement(jsonElement); + actualAdapter = adapterApple; + match++; + log.log(Level.FINER, "Input data matches schema 'Apple'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Apple failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Apple'", e); + } + + // deserialize Banana + try { + // validate the JSON object to see if any exception is thrown + Banana.validateJsonElement(jsonElement); + actualAdapter = adapterBanana; + match++; + log.log(Level.FINER, "Input data matches schema 'Banana'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Banana failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Banana'", e); + } + + if (match == 1) { + Fruit ret = new Fruit(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for Fruit: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final 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", Apple.class); + schemas.put("Banana", Banana.class); + } + + @Override + public Map> getSchemas() { + return Fruit.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Apple, Banana + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Apple.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Banana.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } + + /** + * Get the actual instance, which can be the following: + * Apple, Banana + * + * @return The actual instance (Apple, Banana) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Apple`. If the actual instance is not `Apple`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Apple` + * @throws ClassCastException if the instance is not `Apple` + */ + public Apple getApple() throws ClassCastException { + return (Apple)super.getActualInstance(); + } + + /** + * Get the actual instance of `Banana`. If the actual instance is not `Banana`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Banana` + * @throws ClassCastException if the instance is not `Banana` + */ + public Banana getBanana() throws ClassCastException { + return (Banana)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FruitReq.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FruitReq.java new file mode 100644 index 000000000000..cb6448fbc4e9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FruitReq.java @@ -0,0 +1,277 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class FruitReq extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FruitReq.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FruitReq + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize AppleReq + try { + // validate the JSON object to see if any exception is thrown + AppleReq.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for AppleReq failed with `%s`.", e.getMessage())); + } + + // deserialize BananaReq + try { + // validate the JSON object to see if any exception is thrown + BananaReq.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for BananaReq failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for FruitReq: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FruitReq.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FruitReq' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterAppleReq = gson.getDelegateAdapter(this, TypeToken.get(AppleReq.class)); + final TypeAdapter adapterBananaReq = gson.getDelegateAdapter(this, TypeToken.get(BananaReq.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FruitReq value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `AppleReq` + if (value.getActualInstance() instanceof AppleReq) { + JsonElement element = adapterAppleReq.toJsonTree((AppleReq)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `BananaReq` + if (value.getActualInstance() instanceof BananaReq) { + JsonElement element = adapterBananaReq.toJsonTree((BananaReq)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: AppleReq, BananaReq"); + } + + @Override + public FruitReq read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize AppleReq + try { + // validate the JSON object to see if any exception is thrown + AppleReq.validateJsonElement(jsonElement); + actualAdapter = adapterAppleReq; + match++; + log.log(Level.FINER, "Input data matches schema 'AppleReq'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for AppleReq failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'AppleReq'", e); + } + + // deserialize BananaReq + try { + // validate the JSON object to see if any exception is thrown + BananaReq.validateJsonElement(jsonElement); + actualAdapter = adapterBananaReq; + match++; + log.log(Level.FINER, "Input data matches schema 'BananaReq'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for BananaReq failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'BananaReq'", e); + } + + if (match == 1) { + FruitReq ret = new FruitReq(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for FruitReq: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final 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", AppleReq.class); + schemas.put("BananaReq", BananaReq.class); + } + + @Override + public Map> getSchemas() { + return FruitReq.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * AppleReq, BananaReq + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(AppleReq.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(BananaReq.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be AppleReq, BananaReq"); + } + + /** + * Get the actual instance, which can be the following: + * AppleReq, BananaReq + * + * @return The actual instance (AppleReq, BananaReq) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AppleReq`. If the actual instance is not `AppleReq`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `AppleReq` + * @throws ClassCastException if the instance is not `AppleReq` + */ + public AppleReq getAppleReq() throws ClassCastException { + return (AppleReq)super.getActualInstance(); + } + + /** + * Get the actual instance of `BananaReq`. If the actual instance is not `BananaReq`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BananaReq` + * @throws ClassCastException if the instance is not `BananaReq` + */ + public BananaReq getBananaReq() throws ClassCastException { + return (BananaReq)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GmFruit.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GmFruit.java new file mode 100644 index 000000000000..e39193a1f28a --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GmFruit.java @@ -0,0 +1,263 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class GmFruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GmFruit.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GmFruit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + List errorMessages = new ArrayList<>(); + int matches = 0; + + try { + // validate the JSON object to see if any exception is thrown + Apple.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Apple failed with `%s`.", e.getMessage())); + } + + try { + // validate the JSON object to see if any exception is thrown + Banana.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Banana failed with `%s`.", e.getMessage())); + } + + + if (matches == 0) { + throw new IOException(String.format("Failed deserialization for GmFruit: no match found. %s", errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GmFruit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GmFruit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterApple = gson.getDelegateAdapter(this, TypeToken.get(Apple.class)); + final TypeAdapter adapterBanana = gson.getDelegateAdapter(this, TypeToken.get(Banana.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GmFruit value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Apple` + if (value.getActualInstance() instanceof Apple) { + JsonElement element = adapterApple.toJsonTree((Apple)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `Banana` + if (value.getActualInstance() instanceof Banana) { + JsonElement element = adapterBanana.toJsonTree((Banana)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: Apple, Banana"); + } + + @Override + public GmFruit read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize Apple + try { + // validate the JSON object to see if any exception is thrown + Apple.validateJsonElement(jsonElement); + GmFruit ret = new GmFruit(); + ret.setActualInstance(adapterApple.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Apple failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Apple'", e); + } + + // deserialize Banana + try { + // validate the JSON object to see if any exception is thrown + Banana.validateJsonElement(jsonElement); + GmFruit ret = new GmFruit(); + ret.setActualInstance(adapterBanana.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Banana failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Banana'", e); + } + + + throw new IOException(String.format("Failed deserialization for GmFruit: no match found. %s", errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in anyOf + public static final 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", Apple.class); + schemas.put("Banana", Banana.class); + } + + @Override + public Map> getSchemas() { + return GmFruit.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Apple, Banana + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Apple.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Banana.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } + + /** + * Get the actual instance, which can be the following: + * Apple, Banana + * + * @return The actual instance (Apple, Banana) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Apple`. If the actual instance is not `Apple`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Apple` + * @throws ClassCastException if the instance is not `Apple` + */ + public Apple getApple() throws ClassCastException { + return (Apple)super.getActualInstance(); + } + + /** + * Get the actual instance of `Banana`. If the actual instance is not `Banana`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Banana` + * @throws ClassCastException if the instance is not `Banana` + */ + public Banana getBanana() throws ClassCastException { + return (Banana)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GrandparentAnimal.java new file mode 100644 index 000000000000..7c938f2f50c1 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GrandparentAnimal.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * GrandparentAnimal + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class GrandparentAnimal { + public static final String SERIALIZED_NAME_PET_TYPE = "pet_type"; + @SerializedName(SERIALIZED_NAME_PET_TYPE) + @javax.annotation.Nonnull + protected String petType; + + public GrandparentAnimal() { + this.petType = this.getClass().getSimpleName(); + } + + public GrandparentAnimal petType(@javax.annotation.Nonnull String petType) { + this.petType = petType; + return this; + } + + /** + * Get petType + * @return petType + */ + @javax.annotation.Nonnull + + public String getPetType() { + return petType; + } + + public void setPetType(@javax.annotation.Nonnull String petType) { + this.petType = petType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the GrandparentAnimal instance itself + */ + public GrandparentAnimal putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GrandparentAnimal {\n"); + sb.append(" petType: ").append(toIndentedString(petType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("pet_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("pet_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GrandparentAnimal + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GrandparentAnimal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in GrandparentAnimal is not found in the empty JSON string", GrandparentAnimal.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("pet_type").getAsString(); + switch (discriminatorValue) { + case "ParentPet": + ParentPet.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The value of the `pet_type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of GrandparentAnimal given an JSON string + * + * @param jsonString JSON string + * @return An instance of GrandparentAnimal + * @throws IOException if the JSON string is invalid with respect to GrandparentAnimal + */ + public static GrandparentAnimal fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GrandparentAnimal.class); + } + + /** + * Convert an instance of GrandparentAnimal to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..002a172518be --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -0,0 +1,300 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * HasOnlyReadOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class HasOnlyReadOnly { + public static final String SERIALIZED_NAME_BAR = "bar"; + @SerializedName(SERIALIZED_NAME_BAR) + @javax.annotation.Nullable + private String bar; + + public static final String SERIALIZED_NAME_FOO = "foo"; + @SerializedName(SERIALIZED_NAME_FOO) + @javax.annotation.Nullable + private String foo; + + public HasOnlyReadOnly() { + } + + public HasOnlyReadOnly( + String bar, + String foo + ) { + this(); + this.bar = bar; + this.foo = foo; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + + public String getBar() { + return bar; + } + + + + /** + * Get foo + * @return foo + */ + @javax.annotation.Nullable + + public String getFoo() { + return foo; + } + + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the HasOnlyReadOnly instance itself + */ + public HasOnlyReadOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar", "foo")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HasOnlyReadOnly + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HasOnlyReadOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in HasOnlyReadOnly is not found in the empty JSON string", HasOnlyReadOnly.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonNull()) && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } + if ((jsonObj.get("foo") != null && !jsonObj.get("foo").isJsonNull()) && !jsonObj.get("foo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `foo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("foo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HasOnlyReadOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HasOnlyReadOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HasOnlyReadOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HasOnlyReadOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public HasOnlyReadOnly read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + HasOnlyReadOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HasOnlyReadOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of HasOnlyReadOnly + * @throws IOException if the JSON string is invalid with respect to HasOnlyReadOnly + */ + public static HasOnlyReadOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HasOnlyReadOnly.class); + } + + /** + * Convert an instance of HasOnlyReadOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HealthCheckResult.java new file mode 100644 index 000000000000..7491f3df24fb --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -0,0 +1,290 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class HealthCheckResult { + public static final String SERIALIZED_NAME_NULLABLE_MESSAGE = "NullableMessage"; + @SerializedName(SERIALIZED_NAME_NULLABLE_MESSAGE) + @javax.annotation.Nullable + private String nullableMessage; + + public HealthCheckResult() { + } + + public HealthCheckResult nullableMessage(@javax.annotation.Nullable String nullableMessage) { + this.nullableMessage = nullableMessage; + return this; + } + + /** + * Get nullableMessage + * @return nullableMessage + */ + @javax.annotation.Nullable + + public String getNullableMessage() { + return nullableMessage; + } + + public void setNullableMessage(@javax.annotation.Nullable String nullableMessage) { + this.nullableMessage = nullableMessage; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the HealthCheckResult instance itself + */ + public HealthCheckResult putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("NullableMessage")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HealthCheckResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HealthCheckResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in HealthCheckResult is not found in the empty JSON string", HealthCheckResult.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("NullableMessage") != null && !jsonObj.get("NullableMessage").isJsonNull()) && !jsonObj.get("NullableMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `NullableMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("NullableMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HealthCheckResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HealthCheckResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HealthCheckResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HealthCheckResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public HealthCheckResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + HealthCheckResult instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HealthCheckResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of HealthCheckResult + * @throws IOException if the JSON string is invalid with respect to HealthCheckResult + */ + public static HealthCheckResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HealthCheckResult.class); + } + + /** + * Convert an instance of HealthCheckResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java new file mode 100644 index 000000000000..764c3cce713e --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -0,0 +1,314 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * IsoscelesTriangle + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class IsoscelesTriangle { + public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; + @SerializedName(SERIALIZED_NAME_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String SERIALIZED_NAME_TRIANGLE_TYPE = "triangleType"; + @SerializedName(SERIALIZED_NAME_TRIANGLE_TYPE) + @javax.annotation.Nonnull + private String triangleType; + + public IsoscelesTriangle() { + } + + public IsoscelesTriangle shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + + public String getShapeType() { + return shapeType; + } + + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public IsoscelesTriangle triangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @javax.annotation.Nonnull + + public String getTriangleType() { + return triangleType; + } + + public void setTriangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IsoscelesTriangle instance itself + */ + public IsoscelesTriangle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IsoscelesTriangle + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IsoscelesTriangle.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in IsoscelesTriangle is not found in the empty JSON string", IsoscelesTriangle.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : IsoscelesTriangle.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("shapeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); + } + if (!jsonObj.get("triangleType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `triangleType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("triangleType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IsoscelesTriangle.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IsoscelesTriangle' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IsoscelesTriangle.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IsoscelesTriangle value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public IsoscelesTriangle read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + IsoscelesTriangle instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IsoscelesTriangle given an JSON string + * + * @param jsonString JSON string + * @return An instance of IsoscelesTriangle + * @throws IOException if the JSON string is invalid with respect to IsoscelesTriangle + */ + public static IsoscelesTriangle fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IsoscelesTriangle.class); + } + + /** + * Convert an instance of IsoscelesTriangle to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Mammal.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Mammal.java new file mode 100644 index 000000000000..3788e0e69ed6 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Mammal.java @@ -0,0 +1,363 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Mammal extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Mammal.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Mammal + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("className") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'className' is missing."); + } + String discriminatorValue = jsonObject.get("className").getAsString(); + if ("Pig".equals(discriminatorValue)) { + Pig.validateJsonElement(jsonElement); + return; + } + if ("whale".equals(discriminatorValue)) { + Whale.validateJsonElement(jsonElement); + return; + } + if ("zebra".equals(discriminatorValue)) { + Zebra.validateJsonElement(jsonElement); + return; + } + // deserialize Whale + try { + // validate the JSON object to see if any exception is thrown + Whale.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Whale failed with `%s`.", e.getMessage())); + } + + // deserialize Zebra + try { + // validate the JSON object to see if any exception is thrown + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Zebra failed with `%s`.", e.getMessage())); + } + + // deserialize Pig + try { + // validate the JSON object to see if any exception is thrown + Pig.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Pig failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for Mammal: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Mammal.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Mammal' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterWhale = gson.getDelegateAdapter(this, TypeToken.get(Whale.class)); + final TypeAdapter adapterZebra = gson.getDelegateAdapter(this, TypeToken.get(Zebra.class)); + final TypeAdapter adapterPig = gson.getDelegateAdapter(this, TypeToken.get(Pig.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Mammal value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Whale` + if (value.getActualInstance() instanceof Whale) { + JsonElement element = adapterWhale.toJsonTree((Whale)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `Zebra` + if (value.getActualInstance() instanceof Zebra) { + JsonElement element = adapterZebra.toJsonTree((Zebra)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `Pig` + if (value.getActualInstance() instanceof Pig) { + JsonElement element = adapterPig.toJsonTree((Pig)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Pig, Whale, Zebra"); + } + + @Override + public Mammal read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("className") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'className' is missing."); + } + String discriminatorValue = jsonObject.get("className").getAsString(); + if ("Pig".equals(discriminatorValue)) { + deserialized = adapterPig.fromJsonTree(jsonElement); + Mammal ret = new Mammal(); + ret.setActualInstance(deserialized); + return ret; + } + if ("whale".equals(discriminatorValue)) { + deserialized = adapterWhale.fromJsonTree(jsonElement); + Mammal ret = new Mammal(); + ret.setActualInstance(deserialized); + return ret; + } + if ("zebra".equals(discriminatorValue)) { + deserialized = adapterZebra.fromJsonTree(jsonElement); + Mammal ret = new Mammal(); + ret.setActualInstance(deserialized); + return ret; + } + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize Whale + try { + // validate the JSON object to see if any exception is thrown + Whale.validateJsonElement(jsonElement); + actualAdapter = adapterWhale; + match++; + log.log(Level.FINER, "Input data matches schema 'Whale'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Whale failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Whale'", e); + } + + // deserialize Zebra + try { + // validate the JSON object to see if any exception is thrown + actualAdapter = adapterZebra; + match++; + log.log(Level.FINER, "Input data matches schema 'Zebra'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Zebra failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Zebra'", e); + } + + // deserialize Pig + try { + // validate the JSON object to see if any exception is thrown + Pig.validateJsonElement(jsonElement); + actualAdapter = adapterPig; + match++; + log.log(Level.FINER, "Input data matches schema 'Pig'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Pig failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Pig'", e); + } + + if (match == 1) { + Mammal ret = new Mammal(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for Mammal: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final 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", Pig.class); + schemas.put("Whale", Whale.class); + schemas.put("Zebra", Zebra.class); + } + + @Override + public Map> getSchemas() { + return Mammal.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Pig, Whale, Zebra + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Pig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Whale.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Zebra.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Pig, Whale, Zebra"); + } + + /** + * Get the actual instance, which can be the following: + * Pig, Whale, Zebra + * + * @return The actual instance (Pig, Whale, Zebra) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Pig`. If the actual instance is not `Pig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Pig` + * @throws ClassCastException if the instance is not `Pig` + */ + public Pig getPig() throws ClassCastException { + return (Pig)super.getActualInstance(); + } + + /** + * Get the actual instance of `Whale`. If the actual instance is not `Whale`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Whale` + * @throws ClassCastException if the instance is not `Whale` + */ + public Whale getWhale() throws ClassCastException { + return (Whale)super.getActualInstance(); + } + + /** + * Get the actual instance of `Zebra`. If the actual instance is not `Zebra`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Zebra` + * @throws ClassCastException if the instance is not `Zebra` + */ + public Zebra getZebra() throws ClassCastException { + return (Zebra)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MammalAnyof.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MammalAnyof.java new file mode 100644 index 000000000000..a81387130a2f --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MammalAnyof.java @@ -0,0 +1,312 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class MammalAnyof extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(MammalAnyof.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MammalAnyof + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + List errorMessages = new ArrayList<>(); + int matches = 0; + + try { + // validate the JSON object to see if any exception is thrown + Whale.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Whale failed with `%s`.", e.getMessage())); + } + + try { + // validate the JSON object to see if any exception is thrown + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Zebra failed with `%s`.", e.getMessage())); + } + + try { + // validate the JSON object to see if any exception is thrown + Pig.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Pig failed with `%s`.", e.getMessage())); + } + + + if (matches == 0) { + throw new IOException(String.format("Failed deserialization for MammalAnyof: no match found. %s", errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MammalAnyof.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MammalAnyof' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterWhale = gson.getDelegateAdapter(this, TypeToken.get(Whale.class)); + final TypeAdapter adapterZebra = gson.getDelegateAdapter(this, TypeToken.get(Zebra.class)); + final TypeAdapter adapterPig = gson.getDelegateAdapter(this, TypeToken.get(Pig.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MammalAnyof value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Whale` + if (value.getActualInstance() instanceof Whale) { + JsonElement element = adapterWhale.toJsonTree((Whale)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `Zebra` + if (value.getActualInstance() instanceof Zebra) { + JsonElement element = adapterZebra.toJsonTree((Zebra)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `Pig` + if (value.getActualInstance() instanceof Pig) { + JsonElement element = adapterPig.toJsonTree((Pig)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: Pig, Whale, Zebra"); + } + + @Override + public MammalAnyof read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize Whale + try { + // validate the JSON object to see if any exception is thrown + Whale.validateJsonElement(jsonElement); + MammalAnyof ret = new MammalAnyof(); + ret.setActualInstance(adapterWhale.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Whale failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Whale'", e); + } + + // deserialize Zebra + try { + // validate the JSON object to see if any exception is thrown + MammalAnyof ret = new MammalAnyof(); + ret.setActualInstance(adapterZebra.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Zebra failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Zebra'", e); + } + + // deserialize Pig + try { + // validate the JSON object to see if any exception is thrown + Pig.validateJsonElement(jsonElement); + MammalAnyof ret = new MammalAnyof(); + ret.setActualInstance(adapterPig.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Pig failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Pig'", e); + } + + + throw new IOException(String.format("Failed deserialization for MammalAnyof: no match found. %s", errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public MammalAnyof() { + super("anyOf", Boolean.FALSE); + } + + public MammalAnyof(Pig o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public MammalAnyof(Whale o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public MammalAnyof(Zebra o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Pig", Pig.class); + schemas.put("Whale", Whale.class); + schemas.put("Zebra", Zebra.class); + } + + @Override + public Map> getSchemas() { + return MammalAnyof.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Pig, Whale, Zebra + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Pig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Whale.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Zebra.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Pig, Whale, Zebra"); + } + + /** + * Get the actual instance, which can be the following: + * Pig, Whale, Zebra + * + * @return The actual instance (Pig, Whale, Zebra) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Pig`. If the actual instance is not `Pig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Pig` + * @throws ClassCastException if the instance is not `Pig` + */ + public Pig getPig() throws ClassCastException { + return (Pig)super.getActualInstance(); + } + + /** + * Get the actual instance of `Whale`. If the actual instance is not `Whale`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Whale` + * @throws ClassCastException if the instance is not `Whale` + */ + public Whale getWhale() throws ClassCastException { + return (Whale)super.getActualInstance(); + } + + /** + * Get the actual instance of `Zebra`. If the actual instance is not `Zebra`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Zebra` + * @throws ClassCastException if the instance is not `Zebra` + */ + public Zebra getZebra() throws ClassCastException { + return (Zebra)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MapTest.java new file mode 100644 index 000000000000..c7bbc83c79a4 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,439 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * MapTest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class MapTest { + public static final String SERIALIZED_NAME_MAP_MAP_OF_STRING = "map_map_of_string"; + @SerializedName(SERIALIZED_NAME_MAP_MAP_OF_STRING) + @javax.annotation.Nullable + private Map> mapMapOfString = new HashMap<>(); + + /** + * Gets or Sets inner + */ + @JsonAdapter(InnerEnum.Adapter.class) + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final InnerEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public InnerEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return InnerEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + InnerEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_MAP_OF_ENUM_STRING = "map_of_enum_string"; + @SerializedName(SERIALIZED_NAME_MAP_OF_ENUM_STRING) + @javax.annotation.Nullable + private Map mapOfEnumString = new HashMap<>(); + + public static final String SERIALIZED_NAME_DIRECT_MAP = "direct_map"; + @SerializedName(SERIALIZED_NAME_DIRECT_MAP) + @javax.annotation.Nullable + private Map directMap = new HashMap<>(); + + public static final String SERIALIZED_NAME_INDIRECT_MAP = "indirect_map"; + @SerializedName(SERIALIZED_NAME_INDIRECT_MAP) + @javax.annotation.Nullable + private Map indirectMap = new HashMap<>(); + + public MapTest() { + } + + public MapTest mapMapOfString(@javax.annotation.Nullable 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 + + public Map> getMapMapOfString() { + return mapMapOfString; + } + + public void setMapMapOfString(@javax.annotation.Nullable Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + + public MapTest mapOfEnumString(@javax.annotation.Nullable 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 + + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + public void setMapOfEnumString(@javax.annotation.Nullable Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + + public MapTest directMap(@javax.annotation.Nullable 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 + + public Map getDirectMap() { + return directMap; + } + + public void setDirectMap(@javax.annotation.Nullable Map directMap) { + this.directMap = directMap; + } + + + public MapTest indirectMap(@javax.annotation.Nullable 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 + + public Map getIndirectMap() { + return indirectMap; + } + + public void setIndirectMap(@javax.annotation.Nullable Map indirectMap) { + this.indirectMap = indirectMap; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MapTest instance itself + */ + public MapTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MapTest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MapTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in MapTest is not found in the empty JSON string", MapTest.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MapTest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MapTest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MapTest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MapTest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MapTest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MapTest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MapTest given an JSON string + * + * @param jsonString JSON string + * @return An instance of MapTest + * @throws IOException if the JSON string is invalid with respect to MapTest + */ + public static MapTest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MapTest.class); + } + + /** + * Convert an instance of MapTest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..47e7d76a5eec --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,343 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class MixedPropertiesAndAdditionalPropertiesClass { + public static final String SERIALIZED_NAME_UUID = "uuid"; + @SerializedName(SERIALIZED_NAME_UUID) + @javax.annotation.Nullable + private UUID uuid; + + public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; + @SerializedName(SERIALIZED_NAME_DATE_TIME) + @javax.annotation.Nullable + private OffsetDateTime dateTime; + + public static final String SERIALIZED_NAME_MAP = "map"; + @SerializedName(SERIALIZED_NAME_MAP) + @javax.annotation.Nullable + private Map map = new HashMap<>(); + + public MixedPropertiesAndAdditionalPropertiesClass() { + } + + public MixedPropertiesAndAdditionalPropertiesClass uuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + + public UUID getUuid() { + return uuid; + } + + public void setUuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + */ + @javax.annotation.Nullable + + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(@javax.annotation.Nullable OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public MixedPropertiesAndAdditionalPropertiesClass map(@javax.annotation.Nullable 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 + + public Map getMap() { + return map; + } + + public void setMap(@javax.annotation.Nullable Map map) { + this.map = map; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MixedPropertiesAndAdditionalPropertiesClass instance itself + */ + public MixedPropertiesAndAdditionalPropertiesClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("uuid", "dateTime", "map")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MixedPropertiesAndAdditionalPropertiesClass + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in MixedPropertiesAndAdditionalPropertiesClass is not found in the empty JSON string", MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MixedPropertiesAndAdditionalPropertiesClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MixedPropertiesAndAdditionalPropertiesClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MixedPropertiesAndAdditionalPropertiesClass.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MixedPropertiesAndAdditionalPropertiesClass value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MixedPropertiesAndAdditionalPropertiesClass read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MixedPropertiesAndAdditionalPropertiesClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MixedPropertiesAndAdditionalPropertiesClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of MixedPropertiesAndAdditionalPropertiesClass + * @throws IOException if the JSON string is invalid with respect to MixedPropertiesAndAdditionalPropertiesClass + */ + public static MixedPropertiesAndAdditionalPropertiesClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MixedPropertiesAndAdditionalPropertiesClass.class); + } + + /** + * Convert an instance of MixedPropertiesAndAdditionalPropertiesClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Model200Response.java new file mode 100644 index 000000000000..0786d7bbd133 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Model200Response.java @@ -0,0 +1,304 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model name starting with number + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Model200Response { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private Integer name; + + public static final String SERIALIZED_NAME_PROPERTY_CLASS = "class"; + @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) + @javax.annotation.Nullable + private String propertyClass; + + public Model200Response() { + } + + public Model200Response name(@javax.annotation.Nullable Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public Integer getName() { + return name; + } + + public void setName(@javax.annotation.Nullable Integer name) { + this.name = name; + } + + + public Model200Response propertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + */ + @javax.annotation.Nullable + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(@javax.annotation.Nullable String propertyClass) { + this.propertyClass = propertyClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Model200Response instance itself + */ + public Model200Response putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "class")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Model200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Model200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Model200Response is not found in the empty JSON string", Model200Response.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("class") != null && !jsonObj.get("class").isJsonNull()) && !jsonObj.get("class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("class").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Model200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Model200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Model200Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Model200Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Model200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Model200Response instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Model200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of Model200Response + * @throws IOException if the JSON string is invalid with respect to Model200Response + */ + public static Model200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Model200Response.class); + } + + /** + * Convert an instance of Model200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..ff143aa112b3 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,333 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelApiResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelApiResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private Integer code; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public ModelApiResponse() { + } + + public ModelApiResponse code(@javax.annotation.Nullable Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + + public Integer getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable Integer code) { + this.code = code; + } + + + public ModelApiResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ModelApiResponse message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelApiResponse instance itself + */ + public ModelApiResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("code", "type", "message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelApiResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelApiResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelApiResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelApiResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelApiResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelApiResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelApiResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelApiResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelApiResponse + * @throws IOException if the JSON string is invalid with respect to ModelApiResponse + */ + public static ModelApiResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelApiResponse.class); + } + + /** + * Convert an instance of ModelApiResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelFile.java new file mode 100644 index 000000000000..706e2cc011a8 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelFile.java @@ -0,0 +1,278 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Must be named `File` for test. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelFile { + public static final String SERIALIZED_NAME_SOURCE_U_R_I = "sourceURI"; + @SerializedName(SERIALIZED_NAME_SOURCE_U_R_I) + @javax.annotation.Nullable + private String sourceURI; + + public ModelFile() { + } + + public ModelFile sourceURI(@javax.annotation.Nullable String sourceURI) { + this.sourceURI = sourceURI; + return this; + } + + /** + * Test capitalization + * @return sourceURI + */ + @javax.annotation.Nullable + + public String getSourceURI() { + return sourceURI; + } + + public void setSourceURI(@javax.annotation.Nullable String sourceURI) { + this.sourceURI = sourceURI; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelFile instance itself + */ + public ModelFile putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelFile {\n"); + sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("sourceURI")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelFile + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelFile.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelFile is not found in the empty JSON string", ModelFile.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("sourceURI") != null && !jsonObj.get("sourceURI").isJsonNull()) && !jsonObj.get("sourceURI").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `sourceURI` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceURI").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelFile.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelFile' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelFile.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelFile value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelFile read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelFile instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelFile given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelFile + * @throws IOException if the JSON string is invalid with respect to ModelFile + */ + public static ModelFile fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelFile.class); + } + + /** + * Convert an instance of ModelFile to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelList.java new file mode 100644 index 000000000000..8b8fa5c98666 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelList.java @@ -0,0 +1,278 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelList { + public static final String SERIALIZED_NAME_123LIST = "123-list"; + @SerializedName(SERIALIZED_NAME_123LIST) + @javax.annotation.Nullable + private String _123list; + + public ModelList() { + } + + public ModelList _123list(@javax.annotation.Nullable String _123list) { + this._123list = _123list; + return this; + } + + /** + * Get _123list + * @return _123list + */ + @javax.annotation.Nullable + + public String get123list() { + return _123list; + } + + public void set123list(@javax.annotation.Nullable String _123list) { + this._123list = _123list; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelList instance itself + */ + public ModelList putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelList {\n"); + sb.append(" _123list: ").append(toIndentedString(_123list)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("123-list")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelList is not found in the empty JSON string", ModelList.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("123-list") != null && !jsonObj.get("123-list").isJsonNull()) && !jsonObj.get("123-list").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `123-list` to be a primitive type in the JSON string but got `%s`", jsonObj.get("123-list").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelList instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelList given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelList + * @throws IOException if the JSON string is invalid with respect to ModelList + */ + public static ModelList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelList.class); + } + + /** + * Convert an instance of ModelList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelReturn.java new file mode 100644 index 000000000000..ed6111f4da31 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -0,0 +1,275 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing reserved words + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelReturn { + public static final String SERIALIZED_NAME_RETURN = "return"; + @SerializedName(SERIALIZED_NAME_RETURN) + @javax.annotation.Nullable + private Integer _return; + + public ModelReturn() { + } + + public ModelReturn _return(@javax.annotation.Nullable Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + */ + @javax.annotation.Nullable + + public Integer getReturn() { + return _return; + } + + public void setReturn(@javax.annotation.Nullable Integer _return) { + this._return = _return; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelReturn instance itself + */ + public ModelReturn putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("return")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelReturn + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelReturn.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelReturn is not found in the empty JSON string", ModelReturn.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelReturn.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelReturn' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelReturn.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelReturn value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelReturn read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelReturn instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelReturn given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelReturn + * @throws IOException if the JSON string is invalid with respect to ModelReturn + */ + public static ModelReturn fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelReturn.class); + } + + /** + * Convert an instance of ModelReturn to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java new file mode 100644 index 000000000000..197be8d545f8 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java @@ -0,0 +1,311 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.ArrayAnyOf; +import org.openapitools.client.model.ArrayOneOf; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ModelWithOneOfAnyOfProperties + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ModelWithOneOfAnyOfProperties { + public static final String SERIALIZED_NAME_ONEOF_PROP = "oneof_prop"; + @SerializedName(SERIALIZED_NAME_ONEOF_PROP) + @javax.annotation.Nullable + private ArrayOneOf oneofProp; + + public static final String SERIALIZED_NAME_ANYOF_PROP = "anyof_prop"; + @SerializedName(SERIALIZED_NAME_ANYOF_PROP) + @javax.annotation.Nullable + private ArrayAnyOf anyofProp; + + public ModelWithOneOfAnyOfProperties() { + } + + public ModelWithOneOfAnyOfProperties oneofProp(@javax.annotation.Nullable ArrayOneOf oneofProp) { + this.oneofProp = oneofProp; + return this; + } + + /** + * Get oneofProp + * @return oneofProp + */ + @javax.annotation.Nullable + + public ArrayOneOf getOneofProp() { + return oneofProp; + } + + public void setOneofProp(@javax.annotation.Nullable ArrayOneOf oneofProp) { + this.oneofProp = oneofProp; + } + + + public ModelWithOneOfAnyOfProperties anyofProp(@javax.annotation.Nullable ArrayAnyOf anyofProp) { + this.anyofProp = anyofProp; + return this; + } + + /** + * Get anyofProp + * @return anyofProp + */ + @javax.annotation.Nullable + + public ArrayAnyOf getAnyofProp() { + return anyofProp; + } + + public void setAnyofProp(@javax.annotation.Nullable ArrayAnyOf anyofProp) { + this.anyofProp = anyofProp; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelWithOneOfAnyOfProperties instance itself + */ + public ModelWithOneOfAnyOfProperties putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelWithOneOfAnyOfProperties {\n"); + sb.append(" oneofProp: ").append(toIndentedString(oneofProp)).append("\n"); + sb.append(" anyofProp: ").append(toIndentedString(anyofProp)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("oneof_prop", "anyof_prop")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelWithOneOfAnyOfProperties + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelWithOneOfAnyOfProperties.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ModelWithOneOfAnyOfProperties is not found in the empty JSON string", ModelWithOneOfAnyOfProperties.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `oneof_prop` + if (jsonObj.get("oneof_prop") != null && !jsonObj.get("oneof_prop").isJsonNull()) { + ArrayOneOf.validateJsonElement(jsonObj.get("oneof_prop")); + } + // validate the optional field `anyof_prop` + if (jsonObj.get("anyof_prop") != null && !jsonObj.get("anyof_prop").isJsonNull()) { + ArrayAnyOf.validateJsonElement(jsonObj.get("anyof_prop")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelWithOneOfAnyOfProperties.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelWithOneOfAnyOfProperties' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelWithOneOfAnyOfProperties.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelWithOneOfAnyOfProperties value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelWithOneOfAnyOfProperties read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelWithOneOfAnyOfProperties instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelWithOneOfAnyOfProperties given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelWithOneOfAnyOfProperties + * @throws IOException if the JSON string is invalid with respect to ModelWithOneOfAnyOfProperties + */ + public static ModelWithOneOfAnyOfProperties fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelWithOneOfAnyOfProperties.class); + } + + /** + * Convert an instance of ModelWithOneOfAnyOfProperties to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Name.java new file mode 100644 index 000000000000..19178b6eb66d --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Name.java @@ -0,0 +1,356 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Model for testing model name same as property name + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Name { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private Integer name; + + public static final String SERIALIZED_NAME_SNAKE_CASE = "snake_case"; + @SerializedName(SERIALIZED_NAME_SNAKE_CASE) + @javax.annotation.Nullable + private Integer snakeCase; + + public static final String SERIALIZED_NAME_PROPERTY = "property"; + @SerializedName(SERIALIZED_NAME_PROPERTY) + @javax.annotation.Nullable + private String property; + + public static final String SERIALIZED_NAME_123NUMBER = "123Number"; + @SerializedName(SERIALIZED_NAME_123NUMBER) + @javax.annotation.Nullable + private Integer _123number; + + public Name() { + } + + public Name( + Integer snakeCase, + Integer _123number + ) { + this(); + this.snakeCase = snakeCase; + this._123number = _123number; + } + + public Name name(@javax.annotation.Nonnull Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public Integer getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull Integer name) { + this.name = name; + } + + + /** + * Get snakeCase + * @return snakeCase + */ + @javax.annotation.Nullable + + public Integer getSnakeCase() { + return snakeCase; + } + + + + public Name property(@javax.annotation.Nullable String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + */ + @javax.annotation.Nullable + + public String getProperty() { + return property; + } + + public void setProperty(@javax.annotation.Nullable String property) { + this.property = property; + } + + + /** + * Get _123number + * @return _123number + */ + @javax.annotation.Nullable + + public Integer get123number() { + return _123number; + } + + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Name instance itself + */ + public Name putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "snake_case", "property", "123Number")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Name + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Name.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Name is not found in the empty JSON string", Name.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Name.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("property") != null && !jsonObj.get("property").isJsonNull()) && !jsonObj.get("property").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `property` to be a primitive type in the JSON string but got `%s`", jsonObj.get("property").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Name.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Name' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Name.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Name value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Name read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Name instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Name given an JSON string + * + * @param jsonString JSON string + * @return An instance of Name + * @throws IOException if the JSON string is invalid with respect to Name + */ + public static Name fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Name.class); + } + + /** + * Convert an instance of Name to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java new file mode 100644 index 000000000000..8b2e830674f5 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java @@ -0,0 +1,290 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NestedArrayWithDefaultValues + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NestedArrayWithDefaultValues { + public static final String SERIALIZED_NAME_NESTED_ARRAY = "nestedArray"; + @SerializedName(SERIALIZED_NAME_NESTED_ARRAY) + @javax.annotation.Nullable + private List> nestedArray; + + public NestedArrayWithDefaultValues() { + } + + public NestedArrayWithDefaultValues nestedArray(@javax.annotation.Nullable List> nestedArray) { + this.nestedArray = nestedArray; + return this; + } + + public NestedArrayWithDefaultValues addNestedArrayItem(List nestedArrayItem) { + if (this.nestedArray == null) { + this.nestedArray = new ArrayList<>(); + } + this.nestedArray.add(nestedArrayItem); + return this; + } + + /** + * Get nestedArray + * @return nestedArray + */ + @javax.annotation.Nullable + + public List> getNestedArray() { + return nestedArray; + } + + public void setNestedArray(@javax.annotation.Nullable List> nestedArray) { + this.nestedArray = nestedArray; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NestedArrayWithDefaultValues instance itself + */ + public NestedArrayWithDefaultValues putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NestedArrayWithDefaultValues {\n"); + sb.append(" nestedArray: ").append(toIndentedString(nestedArray)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("nestedArray")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NestedArrayWithDefaultValues + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NestedArrayWithDefaultValues.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NestedArrayWithDefaultValues is not found in the empty JSON string", NestedArrayWithDefaultValues.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("nestedArray") != null && !jsonObj.get("nestedArray").isJsonNull() && !jsonObj.get("nestedArray").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `nestedArray` to be an array in the JSON string but got `%s`", jsonObj.get("nestedArray").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NestedArrayWithDefaultValues.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NestedArrayWithDefaultValues' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NestedArrayWithDefaultValues.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NestedArrayWithDefaultValues value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NestedArrayWithDefaultValues read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NestedArrayWithDefaultValues instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NestedArrayWithDefaultValues given an JSON string + * + * @param jsonString JSON string + * @return An instance of NestedArrayWithDefaultValues + * @throws IOException if the JSON string is invalid with respect to NestedArrayWithDefaultValues + */ + public static NestedArrayWithDefaultValues fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NestedArrayWithDefaultValues.class); + } + + /** + * Convert an instance of NestedArrayWithDefaultValues to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPet.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPet.java new file mode 100644 index 000000000000..bbf98a9a0625 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPet.java @@ -0,0 +1,611 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.NewPetCategoryInlineAllof; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NewPet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NewPet { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY_INLINE_ALLOF = "category_inline_allof"; + @SerializedName(SERIALIZED_NAME_CATEGORY_INLINE_ALLOF) + @javax.annotation.Nullable + private NewPetCategoryInlineAllof categoryInlineAllof; + + public static final String SERIALIZED_NAME_CATEGORY_ALL_OF_REF = "category_allOf_ref"; + @SerializedName(SERIALIZED_NAME_CATEGORY_ALL_OF_REF) + @javax.annotation.Nullable + private Category categoryAllOfRef; + + public static final String SERIALIZED_NAME_CATEGORY_ALL_OF_REF_DESCRIPTION = "category_allOf_ref_description"; + @SerializedName(SERIALIZED_NAME_CATEGORY_ALL_OF_REF_DESCRIPTION) + @javax.annotation.Nullable + private Category categoryAllOfRefDescription; + + public static final String SERIALIZED_NAME_CATEGORY_ALL_OF_REF_DESCRIPTION_READONLY = "category_allOf_ref_description_readonly"; + @SerializedName(SERIALIZED_NAME_CATEGORY_ALL_OF_REF_DESCRIPTION_READONLY) + @javax.annotation.Nullable + private Category categoryAllOfRefDescriptionReadonly; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public NewPet() { + } + + public NewPet( + Category categoryAllOfRefDescriptionReadonly + ) { + this(); + this.categoryAllOfRefDescriptionReadonly = categoryAllOfRefDescriptionReadonly; + } + + public NewPet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public NewPet categoryInlineAllof(@javax.annotation.Nullable NewPetCategoryInlineAllof categoryInlineAllof) { + this.categoryInlineAllof = categoryInlineAllof; + return this; + } + + /** + * Get categoryInlineAllof + * @return categoryInlineAllof + */ + @javax.annotation.Nullable + + public NewPetCategoryInlineAllof getCategoryInlineAllof() { + return categoryInlineAllof; + } + + public void setCategoryInlineAllof(@javax.annotation.Nullable NewPetCategoryInlineAllof categoryInlineAllof) { + this.categoryInlineAllof = categoryInlineAllof; + } + + + public NewPet categoryAllOfRef(@javax.annotation.Nullable Category categoryAllOfRef) { + this.categoryAllOfRef = categoryAllOfRef; + return this; + } + + /** + * Get categoryAllOfRef + * @return categoryAllOfRef + */ + @javax.annotation.Nullable + + public Category getCategoryAllOfRef() { + return categoryAllOfRef; + } + + public void setCategoryAllOfRef(@javax.annotation.Nullable Category categoryAllOfRef) { + this.categoryAllOfRef = categoryAllOfRef; + } + + + public NewPet categoryAllOfRefDescription(@javax.annotation.Nullable Category categoryAllOfRefDescription) { + this.categoryAllOfRefDescription = categoryAllOfRefDescription; + return this; + } + + /** + * Adding description to property using allOf + * @return categoryAllOfRefDescription + */ + @javax.annotation.Nullable + + public Category getCategoryAllOfRefDescription() { + return categoryAllOfRefDescription; + } + + public void setCategoryAllOfRefDescription(@javax.annotation.Nullable Category categoryAllOfRefDescription) { + this.categoryAllOfRefDescription = categoryAllOfRefDescription; + } + + + /** + * Adding description to readonly property using allOf + * @return categoryAllOfRefDescriptionReadonly + */ + @javax.annotation.Nullable + + public Category getCategoryAllOfRefDescriptionReadonly() { + return categoryAllOfRefDescriptionReadonly; + } + + + + public NewPet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public NewPet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public NewPet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public NewPet tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public NewPet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public NewPet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NewPet instance itself + */ + public NewPet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewPet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" categoryInlineAllof: ").append(toIndentedString(categoryInlineAllof)).append("\n"); + sb.append(" categoryAllOfRef: ").append(toIndentedString(categoryAllOfRef)).append("\n"); + sb.append(" categoryAllOfRefDescription: ").append(toIndentedString(categoryAllOfRefDescription)).append("\n"); + sb.append(" categoryAllOfRefDescriptionReadonly: ").append(toIndentedString(categoryAllOfRefDescriptionReadonly)).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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category_inline_allof", "category_allOf_ref", "category_allOf_ref_description", "category_allOf_ref_description_readonly", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NewPet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NewPet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NewPet is not found in the empty JSON string", NewPet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NewPet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category_inline_allof` + if (jsonObj.get("category_inline_allof") != null && !jsonObj.get("category_inline_allof").isJsonNull()) { + NewPetCategoryInlineAllof.validateJsonElement(jsonObj.get("category_inline_allof")); + } + // validate the optional field `category_allOf_ref` + if (jsonObj.get("category_allOf_ref") != null && !jsonObj.get("category_allOf_ref").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category_allOf_ref")); + } + // validate the optional field `category_allOf_ref_description` + if (jsonObj.get("category_allOf_ref_description") != null && !jsonObj.get("category_allOf_ref_description").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category_allOf_ref_description")); + } + // validate the optional field `category_allOf_ref_description_readonly` + if (jsonObj.get("category_allOf_ref_description_readonly") != null && !jsonObj.get("category_allOf_ref_description_readonly").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category_allOf_ref_description_readonly")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NewPet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NewPet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NewPet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NewPet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NewPet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NewPet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NewPet given an JSON string + * + * @param jsonString JSON string + * @return An instance of NewPet + * @throws IOException if the JSON string is invalid with respect to NewPet + */ + public static NewPet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NewPet.class); + } + + /** + * Convert an instance of NewPet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java new file mode 100644 index 000000000000..4dcea1f1c077 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java @@ -0,0 +1,342 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.NewPetCategoryInlineAllofAllOfCategoryTag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NewPetCategoryInlineAllof + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NewPetCategoryInlineAllof { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name = "default-name"; + + public static final String SERIALIZED_NAME_CATEGORY_TAG = "category_tag"; + @SerializedName(SERIALIZED_NAME_CATEGORY_TAG) + @javax.annotation.Nullable + private NewPetCategoryInlineAllofAllOfCategoryTag categoryTag; + + public NewPetCategoryInlineAllof() { + } + + public NewPetCategoryInlineAllof id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public NewPetCategoryInlineAllof name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public NewPetCategoryInlineAllof categoryTag(@javax.annotation.Nullable NewPetCategoryInlineAllofAllOfCategoryTag categoryTag) { + this.categoryTag = categoryTag; + return this; + } + + /** + * Get categoryTag + * @return categoryTag + */ + @javax.annotation.Nullable + + public NewPetCategoryInlineAllofAllOfCategoryTag getCategoryTag() { + return categoryTag; + } + + public void setCategoryTag(@javax.annotation.Nullable NewPetCategoryInlineAllofAllOfCategoryTag categoryTag) { + this.categoryTag = categoryTag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NewPetCategoryInlineAllof instance itself + */ + public NewPetCategoryInlineAllof putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewPetCategoryInlineAllof {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" categoryTag: ").append(toIndentedString(categoryTag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name", "category_tag")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NewPetCategoryInlineAllof + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NewPetCategoryInlineAllof.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NewPetCategoryInlineAllof is not found in the empty JSON string", NewPetCategoryInlineAllof.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NewPetCategoryInlineAllof.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `category_tag` + if (jsonObj.get("category_tag") != null && !jsonObj.get("category_tag").isJsonNull()) { + NewPetCategoryInlineAllofAllOfCategoryTag.validateJsonElement(jsonObj.get("category_tag")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NewPetCategoryInlineAllof.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NewPetCategoryInlineAllof' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NewPetCategoryInlineAllof.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NewPetCategoryInlineAllof value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NewPetCategoryInlineAllof read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NewPetCategoryInlineAllof instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NewPetCategoryInlineAllof given an JSON string + * + * @param jsonString JSON string + * @return An instance of NewPetCategoryInlineAllof + * @throws IOException if the JSON string is invalid with respect to NewPetCategoryInlineAllof + */ + public static NewPetCategoryInlineAllof fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NewPetCategoryInlineAllof.class); + } + + /** + * Convert an instance of NewPetCategoryInlineAllof to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java new file mode 100644 index 000000000000..8bcc47e723af --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java @@ -0,0 +1,304 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NewPetCategoryInlineAllofAllOfCategoryTag + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NewPetCategoryInlineAllofAllOfCategoryTag { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public NewPetCategoryInlineAllofAllOfCategoryTag() { + } + + public NewPetCategoryInlineAllofAllOfCategoryTag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public NewPetCategoryInlineAllofAllOfCategoryTag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NewPetCategoryInlineAllofAllOfCategoryTag instance itself + */ + public NewPetCategoryInlineAllofAllOfCategoryTag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewPetCategoryInlineAllofAllOfCategoryTag {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NewPetCategoryInlineAllofAllOfCategoryTag + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NewPetCategoryInlineAllofAllOfCategoryTag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NewPetCategoryInlineAllofAllOfCategoryTag is not found in the empty JSON string", NewPetCategoryInlineAllofAllOfCategoryTag.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NewPetCategoryInlineAllofAllOfCategoryTag.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NewPetCategoryInlineAllofAllOfCategoryTag' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NewPetCategoryInlineAllofAllOfCategoryTag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NewPetCategoryInlineAllofAllOfCategoryTag value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NewPetCategoryInlineAllofAllOfCategoryTag read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NewPetCategoryInlineAllofAllOfCategoryTag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NewPetCategoryInlineAllofAllOfCategoryTag given an JSON string + * + * @param jsonString JSON string + * @return An instance of NewPetCategoryInlineAllofAllOfCategoryTag + * @throws IOException if the JSON string is invalid with respect to NewPetCategoryInlineAllofAllOfCategoryTag + */ + public static NewPetCategoryInlineAllofAllOfCategoryTag fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NewPetCategoryInlineAllofAllOfCategoryTag.class); + } + + /** + * Convert an instance of NewPetCategoryInlineAllofAllOfCategoryTag to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableClass.java new file mode 100644 index 000000000000..9bf8affa9c56 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableClass.java @@ -0,0 +1,644 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NullableClass + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NullableClass { + public static final String SERIALIZED_NAME_INTEGER_PROP = "integer_prop"; + @SerializedName(SERIALIZED_NAME_INTEGER_PROP) + @javax.annotation.Nullable + private Integer integerProp; + + public static final String SERIALIZED_NAME_NUMBER_PROP = "number_prop"; + @SerializedName(SERIALIZED_NAME_NUMBER_PROP) + @javax.annotation.Nullable + private BigDecimal numberProp; + + public static final String SERIALIZED_NAME_BOOLEAN_PROP = "boolean_prop"; + @SerializedName(SERIALIZED_NAME_BOOLEAN_PROP) + @javax.annotation.Nullable + private Boolean booleanProp; + + public static final String SERIALIZED_NAME_STRING_PROP = "string_prop"; + @SerializedName(SERIALIZED_NAME_STRING_PROP) + @javax.annotation.Nullable + private String stringProp; + + public static final String SERIALIZED_NAME_DATE_PROP = "date_prop"; + @SerializedName(SERIALIZED_NAME_DATE_PROP) + @javax.annotation.Nullable + private LocalDate dateProp; + + public static final String SERIALIZED_NAME_DATETIME_PROP = "datetime_prop"; + @SerializedName(SERIALIZED_NAME_DATETIME_PROP) + @javax.annotation.Nullable + private OffsetDateTime datetimeProp; + + public static final String SERIALIZED_NAME_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + @SerializedName(SERIALIZED_NAME_ARRAY_NULLABLE_PROP) + @javax.annotation.Nullable + private List arrayNullableProp; + + public static final String SERIALIZED_NAME_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + @SerializedName(SERIALIZED_NAME_ARRAY_AND_ITEMS_NULLABLE_PROP) + @javax.annotation.Nullable + private List arrayAndItemsNullableProp; + + public static final String SERIALIZED_NAME_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + @SerializedName(SERIALIZED_NAME_ARRAY_ITEMS_NULLABLE) + @javax.annotation.Nullable + private List arrayItemsNullable = new ArrayList<>(); + + public static final String SERIALIZED_NAME_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + @SerializedName(SERIALIZED_NAME_OBJECT_NULLABLE_PROP) + @javax.annotation.Nullable + private Map objectNullableProp; + + public static final String SERIALIZED_NAME_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + @SerializedName(SERIALIZED_NAME_OBJECT_AND_ITEMS_NULLABLE_PROP) + @javax.annotation.Nullable + private Map objectAndItemsNullableProp; + + public static final String SERIALIZED_NAME_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + @SerializedName(SERIALIZED_NAME_OBJECT_ITEMS_NULLABLE) + @javax.annotation.Nullable + private Map objectItemsNullable = new HashMap<>(); + + public NullableClass() { + } + + public NullableClass integerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + return this; + } + + /** + * Get integerProp + * @return integerProp + */ + @javax.annotation.Nullable + + public Integer getIntegerProp() { + return integerProp; + } + + public void setIntegerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + } + + + public NullableClass numberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + return this; + } + + /** + * Get numberProp + * @return numberProp + */ + @javax.annotation.Nullable + + public BigDecimal getNumberProp() { + return numberProp; + } + + public void setNumberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + } + + + public NullableClass booleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + return this; + } + + /** + * Get booleanProp + * @return booleanProp + */ + @javax.annotation.Nullable + + public Boolean getBooleanProp() { + return booleanProp; + } + + public void setBooleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + } + + + public NullableClass stringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + return this; + } + + /** + * Get stringProp + * @return stringProp + */ + @javax.annotation.Nullable + + public String getStringProp() { + return stringProp; + } + + public void setStringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + } + + + public NullableClass dateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + return this; + } + + /** + * Get dateProp + * @return dateProp + */ + @javax.annotation.Nullable + + public LocalDate getDateProp() { + return dateProp; + } + + public void setDateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + } + + + public NullableClass datetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + */ + @javax.annotation.Nullable + + public OffsetDateTime getDatetimeProp() { + return datetimeProp; + } + + public void setDatetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + } + + + public NullableClass arrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + return this; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null) { + this.arrayNullableProp = new ArrayList<>(); + } + this.arrayNullableProp.add(arrayNullablePropItem); + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + */ + @javax.annotation.Nullable + + public List getArrayNullableProp() { + return arrayNullableProp; + } + + public void setArrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + + public NullableClass arrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null) { + this.arrayAndItemsNullableProp = new ArrayList<>(); + } + this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem); + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + */ + @javax.annotation.Nullable + + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp; + } + + public void setArrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + + public NullableClass arrayItemsNullable(@javax.annotation.Nullable 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 + + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + public void setArrayItemsNullable(@javax.annotation.Nullable List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + + public NullableClass objectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + return this; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null) { + this.objectNullableProp = new HashMap<>(); + } + this.objectNullableProp.put(key, objectNullablePropItem); + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + */ + @javax.annotation.Nullable + + public Map getObjectNullableProp() { + return objectNullableProp; + } + + public void setObjectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + + public NullableClass objectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null) { + this.objectAndItemsNullableProp = new HashMap<>(); + } + this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem); + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + */ + @javax.annotation.Nullable + + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp; + } + + public void setObjectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + + public NullableClass objectItemsNullable(@javax.annotation.Nullable 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 + + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + public void setObjectItemsNullable(@javax.annotation.Nullable Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableClass instance itself + */ + public NullableClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NullableClass + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NullableClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NullableClass is not found in the empty JSON string", NullableClass.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("string_prop") != null && !jsonObj.get("string_prop").isJsonNull()) && !jsonObj.get("string_prop").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `string_prop` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_prop").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_nullable_prop") != null && !jsonObj.get("array_nullable_prop").isJsonNull() && !jsonObj.get("array_nullable_prop").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_nullable_prop` to be an array in the JSON string but got `%s`", jsonObj.get("array_nullable_prop").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_and_items_nullable_prop") != null && !jsonObj.get("array_and_items_nullable_prop").isJsonNull() && !jsonObj.get("array_and_items_nullable_prop").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_and_items_nullable_prop` to be an array in the JSON string but got `%s`", jsonObj.get("array_and_items_nullable_prop").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("array_items_nullable") != null && !jsonObj.get("array_items_nullable").isJsonNull() && !jsonObj.get("array_items_nullable").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_items_nullable` to be an array in the JSON string but got `%s`", jsonObj.get("array_items_nullable").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NullableClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NullableClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NullableClass.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NullableClass value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NullableClass read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NullableClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NullableClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of NullableClass + * @throws IOException if the JSON string is invalid with respect to NullableClass + */ + public static NullableClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NullableClass.class); + } + + /** + * Convert an instance of NullableClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableEnum.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableEnum.java new file mode 100644 index 000000000000..b1bef9483125 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableEnum.java @@ -0,0 +1,78 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets NullableEnum + */ +@JsonAdapter(NullableEnum.Adapter.class) +public enum NullableEnum { + + CUSTOM("custom"); + + private String value; + + NullableEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static NullableEnum fromValue(String value) { + for (NullableEnum b : NullableEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final NullableEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public NullableEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return NullableEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + NullableEnum.fromValue(value); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java new file mode 100644 index 000000000000..266d75552634 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java @@ -0,0 +1,314 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Error response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NullableFieldsMapError { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nonnull + private String reason; + + public NullableFieldsMapError() { + } + + public NullableFieldsMapError status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + + public NullableFieldsMapError reason(@javax.annotation.Nonnull String reason) { + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + */ + @javax.annotation.Nonnull + + public String getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nonnull String reason) { + this.reason = reason; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsMapError instance itself + */ + public NullableFieldsMapError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableFieldsMapError {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("status", "reason")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status", "reason")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NullableFieldsMapError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NullableFieldsMapError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NullableFieldsMapError is not found in the empty JSON string", NullableFieldsMapError.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NullableFieldsMapError.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if (!jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NullableFieldsMapError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NullableFieldsMapError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NullableFieldsMapError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NullableFieldsMapError value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NullableFieldsMapError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NullableFieldsMapError instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NullableFieldsMapError given an JSON string + * + * @param jsonString JSON string + * @return An instance of NullableFieldsMapError + * @throws IOException if the JSON string is invalid with respect to NullableFieldsMapError + */ + public static NullableFieldsMapError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NullableFieldsMapError.class); + } + + /** + * Convert an instance of NullableFieldsMapError to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java new file mode 100644 index 000000000000..30f8f5d54842 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsMapError; +import org.openapitools.client.model.NullableFieldsMapSuccess; +import org.openapitools.client.model.NullableFieldsValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NullableFieldsMapResponse extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(NullableFieldsMapResponse.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NullableFieldsMapResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + List errorMessages = new ArrayList<>(); + int matches = 0; + + try { + // validate the JSON object to see if any exception is thrown + NullableFieldsMapSuccess.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for NullableFieldsMapSuccess failed with `%s`.", e.getMessage())); + } + + try { + // validate the JSON object to see if any exception is thrown + NullableFieldsMapError.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for NullableFieldsMapError failed with `%s`.", e.getMessage())); + } + + + if (matches == 0) { + throw new IOException(String.format("Failed deserialization for NullableFieldsMapResponse: no match found. %s", errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NullableFieldsMapResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NullableFieldsMapResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterNullableFieldsMapSuccess = gson.getDelegateAdapter(this, TypeToken.get(NullableFieldsMapSuccess.class)); + final TypeAdapter adapterNullableFieldsMapError = gson.getDelegateAdapter(this, TypeToken.get(NullableFieldsMapError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NullableFieldsMapResponse value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `NullableFieldsMapSuccess` + if (value.getActualInstance() instanceof NullableFieldsMapSuccess) { + JsonElement element = adapterNullableFieldsMapSuccess.toJsonTree((NullableFieldsMapSuccess)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `NullableFieldsMapError` + if (value.getActualInstance() instanceof NullableFieldsMapError) { + JsonElement element = adapterNullableFieldsMapError.toJsonTree((NullableFieldsMapError)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: NullableFieldsMapError, NullableFieldsMapSuccess"); + } + + @Override + public NullableFieldsMapResponse read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize NullableFieldsMapSuccess + try { + // validate the JSON object to see if any exception is thrown + NullableFieldsMapSuccess.validateJsonElement(jsonElement); + NullableFieldsMapResponse ret = new NullableFieldsMapResponse(); + ret.setActualInstance(adapterNullableFieldsMapSuccess.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for NullableFieldsMapSuccess failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'NullableFieldsMapSuccess'", e); + } + + // deserialize NullableFieldsMapError + try { + // validate the JSON object to see if any exception is thrown + NullableFieldsMapError.validateJsonElement(jsonElement); + NullableFieldsMapResponse ret = new NullableFieldsMapResponse(); + ret.setActualInstance(adapterNullableFieldsMapError.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for NullableFieldsMapError failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'NullableFieldsMapError'", e); + } + + + throw new IOException(String.format("Failed deserialization for NullableFieldsMapResponse: no match found. %s", errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public NullableFieldsMapResponse() { + super("anyOf", Boolean.FALSE); + } + + public NullableFieldsMapResponse(NullableFieldsMapError o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public NullableFieldsMapResponse(NullableFieldsMapSuccess o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("NullableFieldsMapError", NullableFieldsMapError.class); + schemas.put("NullableFieldsMapSuccess", NullableFieldsMapSuccess.class); + } + + @Override + public Map> getSchemas() { + return NullableFieldsMapResponse.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * NullableFieldsMapError, NullableFieldsMapSuccess + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(NullableFieldsMapError.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(NullableFieldsMapSuccess.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be NullableFieldsMapError, NullableFieldsMapSuccess"); + } + + /** + * Get the actual instance, which can be the following: + * NullableFieldsMapError, NullableFieldsMapSuccess + * + * @return The actual instance (NullableFieldsMapError, NullableFieldsMapSuccess) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `NullableFieldsMapError`. If the actual instance is not `NullableFieldsMapError`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `NullableFieldsMapError` + * @throws ClassCastException if the instance is not `NullableFieldsMapError` + */ + public NullableFieldsMapError getNullableFieldsMapError() throws ClassCastException { + return (NullableFieldsMapError)super.getActualInstance(); + } + + /** + * Get the actual instance of `NullableFieldsMapSuccess`. If the actual instance is not `NullableFieldsMapSuccess`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `NullableFieldsMapSuccess` + * @throws ClassCastException if the instance is not `NullableFieldsMapSuccess` + */ + public NullableFieldsMapSuccess getNullableFieldsMapSuccess() throws ClassCastException { + return (NullableFieldsMapSuccess)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java new file mode 100644 index 000000000000..b8d9e60408f4 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java @@ -0,0 +1,322 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Success response containing a map of objects with nullable fields + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NullableFieldsMapSuccess { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String SERIALIZED_NAME_POSITIONS = "positions"; + @SerializedName(SERIALIZED_NAME_POSITIONS) + @javax.annotation.Nonnull + private Map positions; + + public NullableFieldsMapSuccess() { + } + + public NullableFieldsMapSuccess status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + + public NullableFieldsMapSuccess positions(@javax.annotation.Nonnull Map positions) { + this.positions = positions; + return this; + } + + public NullableFieldsMapSuccess putPositionsItem(String key, NullableFieldsValue positionsItem) { + if (this.positions == null) { + this.positions = new HashMap<>(); + } + this.positions.put(key, positionsItem); + return this; + } + + /** + * Get positions + * @return positions + */ + @javax.annotation.Nonnull + + public Map getPositions() { + return positions; + } + + public void setPositions(@javax.annotation.Nonnull Map positions) { + this.positions = positions; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsMapSuccess instance itself + */ + public NullableFieldsMapSuccess putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableFieldsMapSuccess {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" positions: ").append(toIndentedString(positions)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("status", "positions")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status", "positions")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NullableFieldsMapSuccess + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NullableFieldsMapSuccess.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NullableFieldsMapSuccess is not found in the empty JSON string", NullableFieldsMapSuccess.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NullableFieldsMapSuccess.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NullableFieldsMapSuccess.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NullableFieldsMapSuccess' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NullableFieldsMapSuccess.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NullableFieldsMapSuccess value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NullableFieldsMapSuccess read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NullableFieldsMapSuccess instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NullableFieldsMapSuccess given an JSON string + * + * @param jsonString JSON string + * @return An instance of NullableFieldsMapSuccess + * @throws IOException if the JSON string is invalid with respect to NullableFieldsMapSuccess + */ + public static NullableFieldsMapSuccess fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NullableFieldsMapSuccess.class); + } + + /** + * Convert an instance of NullableFieldsMapSuccess to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsValue.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsValue.java new file mode 100644 index 000000000000..0ab19b8b6628 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsValue.java @@ -0,0 +1,314 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Object with required but nullable string fields + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NullableFieldsValue { + public static final String SERIALIZED_NAME_BEFORE = "before"; + @SerializedName(SERIALIZED_NAME_BEFORE) + @javax.annotation.Nullable + private String before; + + public static final String SERIALIZED_NAME_AFTER = "after"; + @SerializedName(SERIALIZED_NAME_AFTER) + @javax.annotation.Nullable + private String after; + + public NullableFieldsValue() { + } + + public NullableFieldsValue before(@javax.annotation.Nullable String before) { + this.before = before; + return this; + } + + /** + * Get before + * @return before + */ + @javax.annotation.Nullable + + public String getBefore() { + return before; + } + + public void setBefore(@javax.annotation.Nullable String before) { + this.before = before; + } + + + public NullableFieldsValue after(@javax.annotation.Nullable String after) { + this.after = after; + return this; + } + + /** + * Get after + * @return after + */ + @javax.annotation.Nullable + + public String getAfter() { + return after; + } + + public void setAfter(@javax.annotation.Nullable String after) { + this.after = after; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NullableFieldsValue instance itself + */ + public NullableFieldsValue putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableFieldsValue {\n"); + sb.append(" before: ").append(toIndentedString(before)).append("\n"); + sb.append(" after: ").append(toIndentedString(after)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("before", "after")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("before", "after")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NullableFieldsValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NullableFieldsValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NullableFieldsValue is not found in the empty JSON string", NullableFieldsValue.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NullableFieldsValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("before") != null && !jsonObj.get("before").isJsonNull()) && !jsonObj.get("before").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `before` to be a primitive type in the JSON string but got `%s`", jsonObj.get("before").toString())); + } + if ((jsonObj.get("after") != null && !jsonObj.get("after").isJsonNull()) && !jsonObj.get("after").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `after` to be a primitive type in the JSON string but got `%s`", jsonObj.get("after").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NullableFieldsValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NullableFieldsValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NullableFieldsValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NullableFieldsValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NullableFieldsValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NullableFieldsValue instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NullableFieldsValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of NullableFieldsValue + * @throws IOException if the JSON string is invalid with respect to NullableFieldsValue + */ + public static NullableFieldsValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NullableFieldsValue.class); + } + + /** + * Convert an instance of NullableFieldsValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableShape.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableShape.java new file mode 100644 index 000000000000..2a7a24b85b42 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableShape.java @@ -0,0 +1,306 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NullableShape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(NullableShape.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NullableShape + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("shapeType") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'shapeType' is missing."); + } + String discriminatorValue = jsonObject.get("shapeType").getAsString(); + if ("Quadrilateral".equals(discriminatorValue)) { + Quadrilateral.validateJsonElement(jsonElement); + return; + } + if ("Triangle".equals(discriminatorValue)) { + Triangle.validateJsonElement(jsonElement); + return; + } + // deserialize Triangle + try { + // validate the JSON object to see if any exception is thrown + Triangle.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Triangle failed with `%s`.", e.getMessage())); + } + + // deserialize Quadrilateral + try { + // validate the JSON object to see if any exception is thrown + Quadrilateral.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Quadrilateral failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for NullableShape: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NullableShape.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NullableShape' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterTriangle = gson.getDelegateAdapter(this, TypeToken.get(Triangle.class)); + final TypeAdapter adapterQuadrilateral = gson.getDelegateAdapter(this, TypeToken.get(Quadrilateral.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NullableShape value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Triangle` + if (value.getActualInstance() instanceof Triangle) { + JsonElement element = adapterTriangle.toJsonTree((Triangle)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `Quadrilateral` + if (value.getActualInstance() instanceof Quadrilateral) { + JsonElement element = adapterQuadrilateral.toJsonTree((Quadrilateral)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Quadrilateral, Triangle"); + } + + @Override + public NullableShape read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("shapeType") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'shapeType' is missing."); + } + String discriminatorValue = jsonObject.get("shapeType").getAsString(); + if ("Quadrilateral".equals(discriminatorValue)) { + deserialized = adapterQuadrilateral.fromJsonTree(jsonElement); + NullableShape ret = new NullableShape(); + ret.setActualInstance(deserialized); + return ret; + } + if ("Triangle".equals(discriminatorValue)) { + deserialized = adapterTriangle.fromJsonTree(jsonElement); + NullableShape ret = new NullableShape(); + ret.setActualInstance(deserialized); + return ret; + } + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize Triangle + try { + // validate the JSON object to see if any exception is thrown + Triangle.validateJsonElement(jsonElement); + actualAdapter = adapterTriangle; + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Triangle failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + // deserialize Quadrilateral + try { + // validate the JSON object to see if any exception is thrown + Quadrilateral.validateJsonElement(jsonElement); + actualAdapter = adapterQuadrilateral; + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Quadrilateral failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + if (match == 1) { + NullableShape ret = new NullableShape(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for NullableShape: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final 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", Quadrilateral.class); + schemas.put("Triangle", Triangle.class); + } + + @Override + public Map> getSchemas() { + return NullableShape.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NumberOnly.java new file mode 100644 index 000000000000..794d7e9d7adb --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -0,0 +1,276 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * NumberOnly + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class NumberOnly { + public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; + @SerializedName(SERIALIZED_NAME_JUST_NUMBER) + @javax.annotation.Nullable + private BigDecimal justNumber; + + public NumberOnly() { + } + + public NumberOnly justNumber(@javax.annotation.Nullable BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + */ + @javax.annotation.Nullable + + public BigDecimal getJustNumber() { + return justNumber; + } + + public void setJustNumber(@javax.annotation.Nullable BigDecimal justNumber) { + this.justNumber = justNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NumberOnly instance itself + */ + public NumberOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("JustNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NumberOnly + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NumberOnly is not found in the empty JSON string", NumberOnly.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NumberOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NumberOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NumberOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NumberOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NumberOnly read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NumberOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NumberOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of NumberOnly + * @throws IOException if the JSON string is invalid with respect to NumberOnly + */ + public static NumberOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NumberOnly.class); + } + + /** + * Convert an instance of NumberOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java new file mode 100644 index 000000000000..0fb863c58247 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -0,0 +1,392 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.DeprecatedObject; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ObjectWithDeprecatedFields + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ObjectWithDeprecatedFields { + public static final String SERIALIZED_NAME_UUID = "uuid"; + @SerializedName(SERIALIZED_NAME_UUID) + @javax.annotation.Nullable + private String uuid; + + public static final String SERIALIZED_NAME_ID = "id"; + @Deprecated + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private BigDecimal id; + + public static final String SERIALIZED_NAME_DEPRECATED_REF = "deprecatedRef"; + @Deprecated + @SerializedName(SERIALIZED_NAME_DEPRECATED_REF) + @javax.annotation.Nullable + private DeprecatedObject deprecatedRef; + + public static final String SERIALIZED_NAME_BARS = "bars"; + @Deprecated + @SerializedName(SERIALIZED_NAME_BARS) + @javax.annotation.Nullable + private List bars = new ArrayList<>(); + + public ObjectWithDeprecatedFields() { + } + + public ObjectWithDeprecatedFields uuid(@javax.annotation.Nullable String uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + */ + @javax.annotation.Nullable + + public String getUuid() { + return uuid; + } + + public void setUuid(@javax.annotation.Nullable String uuid) { + this.uuid = uuid; + } + + + @Deprecated + public ObjectWithDeprecatedFields id(@javax.annotation.Nullable BigDecimal id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + + public BigDecimal getId() { + return id; + } + + @Deprecated + public void setId(@javax.annotation.Nullable BigDecimal id) { + this.id = id; + } + + + @Deprecated + public ObjectWithDeprecatedFields deprecatedRef(@javax.annotation.Nullable DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return this; + } + + /** + * Get deprecatedRef + * @return deprecatedRef + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + + public DeprecatedObject getDeprecatedRef() { + return deprecatedRef; + } + + @Deprecated + public void setDeprecatedRef(@javax.annotation.Nullable DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + } + + + @Deprecated + public ObjectWithDeprecatedFields bars(@javax.annotation.Nullable List bars) { + this.bars = bars; + return this; + } + + public ObjectWithDeprecatedFields addBarsItem(String barsItem) { + if (this.bars == null) { + this.bars = new ArrayList<>(); + } + this.bars.add(barsItem); + return this; + } + + /** + * Get bars + * @return bars + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + + public List getBars() { + return bars; + } + + @Deprecated + public void setBars(@javax.annotation.Nullable List bars) { + this.bars = bars; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ObjectWithDeprecatedFields instance itself + */ + public ObjectWithDeprecatedFields putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObjectWithDeprecatedFields {\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" deprecatedRef: ").append(toIndentedString(deprecatedRef)).append("\n"); + sb.append(" bars: ").append(toIndentedString(bars)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("uuid", "id", "deprecatedRef", "bars")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ObjectWithDeprecatedFields + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ObjectWithDeprecatedFields.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ObjectWithDeprecatedFields is not found in the empty JSON string", ObjectWithDeprecatedFields.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } + // validate the optional field `deprecatedRef` + if (jsonObj.get("deprecatedRef") != null && !jsonObj.get("deprecatedRef").isJsonNull()) { + DeprecatedObject.validateJsonElement(jsonObj.get("deprecatedRef")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("bars") != null && !jsonObj.get("bars").isJsonNull() && !jsonObj.get("bars").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `bars` to be an array in the JSON string but got `%s`", jsonObj.get("bars").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ObjectWithDeprecatedFields.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ObjectWithDeprecatedFields' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ObjectWithDeprecatedFields.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ObjectWithDeprecatedFields value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ObjectWithDeprecatedFields read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ObjectWithDeprecatedFields instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ObjectWithDeprecatedFields given an JSON string + * + * @param jsonString JSON string + * @return An instance of ObjectWithDeprecatedFields + * @throws IOException if the JSON string is invalid with respect to ObjectWithDeprecatedFields + */ + public static ObjectWithDeprecatedFields fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ObjectWithDeprecatedFields.class); + } + + /** + * Convert an instance of ObjectWithDeprecatedFields to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..de31104d402c --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,467 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Order + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Order { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_PET_ID = "petId"; + @SerializedName(SERIALIZED_NAME_PET_ID) + @javax.annotation.Nullable + private Long petId; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; + @SerializedName(SERIALIZED_NAME_SHIP_DATE) + @javax.annotation.Nullable + private OffsetDateTime shipDate; + + /** + * Order Status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_COMPLETE = "complete"; + @SerializedName(SERIALIZED_NAME_COMPLETE) + @javax.annotation.Nullable + private Boolean complete = false; + + public Order() { + } + + public Order id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Order petId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + */ + @javax.annotation.Nullable + + public Long getPetId() { + return petId; + } + + public void setPetId(@javax.annotation.Nullable Long petId) { + this.petId = petId; + } + + + public Order quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + */ + @javax.annotation.Nullable + + public OffsetDateTime getShipDate() { + return shipDate; + } + + public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Order complete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + */ + @javax.annotation.Nullable + + public Boolean getComplete() { + return complete; + } + + public void setComplete(@javax.annotation.Nullable Boolean complete) { + this.complete = complete; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Order instance itself + */ + public Order putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "petId", "quantity", "shipDate", "status", "complete")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Order + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Order.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Order' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Order.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Order value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Order read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Order instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Order given an JSON string + * + * @param jsonString JSON string + * @return An instance of Order + * @throws IOException if the JSON string is invalid with respect to Order + */ + public static Order fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Order.class); + } + + /** + * Convert an instance of Order to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterComposite.java new file mode 100644 index 000000000000..4d694ed47ef7 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -0,0 +1,331 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * OuterComposite + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class OuterComposite { + public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; + @SerializedName(SERIALIZED_NAME_MY_NUMBER) + @javax.annotation.Nullable + private BigDecimal myNumber; + + public static final String SERIALIZED_NAME_MY_STRING = "my_string"; + @SerializedName(SERIALIZED_NAME_MY_STRING) + @javax.annotation.Nullable + private String myString; + + public static final String SERIALIZED_NAME_MY_BOOLEAN = "my_boolean"; + @SerializedName(SERIALIZED_NAME_MY_BOOLEAN) + @javax.annotation.Nullable + private Boolean myBoolean; + + public OuterComposite() { + } + + public OuterComposite myNumber(@javax.annotation.Nullable BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + */ + @javax.annotation.Nullable + + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(@javax.annotation.Nullable BigDecimal myNumber) { + this.myNumber = myNumber; + } + + + public OuterComposite myString(@javax.annotation.Nullable String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + */ + @javax.annotation.Nullable + + public String getMyString() { + return myString; + } + + public void setMyString(@javax.annotation.Nullable String myString) { + this.myString = myString; + } + + + public OuterComposite myBoolean(@javax.annotation.Nullable Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + */ + @javax.annotation.Nullable + + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(@javax.annotation.Nullable Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OuterComposite instance itself + */ + public OuterComposite putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("my_number", "my_string", "my_boolean")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OuterComposite + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OuterComposite.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in OuterComposite is not found in the empty JSON string", OuterComposite.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("my_string") != null && !jsonObj.get("my_string").isJsonNull()) && !jsonObj.get("my_string").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `my_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("my_string").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OuterComposite.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OuterComposite' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OuterComposite.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OuterComposite value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OuterComposite read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OuterComposite instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OuterComposite given an JSON string + * + * @param jsonString JSON string + * @return An instance of OuterComposite + * @throws IOException if the JSON string is invalid with respect to OuterComposite + */ + public static OuterComposite fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OuterComposite.class); + } + + /** + * Convert an instance of OuterComposite to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnum.java new file mode 100644 index 000000000000..79d620f420f8 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -0,0 +1,86 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets OuterEnum + */ +@JsonAdapter(OuterEnum.Adapter.class) +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"), + + LOWER_CASE_S("s"), + + UPPER_CASE_S("S"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OuterEnum fromValue(String value) { + for (OuterEnum b : OuterEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OuterEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OuterEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OuterEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OuterEnum.fromValue(value); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..b5cdb3cb1965 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java @@ -0,0 +1,82 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets OuterEnumDefaultValue + */ +@JsonAdapter(OuterEnumDefaultValue.Adapter.class) +public enum OuterEnumDefaultValue { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnumDefaultValue(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OuterEnumDefaultValue fromValue(String value) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OuterEnumDefaultValue enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OuterEnumDefaultValue read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OuterEnumDefaultValue.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OuterEnumDefaultValue.fromValue(value); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnumInteger.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnumInteger.java new file mode 100644 index 000000000000..94902a4b33d5 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnumInteger.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.model; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets OuterEnumInteger + */ +@Deprecated +@JsonAdapter(OuterEnumInteger.Adapter.class) +public enum OuterEnumInteger { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumInteger(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OuterEnumInteger fromValue(Integer value) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OuterEnumInteger enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OuterEnumInteger read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return OuterEnumInteger.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + OuterEnumInteger.fromValue(value); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..2d038dc5aedd --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java @@ -0,0 +1,82 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets OuterEnumIntegerDefaultValue + */ +@JsonAdapter(OuterEnumIntegerDefaultValue.Adapter.class) +public enum OuterEnumIntegerDefaultValue { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumIntegerDefaultValue(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OuterEnumIntegerDefaultValue fromValue(Integer value) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OuterEnumIntegerDefaultValue enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OuterEnumIntegerDefaultValue read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return OuterEnumIntegerDefaultValue.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + OuterEnumIntegerDefaultValue.fromValue(value); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ParentPet.java new file mode 100644 index 000000000000..322f93d39aa8 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ParentPet.java @@ -0,0 +1,258 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.GrandparentAnimal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ParentPet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ParentPet extends GrandparentAnimal { + public ParentPet() { + this.petType = this.getClass().getSimpleName(); + } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ParentPet instance itself + */ + public ParentPet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParentPet {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(0); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("pet_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ParentPet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ParentPet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ParentPet is not found in the empty JSON string", ParentPet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ParentPet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ParentPet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ParentPet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ParentPet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ParentPet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ParentPet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ParentPet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ParentPet given an JSON string + * + * @param jsonString JSON string + * @return An instance of ParentPet + * @throws IOException if the JSON string is invalid with respect to ParentPet + */ + public static ParentPet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ParentPet.class); + } + + /** + * Convert an instance of ParentPet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..ba7138f376da --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,521 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Pet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pet { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public Pet() { + } + + public Pet id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Pet category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public Pet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(@javax.annotation.Nullable 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 + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public Pet status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Pet instance itself + */ + public Pet putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Pet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Pet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Pet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Pet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Pet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Pet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Pet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Pet instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Pet given an JSON string + * + * @param jsonString JSON string + * @return An instance of Pet + * @throws IOException if the JSON string is invalid with respect to Pet + */ + public static Pet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Pet.class); + } + + /** + * Convert an instance of Pet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetComposition.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetComposition.java new file mode 100644 index 000000000000..fd59b7e23890 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetComposition.java @@ -0,0 +1,521 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetComposition + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class PetComposition { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetComposition() { + } + + public PetComposition id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetComposition category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetComposition name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PetComposition photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetComposition addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetComposition tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetComposition addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public PetComposition status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetComposition instance itself + */ + public PetComposition putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetComposition {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PetComposition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PetComposition.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in PetComposition is not found in the empty JSON string", PetComposition.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PetComposition.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PetComposition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PetComposition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PetComposition.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PetComposition value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PetComposition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PetComposition instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PetComposition given an JSON string + * + * @param jsonString JSON string + * @return An instance of PetComposition + * @throws IOException if the JSON string is invalid with respect to PetComposition + */ + public static PetComposition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PetComposition.class); + } + + /** + * Convert an instance of PetComposition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetRef.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetRef.java new file mode 100644 index 000000000000..eb3cf43fff4a --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetRef.java @@ -0,0 +1,521 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetRef + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class PetRef { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetRef() { + } + + public PetRef id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetRef category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetRef name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PetRef photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetRef addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetRef tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetRef addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public PetRef status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetRef instance itself + */ + public PetRef putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetRef {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PetRef + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PetRef.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in PetRef is not found in the empty JSON string", PetRef.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PetRef.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PetRef.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PetRef' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PetRef.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PetRef value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PetRef read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PetRef instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PetRef given an JSON string + * + * @param jsonString JSON string + * @return An instance of PetRef + * @throws IOException if the JSON string is invalid with respect to PetRef + */ + public static PetRef fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PetRef.class); + } + + /** + * Convert an instance of PetRef to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetUsingAllOf.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetUsingAllOf.java new file mode 100644 index 000000000000..53276b7d0a48 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetUsingAllOf.java @@ -0,0 +1,521 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetUsingAllOf + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class PetUsingAllOf { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetUsingAllOf() { + } + + public PetUsingAllOf id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetUsingAllOf category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * multi line description 2nd line last line + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetUsingAllOf name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PetUsingAllOf photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetUsingAllOf addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetUsingAllOf tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PetUsingAllOf addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public PetUsingAllOf status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetUsingAllOf instance itself + */ + public PetUsingAllOf putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetUsingAllOf {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PetUsingAllOf + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PetUsingAllOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in PetUsingAllOf is not found in the empty JSON string", PetUsingAllOf.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PetUsingAllOf.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + }; + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PetUsingAllOf.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PetUsingAllOf' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PetUsingAllOf.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PetUsingAllOf value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PetUsingAllOf read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PetUsingAllOf instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PetUsingAllOf given an JSON string + * + * @param jsonString JSON string + * @return An instance of PetUsingAllOf + * @throws IOException if the JSON string is invalid with respect to PetUsingAllOf + */ + public static PetUsingAllOf fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PetUsingAllOf.class); + } + + /** + * Convert an instance of PetUsingAllOf to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java new file mode 100644 index 000000000000..df3415785ffe --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java @@ -0,0 +1,517 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PetWithRequiredTags + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class PetWithRequiredTags { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; + @SerializedName(SERIALIZED_NAME_PHOTO_URLS) + @javax.annotation.Nonnull + private List photoUrls = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nonnull + private List tags = new ArrayList<>(); + + /** + * pet status in the store + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public PetWithRequiredTags() { + } + + public PetWithRequiredTags id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public PetWithRequiredTags category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PetWithRequiredTags name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PetWithRequiredTags photoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public PetWithRequiredTags addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new ArrayList<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + */ + @javax.annotation.Nonnull + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { + this.photoUrls = photoUrls; + } + + + public PetWithRequiredTags tags(@javax.annotation.Nonnull List tags) { + this.tags = tags; + return this; + } + + public PetWithRequiredTags addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nonnull + + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nonnull List tags) { + this.tags = tags; + } + + + public PetWithRequiredTags status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + */ + @javax.annotation.Nullable + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PetWithRequiredTags instance itself + */ + public PetWithRequiredTags putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PetWithRequiredTags {\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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls", "tags")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PetWithRequiredTags + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PetWithRequiredTags.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in PetWithRequiredTags is not found in the empty JSON string", PetWithRequiredTags.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PetWithRequiredTags.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("photoUrls") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("photoUrls").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); + } + if (jsonObj.get("tags") != null) { + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + // validate the required field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonElement(jsonArraytags.get(i)); + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PetWithRequiredTags.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PetWithRequiredTags' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PetWithRequiredTags.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PetWithRequiredTags value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PetWithRequiredTags read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PetWithRequiredTags instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PetWithRequiredTags given an JSON string + * + * @param jsonString JSON string + * @return An instance of PetWithRequiredTags + * @throws IOException if the JSON string is invalid with respect to PetWithRequiredTags + */ + public static PetWithRequiredTags fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PetWithRequiredTags.class); + } + + /** + * Convert an instance of PetWithRequiredTags to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pig.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pig.java new file mode 100644 index 000000000000..57c47baa05e9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pig.java @@ -0,0 +1,301 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.DanishPig; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Pig extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Pig.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Pig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("className") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'className' is missing."); + } + String discriminatorValue = jsonObject.get("className").getAsString(); + if ("BasquePig".equals(discriminatorValue)) { + BasquePig.validateJsonElement(jsonElement); + return; + } + if ("DanishPig".equals(discriminatorValue)) { + DanishPig.validateJsonElement(jsonElement); + return; + } + // deserialize BasquePig + try { + // validate the JSON object to see if any exception is thrown + BasquePig.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for BasquePig failed with `%s`.", e.getMessage())); + } + + // deserialize DanishPig + try { + // validate the JSON object to see if any exception is thrown + DanishPig.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for DanishPig failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for Pig: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Pig.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Pig' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterBasquePig = gson.getDelegateAdapter(this, TypeToken.get(BasquePig.class)); + final TypeAdapter adapterDanishPig = gson.getDelegateAdapter(this, TypeToken.get(DanishPig.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Pig value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `BasquePig` + if (value.getActualInstance() instanceof BasquePig) { + JsonElement element = adapterBasquePig.toJsonTree((BasquePig)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `DanishPig` + if (value.getActualInstance() instanceof DanishPig) { + JsonElement element = adapterDanishPig.toJsonTree((DanishPig)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: BasquePig, DanishPig"); + } + + @Override + public Pig read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("className") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'className' is missing."); + } + String discriminatorValue = jsonObject.get("className").getAsString(); + if ("BasquePig".equals(discriminatorValue)) { + deserialized = adapterBasquePig.fromJsonTree(jsonElement); + Pig ret = new Pig(); + ret.setActualInstance(deserialized); + return ret; + } + if ("DanishPig".equals(discriminatorValue)) { + deserialized = adapterDanishPig.fromJsonTree(jsonElement); + Pig ret = new Pig(); + ret.setActualInstance(deserialized); + return ret; + } + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize BasquePig + try { + // validate the JSON object to see if any exception is thrown + BasquePig.validateJsonElement(jsonElement); + actualAdapter = adapterBasquePig; + match++; + log.log(Level.FINER, "Input data matches schema 'BasquePig'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for BasquePig failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'BasquePig'", e); + } + + // deserialize DanishPig + try { + // validate the JSON object to see if any exception is thrown + DanishPig.validateJsonElement(jsonElement); + actualAdapter = adapterDanishPig; + match++; + log.log(Level.FINER, "Input data matches schema 'DanishPig'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for DanishPig failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'DanishPig'", e); + } + + if (match == 1) { + Pig ret = new Pig(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for Pig: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final 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", BasquePig.class); + schemas.put("DanishPig", DanishPig.class); + } + + @Override + public Map> getSchemas() { + return Pig.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * BasquePig, DanishPig + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(BasquePig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(DanishPig.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BasquePig, DanishPig"); + } + + /** + * Get the actual instance, which can be the following: + * BasquePig, DanishPig + * + * @return The actual instance (BasquePig, DanishPig) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BasquePig`. If the actual instance is not `BasquePig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BasquePig` + * @throws ClassCastException if the instance is not `BasquePig` + */ + public BasquePig getBasquePig() throws ClassCastException { + return (BasquePig)super.getActualInstance(); + } + + /** + * Get the actual instance of `DanishPig`. If the actual instance is not `DanishPig`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `DanishPig` + * @throws ClassCastException if the instance is not `DanishPig` + */ + public DanishPig getDanishPig() throws ClassCastException { + return (DanishPig)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PropertyNameCollision.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PropertyNameCollision.java new file mode 100644 index 000000000000..2a817ea0c20f --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PropertyNameCollision.java @@ -0,0 +1,336 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * PropertyNameCollision + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class PropertyNameCollision { + public static final String SERIALIZED_NAME_UNDERSCORE_TYPE = "_type"; + @SerializedName(SERIALIZED_NAME_UNDERSCORE_TYPE) + @javax.annotation.Nullable + private String underscoreType; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_TYPE_WITH_UNDERSCORE = "type_"; + @SerializedName(SERIALIZED_NAME_TYPE_WITH_UNDERSCORE) + @javax.annotation.Nullable + private String typeWithUnderscore; + + public PropertyNameCollision() { + } + + public PropertyNameCollision underscoreType(@javax.annotation.Nullable String underscoreType) { + this.underscoreType = underscoreType; + return this; + } + + /** + * Get underscoreType + * @return underscoreType + */ + @javax.annotation.Nullable + + public String getUnderscoreType() { + return underscoreType; + } + + public void setUnderscoreType(@javax.annotation.Nullable String underscoreType) { + this.underscoreType = underscoreType; + } + + + public PropertyNameCollision type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public PropertyNameCollision typeWithUnderscore(@javax.annotation.Nullable String typeWithUnderscore) { + this.typeWithUnderscore = typeWithUnderscore; + return this; + } + + /** + * Get typeWithUnderscore + * @return typeWithUnderscore + */ + @javax.annotation.Nullable + + public String getTypeWithUnderscore() { + return typeWithUnderscore; + } + + public void setTypeWithUnderscore(@javax.annotation.Nullable String typeWithUnderscore) { + this.typeWithUnderscore = typeWithUnderscore; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PropertyNameCollision instance itself + */ + public PropertyNameCollision putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PropertyNameCollision {\n"); + sb.append(" underscoreType: ").append(toIndentedString(underscoreType)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" typeWithUnderscore: ").append(toIndentedString(typeWithUnderscore)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("_type", "type", "type_")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PropertyNameCollision + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PropertyNameCollision.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in PropertyNameCollision is not found in the empty JSON string", PropertyNameCollision.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("_type") != null && !jsonObj.get("_type").isJsonNull()) && !jsonObj.get("_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_type").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("type_") != null && !jsonObj.get("type_").isJsonNull()) && !jsonObj.get("type_").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type_` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type_").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PropertyNameCollision.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PropertyNameCollision' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PropertyNameCollision.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PropertyNameCollision value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PropertyNameCollision read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PropertyNameCollision instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PropertyNameCollision given an JSON string + * + * @param jsonString JSON string + * @return An instance of PropertyNameCollision + * @throws IOException if the JSON string is invalid with respect to PropertyNameCollision + */ + public static PropertyNameCollision fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PropertyNameCollision.class); + } + + /** + * Convert an instance of PropertyNameCollision to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Quadrilateral.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Quadrilateral.java new file mode 100644 index 000000000000..a41c62e412e1 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Quadrilateral.java @@ -0,0 +1,301 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Quadrilateral extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Quadrilateral.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Quadrilateral + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("quadrilateralType") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'quadrilateralType' is missing."); + } + String discriminatorValue = jsonObject.get("quadrilateralType").getAsString(); + if ("ComplexQuadrilateral".equals(discriminatorValue)) { + ComplexQuadrilateral.validateJsonElement(jsonElement); + return; + } + if ("SimpleQuadrilateral".equals(discriminatorValue)) { + SimpleQuadrilateral.validateJsonElement(jsonElement); + return; + } + // deserialize SimpleQuadrilateral + try { + // validate the JSON object to see if any exception is thrown + SimpleQuadrilateral.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SimpleQuadrilateral failed with `%s`.", e.getMessage())); + } + + // deserialize ComplexQuadrilateral + try { + // validate the JSON object to see if any exception is thrown + ComplexQuadrilateral.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ComplexQuadrilateral failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for Quadrilateral: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Quadrilateral.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Quadrilateral' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterSimpleQuadrilateral = gson.getDelegateAdapter(this, TypeToken.get(SimpleQuadrilateral.class)); + final TypeAdapter adapterComplexQuadrilateral = gson.getDelegateAdapter(this, TypeToken.get(ComplexQuadrilateral.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Quadrilateral value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `SimpleQuadrilateral` + if (value.getActualInstance() instanceof SimpleQuadrilateral) { + JsonElement element = adapterSimpleQuadrilateral.toJsonTree((SimpleQuadrilateral)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `ComplexQuadrilateral` + if (value.getActualInstance() instanceof ComplexQuadrilateral) { + JsonElement element = adapterComplexQuadrilateral.toJsonTree((ComplexQuadrilateral)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: ComplexQuadrilateral, SimpleQuadrilateral"); + } + + @Override + public Quadrilateral read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("quadrilateralType") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'quadrilateralType' is missing."); + } + String discriminatorValue = jsonObject.get("quadrilateralType").getAsString(); + if ("ComplexQuadrilateral".equals(discriminatorValue)) { + deserialized = adapterComplexQuadrilateral.fromJsonTree(jsonElement); + Quadrilateral ret = new Quadrilateral(); + ret.setActualInstance(deserialized); + return ret; + } + if ("SimpleQuadrilateral".equals(discriminatorValue)) { + deserialized = adapterSimpleQuadrilateral.fromJsonTree(jsonElement); + Quadrilateral ret = new Quadrilateral(); + ret.setActualInstance(deserialized); + return ret; + } + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize SimpleQuadrilateral + try { + // validate the JSON object to see if any exception is thrown + SimpleQuadrilateral.validateJsonElement(jsonElement); + actualAdapter = adapterSimpleQuadrilateral; + match++; + log.log(Level.FINER, "Input data matches schema 'SimpleQuadrilateral'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SimpleQuadrilateral failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SimpleQuadrilateral'", e); + } + + // deserialize ComplexQuadrilateral + try { + // validate the JSON object to see if any exception is thrown + ComplexQuadrilateral.validateJsonElement(jsonElement); + actualAdapter = adapterComplexQuadrilateral; + match++; + log.log(Level.FINER, "Input data matches schema 'ComplexQuadrilateral'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ComplexQuadrilateral failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ComplexQuadrilateral'", e); + } + + if (match == 1) { + Quadrilateral ret = new Quadrilateral(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for Quadrilateral: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final 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", ComplexQuadrilateral.class); + schemas.put("SimpleQuadrilateral", SimpleQuadrilateral.class); + } + + @Override + public Map> getSchemas() { + return Quadrilateral.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * ComplexQuadrilateral, SimpleQuadrilateral + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ComplexQuadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(SimpleQuadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be ComplexQuadrilateral, SimpleQuadrilateral"); + } + + /** + * Get the actual instance, which can be the following: + * ComplexQuadrilateral, SimpleQuadrilateral + * + * @return The actual instance (ComplexQuadrilateral, SimpleQuadrilateral) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ComplexQuadrilateral`. If the actual instance is not `ComplexQuadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ComplexQuadrilateral` + * @throws ClassCastException if the instance is not `ComplexQuadrilateral` + */ + public ComplexQuadrilateral getComplexQuadrilateral() throws ClassCastException { + return (ComplexQuadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `SimpleQuadrilateral`. If the actual instance is not `SimpleQuadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SimpleQuadrilateral` + * @throws ClassCastException if the instance is not `SimpleQuadrilateral` + */ + public SimpleQuadrilateral getSimpleQuadrilateral() throws ClassCastException { + return (SimpleQuadrilateral)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java new file mode 100644 index 000000000000..5877de915e54 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -0,0 +1,285 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * QuadrilateralInterface + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class QuadrilateralInterface { + public static final String SERIALIZED_NAME_QUADRILATERAL_TYPE = "quadrilateralType"; + @SerializedName(SERIALIZED_NAME_QUADRILATERAL_TYPE) + @javax.annotation.Nonnull + private String quadrilateralType; + + public QuadrilateralInterface() { + } + + public QuadrilateralInterface quadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + */ + @javax.annotation.Nonnull + + public String getQuadrilateralType() { + return quadrilateralType; + } + + public void setQuadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the QuadrilateralInterface instance itself + */ + public QuadrilateralInterface putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuadrilateralInterface {\n"); + sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("quadrilateralType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("quadrilateralType")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QuadrilateralInterface + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QuadrilateralInterface.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in QuadrilateralInterface is not found in the empty JSON string", QuadrilateralInterface.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QuadrilateralInterface.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("quadrilateralType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `quadrilateralType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("quadrilateralType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QuadrilateralInterface.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QuadrilateralInterface' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QuadrilateralInterface.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QuadrilateralInterface value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public QuadrilateralInterface read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + QuadrilateralInterface instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QuadrilateralInterface given an JSON string + * + * @param jsonString JSON string + * @return An instance of QuadrilateralInterface + * @throws IOException if the JSON string is invalid with respect to QuadrilateralInterface + */ + public static QuadrilateralInterface fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QuadrilateralInterface.class); + } + + /** + * Convert an instance of QuadrilateralInterface to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..fc2b0af77be0 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -0,0 +1,306 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ReadOnlyFirst + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ReadOnlyFirst { + public static final String SERIALIZED_NAME_BAR = "bar"; + @SerializedName(SERIALIZED_NAME_BAR) + @javax.annotation.Nullable + private String bar; + + public static final String SERIALIZED_NAME_BAZ = "baz"; + @SerializedName(SERIALIZED_NAME_BAZ) + @javax.annotation.Nullable + private String baz; + + public ReadOnlyFirst() { + } + + public ReadOnlyFirst( + String bar + ) { + this(); + this.bar = bar; + } + + /** + * Get bar + * @return bar + */ + @javax.annotation.Nullable + + public String getBar() { + return bar; + } + + + + public ReadOnlyFirst baz(@javax.annotation.Nullable String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + */ + @javax.annotation.Nullable + + public String getBaz() { + return baz; + } + + public void setBaz(@javax.annotation.Nullable String baz) { + this.baz = baz; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ReadOnlyFirst instance itself + */ + public ReadOnlyFirst putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("bar", "baz")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReadOnlyFirst + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReadOnlyFirst.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReadOnlyFirst is not found in the empty JSON string", ReadOnlyFirst.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonNull()) && !jsonObj.get("bar").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString())); + } + if ((jsonObj.get("baz") != null && !jsonObj.get("baz").isJsonNull()) && !jsonObj.get("baz").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `baz` to be a primitive type in the JSON string but got `%s`", jsonObj.get("baz").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReadOnlyFirst.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReadOnlyFirst' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReadOnlyFirst.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReadOnlyFirst value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ReadOnlyFirst read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReadOnlyFirst instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReadOnlyFirst given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReadOnlyFirst + * @throws IOException if the JSON string is invalid with respect to ReadOnlyFirst + */ + public static ReadOnlyFirst fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReadOnlyFirst.class); + } + + /** + * Convert an instance of ReadOnlyFirst to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/RequiredNullableBody.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/RequiredNullableBody.java new file mode 100644 index 000000000000..83ccf9bfd21f --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/RequiredNullableBody.java @@ -0,0 +1,759 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.client.model.NullableEnum; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * RequiredNullableBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class RequiredNullableBody { + public static final String SERIALIZED_NAME_INTEGER_PROP = "integer_prop"; + @SerializedName(SERIALIZED_NAME_INTEGER_PROP) + @javax.annotation.Nullable + private Integer integerProp; + + public static final String SERIALIZED_NAME_NUMBER_PROP = "number_prop"; + @SerializedName(SERIALIZED_NAME_NUMBER_PROP) + @javax.annotation.Nullable + private BigDecimal numberProp; + + public static final String SERIALIZED_NAME_BOOLEAN_PROP = "boolean_prop"; + @SerializedName(SERIALIZED_NAME_BOOLEAN_PROP) + @javax.annotation.Nullable + private Boolean booleanProp; + + public static final String SERIALIZED_NAME_STRING_PROP = "string_prop"; + @SerializedName(SERIALIZED_NAME_STRING_PROP) + @javax.annotation.Nullable + private String stringProp; + + public static final String SERIALIZED_NAME_DATE_PROP = "date_prop"; + @SerializedName(SERIALIZED_NAME_DATE_PROP) + @javax.annotation.Nullable + private LocalDate dateProp; + + public static final String SERIALIZED_NAME_DATETIME_PROP = "datetime_prop"; + @SerializedName(SERIALIZED_NAME_DATETIME_PROP) + @javax.annotation.Nullable + private OffsetDateTime datetimeProp; + + public static final String SERIALIZED_NAME_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + @SerializedName(SERIALIZED_NAME_ARRAY_NULLABLE_PROP) + @javax.annotation.Nullable + private List arrayNullableProp; + + public static final String SERIALIZED_NAME_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + @SerializedName(SERIALIZED_NAME_ARRAY_AND_ITEMS_NULLABLE_PROP) + @javax.annotation.Nullable + private List arrayAndItemsNullableProp; + + public static final String SERIALIZED_NAME_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + @SerializedName(SERIALIZED_NAME_ARRAY_ITEMS_NULLABLE) + @javax.annotation.Nonnull + private List arrayItemsNullable = new ArrayList<>(); + + public static final String SERIALIZED_NAME_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + @SerializedName(SERIALIZED_NAME_OBJECT_NULLABLE_PROP) + @javax.annotation.Nullable + private Map objectNullableProp; + + public static final String SERIALIZED_NAME_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + @SerializedName(SERIALIZED_NAME_OBJECT_AND_ITEMS_NULLABLE_PROP) + @javax.annotation.Nullable + private Map objectAndItemsNullableProp; + + public static final String SERIALIZED_NAME_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + @SerializedName(SERIALIZED_NAME_OBJECT_ITEMS_NULLABLE) + @javax.annotation.Nonnull + private Map objectItemsNullable = new HashMap<>(); + + public static final String SERIALIZED_NAME_CUSTOM_REF_ENUM = "custom_ref_enum"; + @SerializedName(SERIALIZED_NAME_CUSTOM_REF_ENUM) + @javax.annotation.Nullable + private NullableEnum customRefEnum; + + /** + * Gets or Sets customEnum + */ + @JsonAdapter(CustomEnumEnum.Adapter.class) + public enum CustomEnumEnum { + CUSTOM("custom"); + + private String value; + + CustomEnumEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CustomEnumEnum fromValue(String value) { + for (CustomEnumEnum b : CustomEnumEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CustomEnumEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CustomEnumEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CustomEnumEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CustomEnumEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CUSTOM_ENUM = "custom_enum"; + @SerializedName(SERIALIZED_NAME_CUSTOM_ENUM) + @javax.annotation.Nullable + private CustomEnumEnum customEnum; + + public RequiredNullableBody() { + } + + public RequiredNullableBody integerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + return this; + } + + /** + * Get integerProp + * @return integerProp + */ + @javax.annotation.Nullable + + public Integer getIntegerProp() { + return integerProp; + } + + public void setIntegerProp(@javax.annotation.Nullable Integer integerProp) { + this.integerProp = integerProp; + } + + + public RequiredNullableBody numberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + return this; + } + + /** + * Get numberProp + * @return numberProp + */ + @javax.annotation.Nullable + + public BigDecimal getNumberProp() { + return numberProp; + } + + public void setNumberProp(@javax.annotation.Nullable BigDecimal numberProp) { + this.numberProp = numberProp; + } + + + public RequiredNullableBody booleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + return this; + } + + /** + * Get booleanProp + * @return booleanProp + */ + @javax.annotation.Nullable + + public Boolean getBooleanProp() { + return booleanProp; + } + + public void setBooleanProp(@javax.annotation.Nullable Boolean booleanProp) { + this.booleanProp = booleanProp; + } + + + public RequiredNullableBody stringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + return this; + } + + /** + * Get stringProp + * @return stringProp + */ + @javax.annotation.Nullable + + public String getStringProp() { + return stringProp; + } + + public void setStringProp(@javax.annotation.Nullable String stringProp) { + this.stringProp = stringProp; + } + + + public RequiredNullableBody dateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + return this; + } + + /** + * Get dateProp + * @return dateProp + */ + @javax.annotation.Nullable + + public LocalDate getDateProp() { + return dateProp; + } + + public void setDateProp(@javax.annotation.Nullable LocalDate dateProp) { + this.dateProp = dateProp; + } + + + public RequiredNullableBody datetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + */ + @javax.annotation.Nullable + + public OffsetDateTime getDatetimeProp() { + return datetimeProp; + } + + public void setDatetimeProp(@javax.annotation.Nullable OffsetDateTime datetimeProp) { + this.datetimeProp = datetimeProp; + } + + + public RequiredNullableBody arrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + return this; + } + + public RequiredNullableBody addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null) { + this.arrayNullableProp = new ArrayList<>(); + } + this.arrayNullableProp.add(arrayNullablePropItem); + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + */ + @javax.annotation.Nullable + + public List getArrayNullableProp() { + return arrayNullableProp; + } + + public void setArrayNullableProp(@javax.annotation.Nullable List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + + public RequiredNullableBody arrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + + public RequiredNullableBody addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null) { + this.arrayAndItemsNullableProp = new ArrayList<>(); + } + this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem); + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + */ + @javax.annotation.Nullable + + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp; + } + + public void setArrayAndItemsNullableProp(@javax.annotation.Nullable List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + + public RequiredNullableBody arrayItemsNullable(@javax.annotation.Nonnull List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + public RequiredNullableBody addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<>(); + } + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + /** + * Get arrayItemsNullable + * @return arrayItemsNullable + */ + @javax.annotation.Nonnull + + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + public void setArrayItemsNullable(@javax.annotation.Nonnull List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + + public RequiredNullableBody objectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + return this; + } + + public RequiredNullableBody putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null) { + this.objectNullableProp = new HashMap<>(); + } + this.objectNullableProp.put(key, objectNullablePropItem); + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + */ + @javax.annotation.Nullable + + public Map getObjectNullableProp() { + return objectNullableProp; + } + + public void setObjectNullableProp(@javax.annotation.Nullable Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + + public RequiredNullableBody objectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + + public RequiredNullableBody putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null) { + this.objectAndItemsNullableProp = new HashMap<>(); + } + this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem); + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + */ + @javax.annotation.Nullable + + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp; + } + + public void setObjectAndItemsNullableProp(@javax.annotation.Nullable Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + + public RequiredNullableBody objectItemsNullable(@javax.annotation.Nonnull Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + return this; + } + + public RequiredNullableBody 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.Nonnull + + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + public void setObjectItemsNullable(@javax.annotation.Nonnull Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + + public RequiredNullableBody customRefEnum(@javax.annotation.Nullable NullableEnum customRefEnum) { + this.customRefEnum = customRefEnum; + return this; + } + + /** + * Get customRefEnum + * @return customRefEnum + */ + @javax.annotation.Nullable + + public NullableEnum getCustomRefEnum() { + return customRefEnum; + } + + public void setCustomRefEnum(@javax.annotation.Nullable NullableEnum customRefEnum) { + this.customRefEnum = customRefEnum; + } + + + public RequiredNullableBody customEnum(@javax.annotation.Nullable CustomEnumEnum customEnum) { + this.customEnum = customEnum; + return this; + } + + /** + * Get customEnum + * @return customEnum + */ + @javax.annotation.Nullable + + public CustomEnumEnum getCustomEnum() { + return customEnum; + } + + public void setCustomEnum(@javax.annotation.Nullable CustomEnumEnum customEnum) { + this.customEnum = customEnum; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RequiredNullableBody instance itself + */ + public RequiredNullableBody putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequiredNullableBody {\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(" customRefEnum: ").append(toIndentedString(customRefEnum)).append("\n"); + sb.append(" customEnum: ").append(toIndentedString(customEnum)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable", "custom_ref_enum", "custom_enum")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable", "custom_ref_enum", "custom_enum")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RequiredNullableBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RequiredNullableBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in RequiredNullableBody is not found in the empty JSON string", RequiredNullableBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RequiredNullableBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("string_prop") != null && !jsonObj.get("string_prop").isJsonNull()) && !jsonObj.get("string_prop").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `string_prop` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_prop").toString())); + } + // ensure the required json array is present + if (jsonObj.get("array_nullable_prop") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("array_nullable_prop").isJsonArray() && !jsonObj.get("array_nullable_prop").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_nullable_prop` to be an array in the JSON string but got `%s`", jsonObj.get("array_nullable_prop").toString())); + } + // ensure the required json array is present + if (jsonObj.get("array_and_items_nullable_prop") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("array_and_items_nullable_prop").isJsonArray() && !jsonObj.get("array_and_items_nullable_prop").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_and_items_nullable_prop` to be an array in the JSON string but got `%s`", jsonObj.get("array_and_items_nullable_prop").toString())); + } + // ensure the required json array is present + if (jsonObj.get("array_items_nullable") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("array_items_nullable").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `array_items_nullable` to be an array in the JSON string but got `%s`", jsonObj.get("array_items_nullable").toString())); + } + if (jsonObj.get("custom_ref_enum") != null && !jsonObj.get("custom_ref_enum").isJsonNull()) { + // validate the required field `custom_ref_enum` + NullableEnum.validateJsonElement(jsonObj.get("custom_ref_enum")); + } + if ((jsonObj.get("custom_enum") != null && !jsonObj.get("custom_enum").isJsonNull()) && !jsonObj.get("custom_enum").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `custom_enum` to be a primitive type in the JSON string but got `%s`", jsonObj.get("custom_enum").toString())); + } + if (jsonObj.get("custom_enum") != null && !jsonObj.get("custom_enum").isJsonNull()) { + // validate the required field `custom_enum` + CustomEnumEnum.validateJsonElement(jsonObj.get("custom_enum")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RequiredNullableBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RequiredNullableBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RequiredNullableBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RequiredNullableBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public RequiredNullableBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RequiredNullableBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RequiredNullableBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of RequiredNullableBody + * @throws IOException if the JSON string is invalid with respect to RequiredNullableBody + */ + public static RequiredNullableBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RequiredNullableBody.class); + } + + /** + * Convert an instance of RequiredNullableBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Scalar.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Scalar.java new file mode 100644 index 000000000000..cfcd916a4ea1 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Scalar.java @@ -0,0 +1,375 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Scalar extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Scalar.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Scalar + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize UUID + try { + // validate the JSON object to see if any exception is thrown + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for UUID failed with `%s`.", e.getMessage())); + } + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + } + + // deserialize BigDecimal + try { + // validate the JSON object to see if any exception is thrown + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for BigDecimal failed with `%s`.", e.getMessage())); + } + + // deserialize Boolean + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Boolean failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for Scalar: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Scalar.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Scalar' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterUUID = gson.getDelegateAdapter(this, TypeToken.get(UUID.class)); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final TypeAdapter adapterBigDecimal = gson.getDelegateAdapter(this, TypeToken.get(BigDecimal.class)); + final TypeAdapter adapterBoolean = gson.getDelegateAdapter(this, TypeToken.get(Boolean.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Scalar value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `UUID` + if (value.getActualInstance() instanceof UUID) { + JsonElement element = adapterUUID.toJsonTree((UUID)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + // check if the actual instance is of the type `BigDecimal` + if (value.getActualInstance() instanceof BigDecimal) { + JsonElement element = adapterBigDecimal.toJsonTree((BigDecimal)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `Boolean` + if (value.getActualInstance() instanceof Boolean) { + JsonPrimitive primitive = adapterBoolean.toJsonTree((Boolean)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: BigDecimal, Boolean, String, UUID"); + } + + @Override + public Scalar read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize UUID + try { + // validate the JSON object to see if any exception is thrown + actualAdapter = adapterUUID; + match++; + log.log(Level.FINER, "Input data matches schema 'UUID'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for UUID failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UUID'", e); + } + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterString; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize BigDecimal + try { + // validate the JSON object to see if any exception is thrown + actualAdapter = adapterBigDecimal; + match++; + log.log(Level.FINER, "Input data matches schema 'BigDecimal'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for BigDecimal failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'BigDecimal'", e); + } + + // deserialize Boolean + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + actualAdapter = adapterBoolean; + match++; + log.log(Level.FINER, "Input data matches schema 'Boolean'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Boolean failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Boolean'", e); + } + + if (match == 1) { + Scalar ret = new Scalar(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for Scalar: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Scalar() { + super("oneOf", Boolean.FALSE); + } + + public Scalar(BigDecimal o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Scalar(Boolean o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Scalar(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Scalar(UUID o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("BigDecimal", BigDecimal.class); + schemas.put("Boolean", Boolean.class); + schemas.put("String", String.class); + schemas.put("UUID", UUID.class); + } + + @Override + public Map> getSchemas() { + return Scalar.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * BigDecimal, Boolean, String, UUID + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(BigDecimal.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Boolean.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UUID.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BigDecimal, Boolean, String, UUID"); + } + + /** + * Get the actual instance, which can be the following: + * BigDecimal, Boolean, String, UUID + * + * @return The actual instance (BigDecimal, Boolean, String, UUID) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BigDecimal`. If the actual instance is not `BigDecimal`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BigDecimal` + * @throws ClassCastException if the instance is not `BigDecimal` + */ + public BigDecimal getBigDecimal() throws ClassCastException { + return (BigDecimal)super.getActualInstance(); + } + + /** + * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Boolean` + * @throws ClassCastException if the instance is not `Boolean` + */ + public Boolean getBoolean() throws ClassCastException { + return (Boolean)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + /** + * Get the actual instance of `UUID`. If the actual instance is not `UUID`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UUID` + * @throws ClassCastException if the instance is not `UUID` + */ + public UUID getUUID() throws ClassCastException { + return (UUID)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScalarAnyOf.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScalarAnyOf.java new file mode 100644 index 000000000000..db9abb5b317c --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScalarAnyOf.java @@ -0,0 +1,362 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.math.BigDecimal; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ScalarAnyOf extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ScalarAnyOf.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ScalarAnyOf + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + List errorMessages = new ArrayList<>(); + int matches = 0; + + try { + // validate the JSON object to see if any exception is thrown + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for UUID failed with `%s`.", e.getMessage())); + } + + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + } + + try { + // validate the JSON object to see if any exception is thrown + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for BigDecimal failed with `%s`.", e.getMessage())); + } + + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Boolean failed with `%s`.", e.getMessage())); + } + + + if (matches == 0) { + throw new IOException(String.format("Failed deserialization for ScalarAnyOf: no match found. %s", errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ScalarAnyOf.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ScalarAnyOf' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterUUID = gson.getDelegateAdapter(this, TypeToken.get(UUID.class)); + final TypeAdapter adapterString = gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final TypeAdapter adapterBigDecimal = gson.getDelegateAdapter(this, TypeToken.get(BigDecimal.class)); + final TypeAdapter adapterBoolean = gson.getDelegateAdapter(this, TypeToken.get(Boolean.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ScalarAnyOf value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `UUID` + if (value.getActualInstance() instanceof UUID) { + JsonElement element = adapterUUID.toJsonTree((UUID)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = adapterString.toJsonTree((String)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + // check if the actual instance is of the type `BigDecimal` + if (value.getActualInstance() instanceof BigDecimal) { + JsonElement element = adapterBigDecimal.toJsonTree((BigDecimal)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `Boolean` + if (value.getActualInstance() instanceof Boolean) { + JsonPrimitive primitive = adapterBoolean.toJsonTree((Boolean)value.getActualInstance()).getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: BigDecimal, Boolean, String, UUID"); + } + + @Override + public ScalarAnyOf read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize UUID + try { + // validate the JSON object to see if any exception is thrown + ScalarAnyOf ret = new ScalarAnyOf(); + ret.setActualInstance(adapterUUID.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for UUID failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UUID'", e); + } + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + ScalarAnyOf ret = new ScalarAnyOf(); + ret.setActualInstance(adapterString.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for String failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize BigDecimal + try { + // validate the JSON object to see if any exception is thrown + ScalarAnyOf ret = new ScalarAnyOf(); + ret.setActualInstance(adapterBigDecimal.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for BigDecimal failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'BigDecimal'", e); + } + + // deserialize Boolean + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected json element to be a primitive type in the JSON string but got `%s`", jsonElement.toString())); + } + ScalarAnyOf ret = new ScalarAnyOf(); + ret.setActualInstance(adapterBoolean.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Boolean failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Boolean'", e); + } + + + throw new IOException(String.format("Failed deserialization for ScalarAnyOf: no match found. %s", errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap<>(); + + public ScalarAnyOf() { + super("anyOf", Boolean.FALSE); + } + + public ScalarAnyOf(BigDecimal o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarAnyOf(Boolean o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarAnyOf(String o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public ScalarAnyOf(UUID o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("BigDecimal", BigDecimal.class); + schemas.put("Boolean", Boolean.class); + schemas.put("String", String.class); + schemas.put("UUID", UUID.class); + } + + @Override + public Map> getSchemas() { + return ScalarAnyOf.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * BigDecimal, Boolean, String, UUID + * + * It could be an instance of the 'anyOf' schemas. + * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(BigDecimal.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Boolean.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UUID.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BigDecimal, Boolean, String, UUID"); + } + + /** + * Get the actual instance, which can be the following: + * BigDecimal, Boolean, String, UUID + * + * @return The actual instance (BigDecimal, Boolean, String, UUID) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BigDecimal`. If the actual instance is not `BigDecimal`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BigDecimal` + * @throws ClassCastException if the instance is not `BigDecimal` + */ + public BigDecimal getBigDecimal() throws ClassCastException { + return (BigDecimal)super.getActualInstance(); + } + + /** + * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Boolean` + * @throws ClassCastException if the instance is not `Boolean` + */ + public Boolean getBoolean() throws ClassCastException { + return (Boolean)super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String)super.getActualInstance(); + } + + /** + * Get the actual instance of `UUID`. If the actual instance is not `UUID`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UUID` + * @throws ClassCastException if the instance is not `UUID` + */ + public UUID getUUID() throws ClassCastException { + return (UUID)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScaleneTriangle.java new file mode 100644 index 000000000000..94abdbef5cf0 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -0,0 +1,314 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ScaleneTriangle + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ScaleneTriangle { + public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; + @SerializedName(SERIALIZED_NAME_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String SERIALIZED_NAME_TRIANGLE_TYPE = "triangleType"; + @SerializedName(SERIALIZED_NAME_TRIANGLE_TYPE) + @javax.annotation.Nonnull + private String triangleType; + + public ScaleneTriangle() { + } + + public ScaleneTriangle shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + + public String getShapeType() { + return shapeType; + } + + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public ScaleneTriangle triangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @javax.annotation.Nonnull + + public String getTriangleType() { + return triangleType; + } + + public void setTriangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ScaleneTriangle instance itself + */ + public ScaleneTriangle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "triangleType")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ScaleneTriangle + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ScaleneTriangle.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ScaleneTriangle is not found in the empty JSON string", ScaleneTriangle.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ScaleneTriangle.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("shapeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); + } + if (!jsonObj.get("triangleType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `triangleType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("triangleType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ScaleneTriangle.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ScaleneTriangle' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ScaleneTriangle.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ScaleneTriangle value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ScaleneTriangle read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ScaleneTriangle instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ScaleneTriangle given an JSON string + * + * @param jsonString JSON string + * @return An instance of ScaleneTriangle + * @throws IOException if the JSON string is invalid with respect to ScaleneTriangle + */ + public static ScaleneTriangle fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ScaleneTriangle.class); + } + + /** + * Convert an instance of ScaleneTriangle to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Shape.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Shape.java new file mode 100644 index 000000000000..16252a40c4c9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Shape.java @@ -0,0 +1,301 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Shape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Shape.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Shape + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("shapeType") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'shapeType' is missing."); + } + String discriminatorValue = jsonObject.get("shapeType").getAsString(); + if ("Quadrilateral".equals(discriminatorValue)) { + Quadrilateral.validateJsonElement(jsonElement); + return; + } + if ("Triangle".equals(discriminatorValue)) { + Triangle.validateJsonElement(jsonElement); + return; + } + // deserialize Triangle + try { + // validate the JSON object to see if any exception is thrown + Triangle.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Triangle failed with `%s`.", e.getMessage())); + } + + // deserialize Quadrilateral + try { + // validate the JSON object to see if any exception is thrown + Quadrilateral.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Quadrilateral failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for Shape: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Shape.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Shape' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterTriangle = gson.getDelegateAdapter(this, TypeToken.get(Triangle.class)); + final TypeAdapter adapterQuadrilateral = gson.getDelegateAdapter(this, TypeToken.get(Quadrilateral.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Shape value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Triangle` + if (value.getActualInstance() instanceof Triangle) { + JsonElement element = adapterTriangle.toJsonTree((Triangle)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `Quadrilateral` + if (value.getActualInstance() instanceof Quadrilateral) { + JsonElement element = adapterQuadrilateral.toJsonTree((Quadrilateral)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Quadrilateral, Triangle"); + } + + @Override + public Shape read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("shapeType") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'shapeType' is missing."); + } + String discriminatorValue = jsonObject.get("shapeType").getAsString(); + if ("Quadrilateral".equals(discriminatorValue)) { + deserialized = adapterQuadrilateral.fromJsonTree(jsonElement); + Shape ret = new Shape(); + ret.setActualInstance(deserialized); + return ret; + } + if ("Triangle".equals(discriminatorValue)) { + deserialized = adapterTriangle.fromJsonTree(jsonElement); + Shape ret = new Shape(); + ret.setActualInstance(deserialized); + return ret; + } + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize Triangle + try { + // validate the JSON object to see if any exception is thrown + Triangle.validateJsonElement(jsonElement); + actualAdapter = adapterTriangle; + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Triangle failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + // deserialize Quadrilateral + try { + // validate the JSON object to see if any exception is thrown + Quadrilateral.validateJsonElement(jsonElement); + actualAdapter = adapterQuadrilateral; + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Quadrilateral failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + if (match == 1) { + Shape ret = new Shape(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for Shape: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final 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", Quadrilateral.class); + schemas.put("Triangle", Triangle.class); + } + + @Override + public Map> getSchemas() { + return Shape.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeInterface.java new file mode 100644 index 000000000000..6f7d0647d188 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -0,0 +1,285 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * ShapeInterface + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ShapeInterface { + public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; + @SerializedName(SERIALIZED_NAME_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public ShapeInterface() { + } + + public ShapeInterface shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + + public String getShapeType() { + return shapeType; + } + + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ShapeInterface instance itself + */ + public ShapeInterface putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShapeInterface {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShapeInterface + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShapeInterface.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ShapeInterface is not found in the empty JSON string", ShapeInterface.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ShapeInterface.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("shapeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShapeInterface.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShapeInterface' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShapeInterface.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShapeInterface value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ShapeInterface read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ShapeInterface instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShapeInterface given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShapeInterface + * @throws IOException if the JSON string is invalid with respect to ShapeInterface + */ + public static ShapeInterface fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShapeInterface.class); + } + + /** + * Convert an instance of ShapeInterface to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeOrNull.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeOrNull.java new file mode 100644 index 000000000000..5effa81354a2 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeOrNull.java @@ -0,0 +1,306 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class ShapeOrNull extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ShapeOrNull.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShapeOrNull + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("shapeType") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'shapeType' is missing."); + } + String discriminatorValue = jsonObject.get("shapeType").getAsString(); + if ("Quadrilateral".equals(discriminatorValue)) { + Quadrilateral.validateJsonElement(jsonElement); + return; + } + if ("Triangle".equals(discriminatorValue)) { + Triangle.validateJsonElement(jsonElement); + return; + } + // deserialize Triangle + try { + // validate the JSON object to see if any exception is thrown + Triangle.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Triangle failed with `%s`.", e.getMessage())); + } + + // deserialize Quadrilateral + try { + // validate the JSON object to see if any exception is thrown + Quadrilateral.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Quadrilateral failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for ShapeOrNull: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShapeOrNull.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShapeOrNull' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterTriangle = gson.getDelegateAdapter(this, TypeToken.get(Triangle.class)); + final TypeAdapter adapterQuadrilateral = gson.getDelegateAdapter(this, TypeToken.get(Quadrilateral.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShapeOrNull value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Triangle` + if (value.getActualInstance() instanceof Triangle) { + JsonElement element = adapterTriangle.toJsonTree((Triangle)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `Quadrilateral` + if (value.getActualInstance() instanceof Quadrilateral) { + JsonElement element = adapterQuadrilateral.toJsonTree((Quadrilateral)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Quadrilateral, Triangle"); + } + + @Override + public ShapeOrNull read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("shapeType") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'shapeType' is missing."); + } + String discriminatorValue = jsonObject.get("shapeType").getAsString(); + if ("Quadrilateral".equals(discriminatorValue)) { + deserialized = adapterQuadrilateral.fromJsonTree(jsonElement); + ShapeOrNull ret = new ShapeOrNull(); + ret.setActualInstance(deserialized); + return ret; + } + if ("Triangle".equals(discriminatorValue)) { + deserialized = adapterTriangle.fromJsonTree(jsonElement); + ShapeOrNull ret = new ShapeOrNull(); + ret.setActualInstance(deserialized); + return ret; + } + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize Triangle + try { + // validate the JSON object to see if any exception is thrown + Triangle.validateJsonElement(jsonElement); + actualAdapter = adapterTriangle; + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Triangle failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + // deserialize Quadrilateral + try { + // validate the JSON object to see if any exception is thrown + Quadrilateral.validateJsonElement(jsonElement); + actualAdapter = adapterQuadrilateral; + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Quadrilateral failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + if (match == 1) { + ShapeOrNull ret = new ShapeOrNull(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for ShapeOrNull: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final 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", Quadrilateral.class); + schemas.put("Triangle", Triangle.class); + } + + @Override + public Map> getSchemas() { + return ShapeOrNull.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * Quadrilateral, Triangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Triangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + /** + * Get the actual instance, which can be the following: + * Quadrilateral, Triangle + * + * @return The actual instance (Quadrilateral, Triangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Quadrilateral` + * @throws ClassCastException if the instance is not `Quadrilateral` + */ + public Quadrilateral getQuadrilateral() throws ClassCastException { + return (Quadrilateral)super.getActualInstance(); + } + + /** + * Get the actual instance of `Triangle`. If the actual instance is not `Triangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Triangle` + * @throws ClassCastException if the instance is not `Triangle` + */ + public Triangle getTriangle() throws ClassCastException { + return (Triangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java new file mode 100644 index 000000000000..91fbd0808784 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -0,0 +1,314 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SimpleQuadrilateral + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class SimpleQuadrilateral { + public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; + @SerializedName(SERIALIZED_NAME_SHAPE_TYPE) + @javax.annotation.Nonnull + private String shapeType; + + public static final String SERIALIZED_NAME_QUADRILATERAL_TYPE = "quadrilateralType"; + @SerializedName(SERIALIZED_NAME_QUADRILATERAL_TYPE) + @javax.annotation.Nonnull + private String quadrilateralType; + + public SimpleQuadrilateral() { + } + + public SimpleQuadrilateral shapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + */ + @javax.annotation.Nonnull + + public String getShapeType() { + return shapeType; + } + + public void setShapeType(@javax.annotation.Nonnull String shapeType) { + this.shapeType = shapeType; + } + + + public SimpleQuadrilateral quadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + */ + @javax.annotation.Nonnull + + public String getQuadrilateralType() { + return quadrilateralType; + } + + public void setQuadrilateralType(@javax.annotation.Nonnull String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SimpleQuadrilateral instance itself + */ + public SimpleQuadrilateral putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("shapeType", "quadrilateralType")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SimpleQuadrilateral + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SimpleQuadrilateral.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SimpleQuadrilateral is not found in the empty JSON string", SimpleQuadrilateral.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SimpleQuadrilateral.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("shapeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); + } + if (!jsonObj.get("quadrilateralType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `quadrilateralType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("quadrilateralType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SimpleQuadrilateral.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SimpleQuadrilateral' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SimpleQuadrilateral.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SimpleQuadrilateral value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SimpleQuadrilateral read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SimpleQuadrilateral instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SimpleQuadrilateral given an JSON string + * + * @param jsonString JSON string + * @return An instance of SimpleQuadrilateral + * @throws IOException if the JSON string is invalid with respect to SimpleQuadrilateral + */ + public static SimpleQuadrilateral fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SimpleQuadrilateral.class); + } + + /** + * Convert an instance of SimpleQuadrilateral to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SpecialModelName.java new file mode 100644 index 000000000000..9d934aabf957 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -0,0 +1,304 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * SpecialModelName + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class SpecialModelName { + public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) + @javax.annotation.Nullable + private Long $specialPropertyName; + + public static final String SERIALIZED_NAME_SPECIAL_MODEL_NAME = "_special_model.name_"; + @SerializedName(SERIALIZED_NAME_SPECIAL_MODEL_NAME) + @javax.annotation.Nullable + private String specialModelName; + + public SpecialModelName() { + } + + public SpecialModelName $specialPropertyName(@javax.annotation.Nullable Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + */ + @javax.annotation.Nullable + + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + public void set$SpecialPropertyName(@javax.annotation.Nullable Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + public SpecialModelName specialModelName(@javax.annotation.Nullable String specialModelName) { + this.specialModelName = specialModelName; + return this; + } + + /** + * Get specialModelName + * @return specialModelName + */ + @javax.annotation.Nullable + + public String getSpecialModelName() { + return specialModelName; + } + + public void setSpecialModelName(@javax.annotation.Nullable String specialModelName) { + this.specialModelName = specialModelName; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SpecialModelName instance itself + */ + public SpecialModelName putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append(" specialModelName: ").append(toIndentedString(specialModelName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("$special[property.name]", "_special_model.name_")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SpecialModelName + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SpecialModelName.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SpecialModelName is not found in the empty JSON string", SpecialModelName.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("_special_model.name_") != null && !jsonObj.get("_special_model.name_").isJsonNull()) && !jsonObj.get("_special_model.name_").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `_special_model.name_` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_special_model.name_").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SpecialModelName.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SpecialModelName' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SpecialModelName.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SpecialModelName value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SpecialModelName read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SpecialModelName instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SpecialModelName given an JSON string + * + * @param jsonString JSON string + * @return An instance of SpecialModelName + * @throws IOException if the JSON string is invalid with respect to SpecialModelName + */ + public static SpecialModelName fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SpecialModelName.class); + } + + /** + * Convert an instance of SpecialModelName to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..6c17f6c0b3f8 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,304 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Tag + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Tag { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Tag() { + } + + public Tag id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Tag name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Tag + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Tag.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Tag' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Tag value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Tag read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Tag given an JSON string + * + * @param jsonString JSON string + * @return An instance of Tag + * @throws IOException if the JSON string is invalid with respect to Tag + */ + public static Tag fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Tag.class); + } + + /** + * Convert an instance of Tag to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java new file mode 100644 index 000000000000..04cac3da4091 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -0,0 +1,278 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TestInlineFreeformAdditionalPropertiesRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class TestInlineFreeformAdditionalPropertiesRequest { + public static final String SERIALIZED_NAME_SOME_PROPERTY = "someProperty"; + @SerializedName(SERIALIZED_NAME_SOME_PROPERTY) + @javax.annotation.Nullable + private String someProperty; + + public TestInlineFreeformAdditionalPropertiesRequest() { + } + + public TestInlineFreeformAdditionalPropertiesRequest someProperty(@javax.annotation.Nullable String someProperty) { + this.someProperty = someProperty; + return this; + } + + /** + * Get someProperty + * @return someProperty + */ + @javax.annotation.Nullable + + public String getSomeProperty() { + return someProperty; + } + + public void setSomeProperty(@javax.annotation.Nullable String someProperty) { + this.someProperty = someProperty; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TestInlineFreeformAdditionalPropertiesRequest instance itself + */ + public TestInlineFreeformAdditionalPropertiesRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); + sb.append(" someProperty: ").append(toIndentedString(someProperty)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("someProperty")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TestInlineFreeformAdditionalPropertiesRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TestInlineFreeformAdditionalPropertiesRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TestInlineFreeformAdditionalPropertiesRequest is not found in the empty JSON string", TestInlineFreeformAdditionalPropertiesRequest.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("someProperty") != null && !jsonObj.get("someProperty").isJsonNull()) && !jsonObj.get("someProperty").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `someProperty` to be a primitive type in the JSON string but got `%s`", jsonObj.get("someProperty").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TestInlineFreeformAdditionalPropertiesRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TestInlineFreeformAdditionalPropertiesRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TestInlineFreeformAdditionalPropertiesRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TestInlineFreeformAdditionalPropertiesRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TestInlineFreeformAdditionalPropertiesRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TestInlineFreeformAdditionalPropertiesRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TestInlineFreeformAdditionalPropertiesRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of TestInlineFreeformAdditionalPropertiesRequest + * @throws IOException if the JSON string is invalid with respect to TestInlineFreeformAdditionalPropertiesRequest + */ + public static TestInlineFreeformAdditionalPropertiesRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TestInlineFreeformAdditionalPropertiesRequest.class); + } + + /** + * Convert an instance of TestInlineFreeformAdditionalPropertiesRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Triangle.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Triangle.java new file mode 100644 index 000000000000..41144288c2ea --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Triangle.java @@ -0,0 +1,365 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.EquilateralTriangle; +import org.openapitools.client.model.IsoscelesTriangle; +import org.openapitools.client.model.ScaleneTriangle; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Triangle extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Triangle.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Triangle + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("triangleType") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'triangleType' is missing."); + } + String discriminatorValue = jsonObject.get("triangleType").getAsString(); + if ("EquilateralTriangle".equals(discriminatorValue)) { + EquilateralTriangle.validateJsonElement(jsonElement); + return; + } + if ("IsoscelesTriangle".equals(discriminatorValue)) { + IsoscelesTriangle.validateJsonElement(jsonElement); + return; + } + if ("ScaleneTriangle".equals(discriminatorValue)) { + ScaleneTriangle.validateJsonElement(jsonElement); + return; + } + // deserialize EquilateralTriangle + try { + // validate the JSON object to see if any exception is thrown + EquilateralTriangle.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for EquilateralTriangle failed with `%s`.", e.getMessage())); + } + + // deserialize IsoscelesTriangle + try { + // validate the JSON object to see if any exception is thrown + IsoscelesTriangle.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for IsoscelesTriangle failed with `%s`.", e.getMessage())); + } + + // deserialize ScaleneTriangle + try { + // validate the JSON object to see if any exception is thrown + ScaleneTriangle.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ScaleneTriangle failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for Triangle: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Triangle.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Triangle' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterEquilateralTriangle = gson.getDelegateAdapter(this, TypeToken.get(EquilateralTriangle.class)); + final TypeAdapter adapterIsoscelesTriangle = gson.getDelegateAdapter(this, TypeToken.get(IsoscelesTriangle.class)); + final TypeAdapter adapterScaleneTriangle = gson.getDelegateAdapter(this, TypeToken.get(ScaleneTriangle.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Triangle value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `EquilateralTriangle` + if (value.getActualInstance() instanceof EquilateralTriangle) { + JsonElement element = adapterEquilateralTriangle.toJsonTree((EquilateralTriangle)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `IsoscelesTriangle` + if (value.getActualInstance() instanceof IsoscelesTriangle) { + JsonElement element = adapterIsoscelesTriangle.toJsonTree((IsoscelesTriangle)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `ScaleneTriangle` + if (value.getActualInstance() instanceof ScaleneTriangle) { + JsonElement element = adapterScaleneTriangle.toJsonTree((ScaleneTriangle)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle"); + } + + @Override + public Triangle read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + JsonObject jsonObject = jsonElement.getAsJsonObject(); + if (jsonObject.get("triangleType") == null) { + throw new IOException("Failed to deserialize as the discriminator field 'triangleType' is missing."); + } + String discriminatorValue = jsonObject.get("triangleType").getAsString(); + if ("EquilateralTriangle".equals(discriminatorValue)) { + deserialized = adapterEquilateralTriangle.fromJsonTree(jsonElement); + Triangle ret = new Triangle(); + ret.setActualInstance(deserialized); + return ret; + } + if ("IsoscelesTriangle".equals(discriminatorValue)) { + deserialized = adapterIsoscelesTriangle.fromJsonTree(jsonElement); + Triangle ret = new Triangle(); + ret.setActualInstance(deserialized); + return ret; + } + if ("ScaleneTriangle".equals(discriminatorValue)) { + deserialized = adapterScaleneTriangle.fromJsonTree(jsonElement); + Triangle ret = new Triangle(); + ret.setActualInstance(deserialized); + return ret; + } + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize EquilateralTriangle + try { + // validate the JSON object to see if any exception is thrown + EquilateralTriangle.validateJsonElement(jsonElement); + actualAdapter = adapterEquilateralTriangle; + match++; + log.log(Level.FINER, "Input data matches schema 'EquilateralTriangle'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for EquilateralTriangle failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EquilateralTriangle'", e); + } + + // deserialize IsoscelesTriangle + try { + // validate the JSON object to see if any exception is thrown + IsoscelesTriangle.validateJsonElement(jsonElement); + actualAdapter = adapterIsoscelesTriangle; + match++; + log.log(Level.FINER, "Input data matches schema 'IsoscelesTriangle'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for IsoscelesTriangle failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'IsoscelesTriangle'", e); + } + + // deserialize ScaleneTriangle + try { + // validate the JSON object to see if any exception is thrown + ScaleneTriangle.validateJsonElement(jsonElement); + actualAdapter = adapterScaleneTriangle; + match++; + log.log(Level.FINER, "Input data matches schema 'ScaleneTriangle'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for ScaleneTriangle failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ScaleneTriangle'", e); + } + + if (match == 1) { + Triangle ret = new Triangle(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for Triangle: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final 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", EquilateralTriangle.class); + schemas.put("IsoscelesTriangle", IsoscelesTriangle.class); + schemas.put("ScaleneTriangle", ScaleneTriangle.class); + } + + @Override + public Map> getSchemas() { + return Triangle.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(EquilateralTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(IsoscelesTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(ScaleneTriangle.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle"); + } + + /** + * Get the actual instance, which can be the following: + * EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle + * + * @return The actual instance (EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `EquilateralTriangle`. If the actual instance is not `EquilateralTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EquilateralTriangle` + * @throws ClassCastException if the instance is not `EquilateralTriangle` + */ + public EquilateralTriangle getEquilateralTriangle() throws ClassCastException { + return (EquilateralTriangle)super.getActualInstance(); + } + + /** + * Get the actual instance of `IsoscelesTriangle`. If the actual instance is not `IsoscelesTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `IsoscelesTriangle` + * @throws ClassCastException if the instance is not `IsoscelesTriangle` + */ + public IsoscelesTriangle getIsoscelesTriangle() throws ClassCastException { + return (IsoscelesTriangle)super.getActualInstance(); + } + + /** + * Get the actual instance of `ScaleneTriangle`. If the actual instance is not `ScaleneTriangle`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ScaleneTriangle` + * @throws ClassCastException if the instance is not `ScaleneTriangle` + */ + public ScaleneTriangle getScaleneTriangle() throws ClassCastException { + return (ScaleneTriangle)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TriangleInterface.java new file mode 100644 index 000000000000..26c6a87cd68e --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -0,0 +1,285 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * TriangleInterface + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class TriangleInterface { + public static final String SERIALIZED_NAME_TRIANGLE_TYPE = "triangleType"; + @SerializedName(SERIALIZED_NAME_TRIANGLE_TYPE) + @javax.annotation.Nonnull + private String triangleType; + + public TriangleInterface() { + } + + public TriangleInterface triangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + */ + @javax.annotation.Nonnull + + public String getTriangleType() { + return triangleType; + } + + public void setTriangleType(@javax.annotation.Nonnull String triangleType) { + this.triangleType = triangleType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TriangleInterface instance itself + */ + public TriangleInterface putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TriangleInterface {\n"); + sb.append(" triangleType: ").append(toIndentedString(triangleType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("triangleType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("triangleType")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TriangleInterface + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TriangleInterface.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TriangleInterface is not found in the empty JSON string", TriangleInterface.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TriangleInterface.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("triangleType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `triangleType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("triangleType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TriangleInterface.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TriangleInterface' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TriangleInterface.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TriangleInterface value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TriangleInterface read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TriangleInterface instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TriangleInterface given an JSON string + * + * @param jsonString JSON string + * @return An instance of TriangleInterface + * @throws IOException if the JSON string is invalid with respect to TriangleInterface + */ + public static TriangleInterface fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TriangleInterface.class); + } + + /** + * Convert an instance of TriangleInterface to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..e976dcbab924 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,591 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * User + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class User { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nullable + private String username; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nullable + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nullable + private String lastName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nullable + private String password; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nullable + private String phone; + + public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; + @SerializedName(SERIALIZED_NAME_USER_STATUS) + @javax.annotation.Nullable + private Integer userStatus; + + public static final String SERIALIZED_NAME_OBJECT_WITH_NO_DECLARED_PROPS = "objectWithNoDeclaredProps"; + @SerializedName(SERIALIZED_NAME_OBJECT_WITH_NO_DECLARED_PROPS) + @javax.annotation.Nullable + private Object objectWithNoDeclaredProps; + + public static final String SERIALIZED_NAME_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE = "objectWithNoDeclaredPropsNullable"; + @SerializedName(SERIALIZED_NAME_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE) + @javax.annotation.Nullable + private Object objectWithNoDeclaredPropsNullable; + + public static final String SERIALIZED_NAME_ANY_TYPE_PROP = "anyTypeProp"; + @SerializedName(SERIALIZED_NAME_ANY_TYPE_PROP) + @javax.annotation.Nullable + private Object anyTypeProp = null; + + public static final String SERIALIZED_NAME_ANY_TYPE_PROP_NULLABLE = "anyTypePropNullable"; + @SerializedName(SERIALIZED_NAME_ANY_TYPE_PROP_NULLABLE) + @javax.annotation.Nullable + private Object anyTypePropNullable = null; + + public User() { + } + + public User id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public User username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + */ + @javax.annotation.Nullable + + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public User firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + */ + @javax.annotation.Nullable + + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public User lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + */ + @javax.annotation.Nullable + + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public User email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public User password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + */ + @javax.annotation.Nullable + + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + + public User phone(@javax.annotation.Nullable String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nullable + + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nullable String phone) { + this.phone = phone; + } + + + public User userStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + */ + @javax.annotation.Nullable + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { + this.userStatus = userStatus; + } + + + public User objectWithNoDeclaredProps(@javax.annotation.Nullable 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 + + public Object getObjectWithNoDeclaredProps() { + return objectWithNoDeclaredProps; + } + + public void setObjectWithNoDeclaredProps(@javax.annotation.Nullable Object objectWithNoDeclaredProps) { + this.objectWithNoDeclaredProps = objectWithNoDeclaredProps; + } + + + public User objectWithNoDeclaredPropsNullable(@javax.annotation.Nullable Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = 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 + + public Object getObjectWithNoDeclaredPropsNullable() { + return objectWithNoDeclaredPropsNullable; + } + + public void setObjectWithNoDeclaredPropsNullable(@javax.annotation.Nullable Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + } + + + public User anyTypeProp(@javax.annotation.Nullable Object anyTypeProp) { + this.anyTypeProp = 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 + + public Object getAnyTypeProp() { + return anyTypeProp; + } + + public void setAnyTypeProp(@javax.annotation.Nullable Object anyTypeProp) { + this.anyTypeProp = anyTypeProp; + } + + + public User anyTypePropNullable(@javax.annotation.Nullable Object anyTypePropNullable) { + this.anyTypePropNullable = 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 + + public Object getAnyTypePropNullable() { + return anyTypePropNullable; + } + + public void setAnyTypePropNullable(@javax.annotation.Nullable Object anyTypePropNullable) { + this.anyTypePropNullable = anyTypePropNullable; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus", "objectWithNoDeclaredProps", "objectWithNoDeclaredPropsNullable", "anyTypeProp", "anyTypePropNullable")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to User + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) && !jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!User.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'User' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(User.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, User value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public User read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of User given an JSON string + * + * @param jsonString JSON string + * @return An instance of User + * @throws IOException if the JSON string is invalid with respect to User + */ + public static User fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, User.class); + } + + /** + * Convert an instance of User to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Value.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Value.java new file mode 100644 index 000000000000..9114b57d1dfc --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Value.java @@ -0,0 +1,267 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import java.util.List; +import org.openapitools.client.model.Scalar; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.StringJoiner; + +import org.openapitools.client.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Value extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Value.class.getName()); + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Value + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + int matches = 0; + List errorMessages = new ArrayList<>(); + // deserialize Scalar + try { + // validate the JSON object to see if any exception is thrown + Scalar.validateJsonElement(jsonElement); + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Scalar failed with `%s`.", e.getMessage())); + } + + // deserialize List + try { + // validate the JSON object to see if any exception is thrown + matches++; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + } + + if (matches != 1) { + throw new IOException(String.format("Failed deserialization for Value: %d classes match result, expected 1. %s", matches, errorMessages)); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Value.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Value' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterScalar = gson.getDelegateAdapter(this, TypeToken.get(Scalar.class)); + final Type typeInstanceListScalar = new TypeToken>(){}.getType(); + final TypeAdapter> adapterListScalar = (TypeAdapter>) gson.getDelegateAdapter(this, TypeToken.get(typeInstance)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Value value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Scalar` + if (value.getActualInstance() instanceof Scalar) { + JsonElement element = adapterScalar.toJsonTree((Scalar)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + + // check if the actual instance is of the type `List` + if (value.getActualInstance() instanceof List) { + List list = (List) value.getActualInstance(); + if (!list.isEmpty() && list.get(0) instanceof Scalar) { + JsonArray array = adapterListScalar.toJsonTree((List)value.getActualInstance()).getAsJsonArray(); + elementAdapter.write(out, array); + return; + } + } + + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: List, Scalar"); + } + + @Override + public Value read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = null; + + // deserialize Scalar + try { + // validate the JSON object to see if any exception is thrown + Scalar.validateJsonElement(jsonElement); + actualAdapter = adapterScalar; + match++; + log.log(Level.FINER, "Input data matches schema 'Scalar'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Scalar failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Scalar'", e); + } + + // deserialize List + try { + // validate the JSON object to see if any exception is thrown + actualAdapter = adapterListScalar; + match++; + log.log(Level.FINER, "Input data matches schema 'List'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + if (match == 1) { + Value ret = new Value(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for Value: %d classes match result, expected 1. %s", match, errorMessages)); + } + }; + } + } + + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public Value() { + super("oneOf", Boolean.FALSE); + } + + public Value(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Value(Scalar o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("List", List.class); + schemas.put("Scalar", Scalar.class); + } + + @Override + public Map> getSchemas() { + return Value.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * List, Scalar + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(Scalar.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be List, Scalar"); + } + + /** + * Get the actual instance, which can be the following: + * List, Scalar + * + * @return The actual instance (List, Scalar) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getList() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Get the actual instance of `Scalar`. If the actual instance is not `Scalar`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Scalar` + * @throws ClassCastException if the instance is not `Scalar` + */ + public Scalar getScalar() throws ClassCastException { + return (Scalar)super.getActualInstance(); + } + + + +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Variable.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Variable.java new file mode 100644 index 000000000000..9f51c20aa4fd --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Variable.java @@ -0,0 +1,314 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Value; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Value object + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Variable { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private Value value; + + public Variable() { + } + + public Variable name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Variable value(@javax.annotation.Nonnull Value value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + + public Value getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull Value value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Variable instance itself + */ + public Variable putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Variable {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("name", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "value")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Variable + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Variable.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Variable is not found in the empty JSON string", Variable.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Variable.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the required field `value` + Value.validateJsonElement(jsonObj.get("value")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Variable.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Variable' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Variable.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Variable value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Variable read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Variable instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Variable given an JSON string + * + * @param jsonString JSON string + * @return An instance of Variable + * @throws IOException if the JSON string is invalid with respect to Variable + */ + public static Variable fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Variable.class); + } + + /** + * Convert an instance of Variable to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Whale.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Whale.java new file mode 100644 index 000000000000..44c6fc66c399 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Whale.java @@ -0,0 +1,337 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Whale + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Whale { + public static final String SERIALIZED_NAME_HAS_BALEEN = "hasBaleen"; + @SerializedName(SERIALIZED_NAME_HAS_BALEEN) + @javax.annotation.Nullable + private Boolean hasBaleen; + + public static final String SERIALIZED_NAME_HAS_TEETH = "hasTeeth"; + @SerializedName(SERIALIZED_NAME_HAS_TEETH) + @javax.annotation.Nullable + private Boolean hasTeeth; + + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @SerializedName(SERIALIZED_NAME_CLASS_NAME) + @javax.annotation.Nonnull + private String className; + + public Whale() { + } + + public Whale hasBaleen(@javax.annotation.Nullable Boolean hasBaleen) { + this.hasBaleen = hasBaleen; + return this; + } + + /** + * Get hasBaleen + * @return hasBaleen + */ + @javax.annotation.Nullable + + public Boolean getHasBaleen() { + return hasBaleen; + } + + public void setHasBaleen(@javax.annotation.Nullable Boolean hasBaleen) { + this.hasBaleen = hasBaleen; + } + + + public Whale hasTeeth(@javax.annotation.Nullable Boolean hasTeeth) { + this.hasTeeth = hasTeeth; + return this; + } + + /** + * Get hasTeeth + * @return hasTeeth + */ + @javax.annotation.Nullable + + public Boolean getHasTeeth() { + return hasTeeth; + } + + public void setHasTeeth(@javax.annotation.Nullable Boolean hasTeeth) { + this.hasTeeth = hasTeeth; + } + + + public Whale className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + + public String getClassName() { + return className; + } + + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Whale instance itself + */ + public Whale putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @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(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("hasBaleen", "hasTeeth", "className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Whale + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Whale.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Whale is not found in the empty JSON string", Whale.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Whale.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("className").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `className` to be a primitive type in the JSON string but got `%s`", jsonObj.get("className").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Whale.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Whale' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Whale.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Whale value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Whale read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Whale instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Whale given an JSON string + * + * @param jsonString JSON string + * @return An instance of Whale + * @throws IOException if the JSON string is invalid with respect to Whale + */ + public static Whale fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Whale.class); + } + + /** + * Convert an instance of Whale to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Zebra.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Zebra.java new file mode 100644 index 000000000000..c35ec184d495 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Zebra.java @@ -0,0 +1,372 @@ +/* + * 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.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.SerializedName; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.client.JSON; + +/** + * Zebra + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +public class Zebra { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + PLAINS("plains"), + + MOUNTAIN("mountain"), + + GREVYS("grevys"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + 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 class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public static final String SERIALIZED_NAME_CLASS_NAME = "className"; + @SerializedName(SERIALIZED_NAME_CLASS_NAME) + @javax.annotation.Nonnull + private String className; + + public Zebra() { + } + + public Zebra type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public Zebra className(@javax.annotation.Nonnull String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + */ + @javax.annotation.Nonnull + + public String getClassName() { + return className; + } + + public void setClassName(@javax.annotation.Nonnull String className) { + this.className = className; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Zebra instance itself + */ + public Zebra putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Zebra {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("type", "className")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("className")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Zebra + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Zebra.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Zebra is not found in the empty JSON string", Zebra.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Zebra.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + if (!jsonObj.get("className").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `className` to be a primitive type in the JSON string but got `%s`", jsonObj.get("className").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Zebra.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Zebra' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Zebra.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Zebra value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Zebra read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Zebra instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Zebra given an JSON string + * + * @param jsonString JSON string + * @return An instance of Zebra + * @throws IOException if the JSON string is invalid with respect to Zebra + */ + public static Zebra fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Zebra.class); + } + + /** + * Convert an instance of Zebra to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java new file mode 100644 index 000000000000..face3d9b785e --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -0,0 +1,73 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AnotherFakeApi + */ +@Disabled +public class AnotherFakeApiTest { + + private final AnotherFakeApi api = new AnotherFakeApi(); + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + * + * @throws ApiException if the Api call fails + */ + @Test + public void call123testSpecialTagsTest() throws ApiException { + Client client = null; + Client response = api.call123testSpecialTags(client); + // TODO: test validations + } + + /** + * parameter array number default value + * + * @throws ApiException if the Api call fails + */ + @Test + public void getParameterArrayNumberTest() throws ApiException { + List array = null; + api.getParameterArrayNumber(array); + // TODO: test validations + } + + /** + * parameter string number + * + * @throws ApiException if the Api call fails + */ + @Test + public void getParameterStringNumberTest() throws ApiException { + BigDecimal stringNumber = null; + api.getParameterStringNumber(stringNumber); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/DefaultApiTest.java new file mode 100644 index 000000000000..9dbc195b0857 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -0,0 +1,78 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.FakeAnyOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FakeOneOfWIthSameErasureGet200Response; +import org.openapitools.client.model.FooGetDefaultResponse; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for DefaultApi + */ +@Disabled +public class DefaultApiTest { + + private final DefaultApi api = new DefaultApi(); + + /** + * Test route, this shouldn't cause a compiler error + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeAnyOfWIthSameErasureGetTest() throws ApiException { + FakeAnyOfWIthSameErasureGet200Response response = api.fakeAnyOfWIthSameErasureGet(); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fakeFreeFormQueryParametersGetTest() throws ApiException { + String fixed = null; + Object freeForm = null; + api.fakeFreeFormQueryParametersGet(fixed, freeForm); + // TODO: test validations + } + + /** + * Test route, this shouldn't cause a compiler error + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOneOfWIthSameErasureGetTest() throws ApiException { + FakeOneOfWIthSameErasureGet200Response response = api.fakeOneOfWIthSameErasureGet(); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void fooGetTest() throws ApiException { + FooGetDefaultResponse response = api.fooGet(); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 000000000000..095dfdcd2304 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,395 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import org.openapitools.client.model.FakeRefParameterPetIdParameter; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.FreeFormObjectTestClass; +import org.openapitools.client.model.HealthCheckResult; +import java.time.LocalDate; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.NullableFieldsMapResponse; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.RequiredNullableBody; +import org.openapitools.client.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +@Disabled +public class FakeApiTest { + + private final FakeApi api = new FakeApi(); + + /** + * Get a free form object or Json string + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeGetFreeFormObjectGetTest() throws ApiException { + FreeFormObjectTestClass response = api.fakeGetFreeFormObjectGet(); + // TODO: test validations + } + + /** + * Test serialization of outer boolean types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterBooleanSerializeTest() throws ApiException { + Boolean body = null; + Boolean response = api.fakeOuterBooleanSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of object with outer number type + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterCompositeSerializeTest() throws ApiException { + OuterComposite outerComposite = null; + OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite); + // TODO: test validations + } + + /** + * Test serialization of outer number types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterNumberSerializeTest() throws ApiException { + BigDecimal body = null; + BigDecimal response = api.fakeOuterNumberSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of outer string types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterStringSerializeTest() throws ApiException { + String body = null; + String response = api.fakeOuterStringSerialize(body); + // TODO: test validations + } + + /** + * fake reference parameter + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeRefParameterTest() throws ApiException { + FakeRefParameterPetIdParameter petId = null; + api.fakeRefParameter(petId); + // TODO: test validations + } + + /** + * fields in the response body, required and nullable are both true + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeRequiredNullableBodyGetTest() throws ApiException { + RequiredNullableBody response = api.fakeRequiredNullableBodyGet(); + // TODO: test validations + } + + /** + * fake reference parameter + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeUploadRefRequestBodiesTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.fakeUploadRefRequestBodies(petId, additionalMetadata, _file); + // TODO: test validations + } + + /** + * Array of Enums + * + * @throws ApiException if the Api call fails + */ + @Test + public void getFakeArrayofenumsTest() throws ApiException { + List response = api.getFakeArrayofenums(); + // TODO: test validations + } + + /** + * Health check endpoint + * + * @throws ApiException if the Api call fails + */ + @Test + public void getFakeHealthTest() throws ApiException { + HealthCheckResult response = api.getFakeHealth(); + // TODO: test validations + } + + /** + * parameter name mapping test + * + * @throws ApiException if the Api call fails + */ + @Test + public void getParameterNameMappingTest() throws ApiException { + Long underscoreType = null; + String type = null; + String typeWithUnderscore = null; + api.getParameterNameMapping(underscoreType, type, typeWithUnderscore); + // TODO: test validations + } + + /** + * test referenced additionalProperties + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testAdditionalPropertiesReferenceTest() throws ApiException { + Map requestBody = null; + api.testAdditionalPropertiesReference(requestBody); + // TODO: test validations + } + + /** + * For this test, the body for this request much reference a schema named `File`. + * + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithFileSchemaTest() throws ApiException { + FileSchemaTestClass fileSchemaTestClass = null; + api.testBodyWithFileSchema(fileSchemaTestClass); + // TODO: test validations + } + + /** + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithQueryParamsTest() throws ApiException { + String query = null; + User user = null; + api.testBodyWithQueryParams(query, user); + // TODO: test validations + } + + /** + * To test \"client\" model + * + * To test \"client\" model + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClientModelTest() throws ApiException { + Client client = null; + Client response = api.testClientModel(client); + // TODO: test validations + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEndpointParametersTest() throws ApiException { + BigDecimal number = null; + Double _double = null; + String patternWithoutDelimiter = null; + byte[] _byte = null; + Integer integer = null; + Integer int32 = null; + Long int64 = null; + Float _float = null; + String string = null; + File binary = null; + LocalDate date = null; + OffsetDateTime dateTime = null; + String password = null; + String paramCallback = null; + api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + // TODO: test validations + } + + /** + * To test enum parameters + * + * To test enum parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEnumParametersTest() throws ApiException { + List enumHeaderStringArray = null; + String enumHeaderString = null; + List enumQueryStringArray = null; + String enumQueryString = null; + Integer enumQueryInteger = null; + Double enumQueryDouble = null; + List enumFormStringArray = null; + String enumFormString = null; + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + // TODO: test validations + } + + /** + * Fake endpoint to test group parameters (optional) + * + * Fake endpoint to test group parameters (optional) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testGroupParametersTest() throws ApiException { + Integer requiredStringGroup = null; + Boolean requiredBooleanGroup = null; + Long requiredInt64Group = null; + Integer stringGroup = null; + Boolean booleanGroup = null; + Long int64Group = null; + api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + // TODO: test validations + } + + /** + * test inline additionalProperties + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testInlineAdditionalPropertiesTest() throws ApiException { + Map requestBody = null; + api.testInlineAdditionalProperties(requestBody); + // TODO: test validations + } + + /** + * test inline free-form additionalProperties + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testInlineFreeformAdditionalPropertiesTest() throws ApiException { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = null; + api.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + // TODO: test validations + } + + /** + * test json serialization of form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testJsonFormDataTest() throws ApiException { + String param = null; + String param2 = null; + api.testJsonFormData(param, param2); + // TODO: test validations + } + + /** + * test anyOf with map of objects containing nullable required fields + * + * Tests that anyOf deserialization works when object values contain required fields that are nullable (e.g. Record<string, { before: string | null, after: string | null }>) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testNullableRequiredFieldsAnyOfTest() throws ApiException { + NullableFieldsMapResponse response = api.testNullableRequiredFieldsAnyOf(); + // TODO: test validations + } + + /** + * To test the collection format in query parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryParameterCollectionFormatTest() throws ApiException { + List pipe = null; + List ioutil = null; + List http = null; + List url = null; + List context = null; + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + // TODO: test validations + } + + /** + * test referenced string map + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void testStringMapReferenceTest() throws ApiException { + Map requestBody = null; + api.testStringMapReference(requestBody); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 000000000000..aa1b824dd5a2 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Client; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Disabled +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + /** + * To test class name in snake case + * + * To test class name in snake case + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + Client client = null; + Client response = api.testClassname(client); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..a1d3d6377d68 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,170 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Disabled +public class PetApiTest { + + private final PetApi api = new PetApi(); + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet pet = null; + api.addPet(pet); + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List status = null; + List response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List tags = null; + List response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet pet = null; + api.updatePet(pet); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String contentType = null; + String additionalMetadata = null; + File _file = null; + ModelApiResponse response = api.uploadFile(petId, contentType, additionalMetadata, _file); + // TODO: test validations + } + + /** + * uploads an image (required) + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileWithRequiredFileTest() throws ApiException { + Long petId = null; + File requiredFile = null; + String additionalMetadata = null; + ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..98354ba10c08 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,89 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +@Disabled +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = api.getOrderById(orderId); + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order order = null; + Order response = api.placeOrder(order); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..aa9aff49b4df --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,148 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import java.time.OffsetDateTime; +import org.openapitools.client.model.User; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +@Disabled +public class UserApiTest { + + private final UserApi api = new UserApi(); + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User user = null; + api.createUser(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List user = null; + api.createUsersWithArrayInput(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List user = null; + api.createUsersWithListInput(user); + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + api.deleteUser(username); + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + api.logoutUser(); + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User user = null; + api.updateUser(username, user); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/ValuesApiTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/ValuesApiTest.java new file mode 100644 index 000000000000..89a1ad0febc4 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/api/ValuesApiTest.java @@ -0,0 +1,47 @@ +/* + * 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.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Variable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for ValuesApi + */ +@Disabled +public class ValuesApiTest { + + private final ValuesApi api = new ValuesApi(); + + /** + * Get some primitive variable values + * + * + * + * @throws ApiException if the Api call fails + */ + @Test + public void getSomeValuesTest() throws ApiException { + Variable response = api.getSomeValues(); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..58554e4ec8ab --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AdditionalPropertiesClass + */ +public class AdditionalPropertiesClassTest { + private final AdditionalPropertiesClass model = new AdditionalPropertiesClass(); + + /** + * Model tests for AdditionalPropertiesClass + */ + @Test + public void testAdditionalPropertiesClass() { + // TODO: test AdditionalPropertiesClass + } + + /** + * Test the property 'mapProperty' + */ + @Test + public void mapPropertyTest() { + // TODO: test mapProperty + } + + /** + * Test the property 'mapOfMapProperty' + */ + @Test + public void mapOfMapPropertyTest() { + // TODO: test mapOfMapProperty + } + + /** + * Test the property 'anytype1' + */ + @Test + public void anytype1Test() { + // TODO: test anytype1 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype1' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype1Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype1 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype2' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype2Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype2 + } + + /** + * Test the property 'mapWithUndeclaredPropertiesAnytype3' + */ + @Test + public void mapWithUndeclaredPropertiesAnytype3Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype3 + } + + /** + * Test the property 'emptyMap' + */ + @Test + public void emptyMapTest() { + // TODO: test emptyMap + } + + /** + * Test the property 'mapWithUndeclaredPropertiesString' + */ + @Test + public void mapWithUndeclaredPropertiesStringTest() { + // TODO: test mapWithUndeclaredPropertiesString + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java new file mode 100644 index 000000000000..089fe1a41581 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Order; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfAttributesC + */ +public class AllOfModelArrayAnyOfAllOfAttributesCTest { + private final AllOfModelArrayAnyOfAllOfAttributesC model = new AllOfModelArrayAnyOfAllOfAttributesC(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfAttributesC + */ + @Test + public void testAllOfModelArrayAnyOfAllOfAttributesC() { + // TODO: test AllOfModelArrayAnyOfAllOfAttributesC + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java new file mode 100644 index 000000000000..46bcdfe1ac1c --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributesC; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfAttributes + */ +public class AllOfModelArrayAnyOfAllOfAttributesTest { + private final AllOfModelArrayAnyOfAllOfAttributes model = new AllOfModelArrayAnyOfAllOfAttributes(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfAttributes + */ + @Test + public void testAllOfModelArrayAnyOfAllOfAttributes() { + // TODO: test AllOfModelArrayAnyOfAllOfAttributes + } + + /** + * Test the property 'C' + */ + @Test + public void CTest() { + // TODO: test C + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java new file mode 100644 index 000000000000..26c849b8bc32 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1Value; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ +public class AllOfModelArrayAnyOfAllOfLinkListColumn1Test { + private final AllOfModelArrayAnyOfAllOfLinkListColumn1 model = new AllOfModelArrayAnyOfAllOfLinkListColumn1(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1 + */ + @Test + public void testAllOfModelArrayAnyOfAllOfLinkListColumn1() { + // TODO: test AllOfModelArrayAnyOfAllOfLinkListColumn1 + } + + /** + * Test the property 'value' + */ + @Test + public void valueTest() { + // TODO: test value + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java new file mode 100644 index 000000000000..b4c26f1034b6 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java @@ -0,0 +1,146 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Tag; +import org.openapitools.client.model.User; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1Value + */ +public class AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest { + private final AllOfModelArrayAnyOfAllOfLinkListColumn1Value model = new AllOfModelArrayAnyOfAllOfLinkListColumn1Value(); + + /** + * Model tests for AllOfModelArrayAnyOfAllOfLinkListColumn1Value + */ + @Test + public void testAllOfModelArrayAnyOfAllOfLinkListColumn1Value() { + // TODO: test AllOfModelArrayAnyOfAllOfLinkListColumn1Value + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + + /** + * Test the property 'objectWithNoDeclaredProps' + */ + @Test + public void objectWithNoDeclaredPropsTest() { + // TODO: test objectWithNoDeclaredProps + } + + /** + * Test the property 'objectWithNoDeclaredPropsNullable' + */ + @Test + public void objectWithNoDeclaredPropsNullableTest() { + // TODO: test objectWithNoDeclaredPropsNullable + } + + /** + * Test the property 'anyTypeProp' + */ + @Test + public void anyTypePropTest() { + // TODO: test anyTypeProp + } + + /** + * Test the property 'anyTypePropNullable' + */ + @Test + public void anyTypePropNullableTest() { + // TODO: test anyTypePropNullable + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java new file mode 100644 index 000000000000..1fd2cf6520f6 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfAttributes; +import org.openapitools.client.model.AllOfModelArrayAnyOfAllOfLinkListColumn1; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfModelArrayAnyOf + */ +public class AllOfModelArrayAnyOfTest { + private final AllOfModelArrayAnyOf model = new AllOfModelArrayAnyOf(); + + /** + * Model tests for AllOfModelArrayAnyOf + */ + @Test + public void testAllOfModelArrayAnyOf() { + // TODO: test AllOfModelArrayAnyOf + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'linkListColumn1' + */ + @Test + public void linkListColumn1Test() { + // TODO: test linkListColumn1 + } + + /** + * Test the property 'attributes' + */ + @Test + public void attributesTest() { + // TODO: test attributes + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java new file mode 100644 index 000000000000..d503e2af4937 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToDouble + */ +public class AllOfRefToDoubleTest { + private final AllOfRefToDouble model = new AllOfRefToDouble(); + + /** + * Model tests for AllOfRefToDouble + */ + @Test + public void testAllOfRefToDouble() { + // TODO: test AllOfRefToDouble + } + + /** + * Test the property 'height' + */ + @Test + public void heightTest() { + // TODO: test height + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java new file mode 100644 index 000000000000..4d86d0ee48c4 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToFloat + */ +public class AllOfRefToFloatTest { + private final AllOfRefToFloat model = new AllOfRefToFloat(); + + /** + * Model tests for AllOfRefToFloat + */ + @Test + public void testAllOfRefToFloat() { + // TODO: test AllOfRefToFloat + } + + /** + * Test the property 'weight' + */ + @Test + public void weightTest() { + // TODO: test weight + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java new file mode 100644 index 000000000000..8a33734fe8ba --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AllOfRefToLong + */ +public class AllOfRefToLongTest { + private final AllOfRefToLong model = new AllOfRefToLong(); + + /** + * Model tests for AllOfRefToLong + */ + @Test + public void testAllOfRefToLong() { + // TODO: test AllOfRefToLong + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AnimalTest.java new file mode 100644 index 000000000000..1fc472f0fafd --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Animal + */ +public class AnimalTest { + private final Animal model = new Animal(); + + /** + * Model tests for Animal + */ + @Test + public void testAnimal() { + // TODO: test Animal + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AppleReqTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AppleReqTest.java new file mode 100644 index 000000000000..8b42b3891120 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AppleReqTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AppleReq + */ +public class AppleReqTest { + private final AppleReq model = new AppleReq(); + + /** + * Model tests for AppleReq + */ + @Test + public void testAppleReq() { + // TODO: test AppleReq + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'mealy' + */ + @Test + public void mealyTest() { + // TODO: test mealy + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AppleTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AppleTest.java new file mode 100644 index 000000000000..1ff77d39e7e4 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/AppleTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Apple + */ +public class AppleTest { + private final Apple model = new Apple(); + + /** + * Model tests for Apple + */ + @Test + public void testApple() { + // TODO: test Apple + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java new file mode 100644 index 000000000000..ab635fd6b72f --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java @@ -0,0 +1,34 @@ +/* + * 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.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayAnyOf + */ +public class ArrayAnyOfTest { + private final ArrayAnyOf model = new ArrayAnyOf(); + + /** + * Model tests for ArrayAnyOf + */ + @Test + public void testArrayAnyOf() { + // TODO: test ArrayAnyOf + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java new file mode 100644 index 000000000000..fbeac01aad83 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayDefaultTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayDefault + */ +public class ArrayDefaultTest { + private final ArrayDefault model = new ArrayDefault(); + + /** + * Model tests for ArrayDefault + */ + @Test + public void testArrayDefault() { + // TODO: test ArrayDefault + } + + /** + * Test the property 'withDefaultEmptyBracket' + */ + @Test + public void withDefaultEmptyBracketTest() { + // TODO: test withDefaultEmptyBracket + } + + /** + * Test the property 'withoutDefault' + */ + @Test + public void withoutDefaultTest() { + // TODO: test withoutDefault + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..618a21c8a982 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfArrayOfNumberOnly + */ +public class ArrayOfArrayOfNumberOnlyTest { + private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfArrayOfNumberOnly + */ + @Test + public void testArrayOfArrayOfNumberOnly() { + // TODO: test ArrayOfArrayOfNumberOnly + } + + /** + * Test the property 'arrayArrayNumber' + */ + @Test + public void arrayArrayNumberTest() { + // TODO: test arrayArrayNumber + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java new file mode 100644 index 000000000000..5fa2e408c054 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ +public class ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest { + private final ArrayOfInlineAllOfArrayAllofDogPropertyInner model = new ArrayOfInlineAllOfArrayAllofDogPropertyInner(); + + /** + * Model tests for ArrayOfInlineAllOfArrayAllofDogPropertyInner + */ + @Test + public void testArrayOfInlineAllOfArrayAllofDogPropertyInner() { + // TODO: test ArrayOfInlineAllOfArrayAllofDogPropertyInner + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java new file mode 100644 index 000000000000..385ead61ffe5 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ArrayOfInlineAllOfArrayAllofDogPropertyInner; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfInlineAllOf + */ +public class ArrayOfInlineAllOfTest { + private final ArrayOfInlineAllOf model = new ArrayOfInlineAllOf(); + + /** + * Model tests for ArrayOfInlineAllOf + */ + @Test + public void testArrayOfInlineAllOf() { + // TODO: test ArrayOfInlineAllOf + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'arrayAllofDogProperty' + */ + @Test + public void arrayAllofDogPropertyTest() { + // TODO: test arrayAllofDogProperty + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..7121b15da89f --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfNumberOnly + */ +public class ArrayOfNumberOnlyTest { + private final ArrayOfNumberOnly model = new ArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfNumberOnly + */ + @Test + public void testArrayOfNumberOnly() { + // TODO: test ArrayOfNumberOnly + } + + /** + * Test the property 'arrayNumber' + */ + @Test + public void arrayNumberTest() { + // TODO: test arrayNumber + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java new file mode 100644 index 000000000000..7f9af8d893c0 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayOneOfTest.java @@ -0,0 +1,34 @@ +/* + * 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.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOneOf + */ +public class ArrayOneOfTest { + private final ArrayOneOf model = new ArrayOneOf(); + + /** + * Model tests for ArrayOneOf + */ + @Test + public void testArrayOneOf() { + // TODO: test ArrayOneOf + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayTestTest.java new file mode 100644 index 000000000000..da72462ec73d --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ArrayTestTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayTest + */ +public class ArrayTestTest { + private final ArrayTest model = new ArrayTest(); + + /** + * Model tests for ArrayTest + */ + @Test + public void testArrayTest() { + // TODO: test ArrayTest + } + + /** + * Test the property 'arrayOfString' + */ + @Test + public void arrayOfStringTest() { + // TODO: test arrayOfString + } + + /** + * Test the property 'arrayArrayOfInteger' + */ + @Test + public void arrayArrayOfIntegerTest() { + // TODO: test arrayArrayOfInteger + } + + /** + * Test the property 'arrayArrayOfModel' + */ + @Test + public void arrayArrayOfModelTest() { + // TODO: test arrayArrayOfModel + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/BananaReqTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/BananaReqTest.java new file mode 100644 index 000000000000..174945e25e00 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/BananaReqTest.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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BananaReq + */ +public class BananaReqTest { + private final BananaReq model = new BananaReq(); + + /** + * Model tests for BananaReq + */ + @Test + public void testBananaReq() { + // TODO: test BananaReq + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + + /** + * Test the property 'sweet' + */ + @Test + public void sweetTest() { + // TODO: test sweet + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/BananaTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/BananaTest.java new file mode 100644 index 000000000000..9845648b8231 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/BananaTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Banana + */ +public class BananaTest { + private final Banana model = new Banana(); + + /** + * Model tests for Banana + */ + @Test + public void testBanana() { + // TODO: test Banana + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/BasquePigTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/BasquePigTest.java new file mode 100644 index 000000000000..791dff9a9a0a --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/BasquePigTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BasquePig + */ +public class BasquePigTest { + private final BasquePig model = new BasquePig(); + + /** + * Model tests for BasquePig + */ + @Test + public void testBasquePig() { + // TODO: test BasquePig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/CapitalizationTest.java new file mode 100644 index 000000000000..8179ed092cc0 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/CapitalizationTest.java @@ -0,0 +1,87 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Capitalization + */ +public class CapitalizationTest { + private final Capitalization model = new Capitalization(); + + /** + * Model tests for Capitalization + */ + @Test + public void testCapitalization() { + // TODO: test Capitalization + } + + /** + * Test the property 'smallCamel' + */ + @Test + public void smallCamelTest() { + // TODO: test smallCamel + } + + /** + * Test the property 'capitalCamel' + */ + @Test + public void capitalCamelTest() { + // TODO: test capitalCamel + } + + /** + * Test the property 'smallSnake' + */ + @Test + public void smallSnakeTest() { + // TODO: test smallSnake + } + + /** + * Test the property 'capitalSnake' + */ + @Test + public void capitalSnakeTest() { + // TODO: test capitalSnake + } + + /** + * Test the property 'scAETHFlowPoints' + */ + @Test + public void scAETHFlowPointsTest() { + // TODO: test scAETHFlowPoints + } + + /** + * Test the property 'ATT_NAME' + */ + @Test + public void ATT_NAMETest() { + // TODO: test ATT_NAME + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/CatTest.java new file mode 100644 index 000000000000..9e33f659d39c --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/CatTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Map; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Cat + */ +public class CatTest { + private final Cat model = new Cat(); + + /** + * Model tests for Cat + */ + @Test + public void testCat() { + // TODO: test Cat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..6fc9054dd7f8 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ClassModelTest.java new file mode 100644 index 000000000000..23f382c5cbc5 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ClassModelTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ClassModel + */ +public class ClassModelTest { + private final ClassModel model = new ClassModel(); + + /** + * Model tests for ClassModel + */ + @Test + public void testClassModel() { + // TODO: test ClassModel + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ClientTest.java new file mode 100644 index 000000000000..35cf8622cdf9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ClientTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Client + */ +public class ClientTest { + private final Client model = new Client(); + + /** + * Model tests for Client + */ + @Test + public void testClient() { + // TODO: test Client + } + + /** + * Test the property 'client' + */ + @Test + public void clientTest() { + // TODO: test client + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java new file mode 100644 index 000000000000..1853277a9a68 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ComplexQuadrilateral + */ +public class ComplexQuadrilateralTest { + private final ComplexQuadrilateral model = new ComplexQuadrilateral(); + + /** + * Model tests for ComplexQuadrilateral + */ + @Test + public void testComplexQuadrilateral() { + // TODO: test ComplexQuadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DanishPigTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DanishPigTest.java new file mode 100644 index 000000000000..3dddb42b5063 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DanishPigTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DanishPig + */ +public class DanishPigTest { + private final DanishPig model = new DanishPig(); + + /** + * Model tests for DanishPig + */ + @Test + public void testDanishPig() { + // TODO: test DanishPig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java new file mode 100644 index 000000000000..2b0ac6f4e937 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for DeprecatedObject + */ +public class DeprecatedObjectTest { + private final DeprecatedObject model = new DeprecatedObject(); + + /** + * Model tests for DeprecatedObject + */ + @Test + public void testDeprecatedObject() { + // TODO: test DeprecatedObject + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DogTest.java new file mode 100644 index 000000000000..7a98584acd36 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DogTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Dog + */ +public class DogTest { + private final Dog model = new Dog(); + + /** + * Model tests for Dog + */ + @Test + public void testDog() { + // TODO: test Dog + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DrawingTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DrawingTest.java new file mode 100644 index 000000000000..d6834d1985e3 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/DrawingTest.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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Fruit; +import org.openapitools.client.model.NullableShape; +import org.openapitools.client.model.Shape; +import org.openapitools.client.model.ShapeOrNull; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Drawing + */ +public class DrawingTest { + private final Drawing model = new Drawing(); + + /** + * Model tests for Drawing + */ + @Test + public void testDrawing() { + // TODO: test Drawing + } + + /** + * Test the property 'mainShape' + */ + @Test + public void mainShapeTest() { + // TODO: test mainShape + } + + /** + * Test the property 'shapeOrNull' + */ + @Test + public void shapeOrNullTest() { + // TODO: test shapeOrNull + } + + /** + * Test the property 'nullableShape' + */ + @Test + public void nullableShapeTest() { + // TODO: test nullableShape + } + + /** + * Test the property 'shapes' + */ + @Test + public void shapesTest() { + // TODO: test shapes + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumArraysTest.java new file mode 100644 index 000000000000..02954e6a6839 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumArraysTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumArrays + */ +public class EnumArraysTest { + private final EnumArrays model = new EnumArrays(); + + /** + * Model tests for EnumArrays + */ + @Test + public void testEnumArrays() { + // TODO: test EnumArrays + } + + /** + * Test the property 'justSymbol' + */ + @Test + public void justSymbolTest() { + // TODO: test justSymbol + } + + /** + * Test the property 'arrayEnum' + */ + @Test + public void arrayEnumTest() { + // TODO: test arrayEnum + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumClassTest.java new file mode 100644 index 000000000000..bed8681219e8 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumClassTest.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.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumClass + */ +public class EnumClassTest { + /** + * Model tests for EnumClass + */ + @Test + public void testEnumClass() { + // TODO: test EnumClass + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java new file mode 100644 index 000000000000..92938e2e0ce9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumStringDiscriminator + */ +public class EnumStringDiscriminatorTest { + private final EnumStringDiscriminator model = new EnumStringDiscriminator(); + + /** + * Model tests for EnumStringDiscriminator + */ + @Test + public void testEnumStringDiscriminator() { + // TODO: test EnumStringDiscriminator + } + + /** + * Test the property 'enumStrType' + */ + @Test + public void enumStrTypeTest() { + // TODO: test enumStrType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumTestTest.java new file mode 100644 index 000000000000..bd1c415bb48f --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EnumTestTest.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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +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 org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EnumTest + */ +public class EnumTestTest { + private final EnumTest model = new EnumTest(); + + /** + * Model tests for EnumTest + */ + @Test + public void testEnumTest() { + // TODO: test EnumTest + } + + /** + * Test the property 'enumString' + */ + @Test + public void enumStringTest() { + // TODO: test enumString + } + + /** + * Test the property 'enumStringRequired' + */ + @Test + public void enumStringRequiredTest() { + // TODO: test enumStringRequired + } + + /** + * Test the property 'enumInteger' + */ + @Test + public void enumIntegerTest() { + // TODO: test enumInteger + } + + /** + * Test the property 'enumIntegerOnly' + */ + @Test + public void enumIntegerOnlyTest() { + // TODO: test enumIntegerOnly + } + + /** + * Test the property 'enumNumber' + */ + @Test + public void enumNumberTest() { + // TODO: test enumNumber + } + + /** + * Test the property 'outerEnum' + */ + @Test + public void outerEnumTest() { + // TODO: test outerEnum + } + + /** + * Test the property 'outerEnumInteger' + */ + @Test + public void outerEnumIntegerTest() { + // TODO: test outerEnumInteger + } + + /** + * Test the property 'outerEnumDefaultValue' + */ + @Test + public void outerEnumDefaultValueTest() { + // TODO: test outerEnumDefaultValue + } + + /** + * Test the property 'outerEnumIntegerDefaultValue' + */ + @Test + public void outerEnumIntegerDefaultValueTest() { + // TODO: test outerEnumIntegerDefaultValue + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java new file mode 100644 index 000000000000..00574a7ba939 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for EquilateralTriangle + */ +public class EquilateralTriangleTest { + private final EquilateralTriangle model = new EquilateralTriangle(); + + /** + * Model tests for EquilateralTriangle + */ + @Test + public void testEquilateralTriangle() { + // TODO: test EquilateralTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java new file mode 100644 index 000000000000..22408ad06868 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java @@ -0,0 +1,34 @@ +/* + * 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.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeAnyOfWIthSameErasureGet200Response + */ +public class FakeAnyOfWIthSameErasureGet200ResponseTest { + private final FakeAnyOfWIthSameErasureGet200Response model = new FakeAnyOfWIthSameErasureGet200Response(); + + /** + * Model tests for FakeAnyOfWIthSameErasureGet200Response + */ + @Test + public void testFakeAnyOfWIthSameErasureGet200Response() { + // TODO: test FakeAnyOfWIthSameErasureGet200Response + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java new file mode 100644 index 000000000000..4a0bd78cb384 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java @@ -0,0 +1,34 @@ +/* + * 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.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeOneOfWIthSameErasureGet200Response + */ +public class FakeOneOfWIthSameErasureGet200ResponseTest { + private final FakeOneOfWIthSameErasureGet200Response model = new FakeOneOfWIthSameErasureGet200Response(); + + /** + * Model tests for FakeOneOfWIthSameErasureGet200Response + */ + @Test + public void testFakeOneOfWIthSameErasureGet200Response() { + // TODO: test FakeOneOfWIthSameErasureGet200Response + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java new file mode 100644 index 000000000000..5d6fca30c3e2 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.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.model; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeRefParameterPetIdParameter + */ +public class FakeRefParameterPetIdParameterTest { + private final FakeRefParameterPetIdParameter model = new FakeRefParameterPetIdParameter(); + + /** + * Model tests for FakeRefParameterPetIdParameter + */ + @Test + public void testFakeRefParameterPetIdParameter() { + // TODO: test FakeRefParameterPetIdParameter + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java new file mode 100644 index 000000000000..79eccbf4beef --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.ModelFile; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FileSchemaTestClass + */ +public class FileSchemaTestClassTest { + private final FileSchemaTestClass model = new FileSchemaTestClass(); + + /** + * Model tests for FileSchemaTestClass + */ + @Test + public void testFileSchemaTestClass() { + // TODO: test FileSchemaTestClass + } + + /** + * Test the property '_file' + */ + @Test + public void _fileTest() { + // TODO: test _file + } + + /** + * Test the property 'files' + */ + @Test + public void filesTest() { + // TODO: test files + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java new file mode 100644 index 000000000000..91db73fc9f04 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Foo; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FooGetDefaultResponse + */ +public class FooGetDefaultResponseTest { + private final FooGetDefaultResponse model = new FooGetDefaultResponse(); + + /** + * Model tests for FooGetDefaultResponse + */ + @Test + public void testFooGetDefaultResponse() { + // TODO: test FooGetDefaultResponse + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FooTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FooTest.java new file mode 100644 index 000000000000..2728f0c52e7f --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FooTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Foo + */ +public class FooTest { + private final Foo model = new Foo(); + + /** + * Model tests for Foo + */ + @Test + public void testFoo() { + // TODO: test Foo + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FormatTestTest.java new file mode 100644 index 000000000000..a576ea952e55 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -0,0 +1,180 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.File; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FormatTest + */ +public class FormatTestTest { + private final FormatTest model = new FormatTest(); + + /** + * Model tests for FormatTest + */ + @Test + public void testFormatTest() { + // TODO: test FormatTest + } + + /** + * Test the property 'integer' + */ + @Test + public void integerTest() { + // TODO: test integer + } + + /** + * Test the property 'int32' + */ + @Test + public void int32Test() { + // TODO: test int32 + } + + /** + * Test the property 'int64' + */ + @Test + public void int64Test() { + // TODO: test int64 + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property '_float' + */ + @Test + public void _floatTest() { + // TODO: test _float + } + + /** + * Test the property '_double' + */ + @Test + public void _doubleTest() { + // TODO: test _double + } + + /** + * Test the property 'decimal' + */ + @Test + public void decimalTest() { + // TODO: test decimal + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + + /** + * Test the property '_byte' + */ + @Test + public void _byteTest() { + // TODO: test _byte + } + + /** + * Test the property 'binary' + */ + @Test + public void binaryTest() { + // TODO: test binary + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'uuidWithDefault' + */ + @Test + public void uuidWithDefaultTest() { + // TODO: test uuidWithDefault + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'patternWithDigits' + */ + @Test + public void patternWithDigitsTest() { + // TODO: test patternWithDigits + } + + /** + * Test the property 'patternWithDigitsAndDelimiter' + */ + @Test + public void patternWithDigitsAndDelimiterTest() { + // TODO: test patternWithDigitsAndDelimiter + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java new file mode 100644 index 000000000000..32a85ee296b7 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java @@ -0,0 +1,34 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FreeFormObjectTestClassProperties + */ +public class FreeFormObjectTestClassPropertiesTest { + private final FreeFormObjectTestClassProperties model = new FreeFormObjectTestClassProperties(); + + /** + * Model tests for FreeFormObjectTestClassProperties + */ + @Test + public void testFreeFormObjectTestClassProperties() { + // TODO: test FreeFormObjectTestClassProperties + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java new file mode 100644 index 000000000000..d01dfaaaf070 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.FreeFormObjectTestClassProperties; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FreeFormObjectTestClass + */ +public class FreeFormObjectTestClassTest { + private final FreeFormObjectTestClass model = new FreeFormObjectTestClass(); + + /** + * Model tests for FreeFormObjectTestClass + */ + @Test + public void testFreeFormObjectTestClass() { + // TODO: test FreeFormObjectTestClass + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'properties' + */ + @Test + public void propertiesTest() { + // TODO: test properties + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FruitReqTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FruitReqTest.java new file mode 100644 index 000000000000..bd1480e10761 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FruitReqTest.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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FruitReq + */ +public class FruitReqTest { + private final FruitReq model = new FruitReq(); + + /** + * Model tests for FruitReq + */ + @Test + public void testFruitReq() { + // TODO: test FruitReq + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'mealy' + */ + @Test + public void mealyTest() { + // TODO: test mealy + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + + /** + * Test the property 'sweet' + */ + @Test + public void sweetTest() { + // TODO: test sweet + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FruitTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FruitTest.java new file mode 100644 index 000000000000..f298a44cb92b --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/FruitTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Fruit + */ +public class FruitTest { + private final Fruit model = new Fruit(); + + /** + * Model tests for Fruit + */ + @Test + public void testFruit() { + // TODO: test Fruit + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/GmFruitTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/GmFruitTest.java new file mode 100644 index 000000000000..5f29d7847ea9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/GmFruitTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for GmFruit + */ +public class GmFruitTest { + private final GmFruit model = new GmFruit(); + + /** + * Model tests for GmFruit + */ + @Test + public void testGmFruit() { + // TODO: test GmFruit + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java new file mode 100644 index 000000000000..74d91026b542 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for GrandparentAnimal + */ +public class GrandparentAnimalTest { + private final GrandparentAnimal model = new GrandparentAnimal(); + + /** + * Model tests for GrandparentAnimal + */ + @Test + public void testGrandparentAnimal() { + // TODO: test GrandparentAnimal + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java new file mode 100644 index 000000000000..e9f2e0e27d9d --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HasOnlyReadOnly + */ +public class HasOnlyReadOnlyTest { + private final HasOnlyReadOnly model = new HasOnlyReadOnly(); + + /** + * Model tests for HasOnlyReadOnly + */ + @Test + public void testHasOnlyReadOnly() { + // TODO: test HasOnlyReadOnly + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'foo' + */ + @Test + public void fooTest() { + // TODO: test foo + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java new file mode 100644 index 000000000000..e66a22ade4d2 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for HealthCheckResult + */ +public class HealthCheckResultTest { + private final HealthCheckResult model = new HealthCheckResult(); + + /** + * Model tests for HealthCheckResult + */ + @Test + public void testHealthCheckResult() { + // TODO: test HealthCheckResult + } + + /** + * Test the property 'nullableMessage' + */ + @Test + public void nullableMessageTest() { + // TODO: test nullableMessage + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java new file mode 100644 index 000000000000..6b4a2fee6d47 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for IsoscelesTriangle + */ +public class IsoscelesTriangleTest { + private final IsoscelesTriangle model = new IsoscelesTriangle(); + + /** + * Model tests for IsoscelesTriangle + */ + @Test + public void testIsoscelesTriangle() { + // TODO: test IsoscelesTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MammalAnyofTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MammalAnyofTest.java new file mode 100644 index 000000000000..931809d866bf --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MammalAnyofTest.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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MammalAnyof + */ +public class MammalAnyofTest { + private final MammalAnyof model = new MammalAnyof(); + + /** + * Model tests for MammalAnyof + */ + @Test + public void testMammalAnyof() { + // TODO: test MammalAnyof + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MammalTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MammalTest.java new file mode 100644 index 000000000000..169a9a1c62d7 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MammalTest.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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Mammal + */ +public class MammalTest { + private final Mammal model = new Mammal(); + + /** + * Model tests for Mammal + */ + @Test + public void testMammal() { + // TODO: test Mammal + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MapTestTest.java new file mode 100644 index 000000000000..5d038c2d0fe8 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MapTestTest.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MapTest + */ +public class MapTestTest { + private final MapTest model = new MapTest(); + + /** + * Model tests for MapTest + */ + @Test + public void testMapTest() { + // TODO: test MapTest + } + + /** + * Test the property 'mapMapOfString' + */ + @Test + public void mapMapOfStringTest() { + // TODO: test mapMapOfString + } + + /** + * Test the property 'mapOfEnumString' + */ + @Test + public void mapOfEnumStringTest() { + // TODO: test mapOfEnumString + } + + /** + * Test the property 'directMap' + */ + @Test + public void directMapTest() { + // TODO: test directMap + } + + /** + * Test the property 'indirectMap' + */ + @Test + public void indirectMapTest() { + // TODO: test indirectMap + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..17838591172d --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java @@ -0,0 +1,68 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ +public class MixedPropertiesAndAdditionalPropertiesClassTest { + private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass(); + + /** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ + @Test + public void testMixedPropertiesAndAdditionalPropertiesClass() { + // TODO: test MixedPropertiesAndAdditionalPropertiesClass + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'map' + */ + @Test + public void mapTest() { + // TODO: test map + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/Model200ResponseTest.java new file mode 100644 index 000000000000..f2d8b804c0b9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/Model200ResponseTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Model200Response + */ +public class Model200ResponseTest { + private final Model200Response model = new Model200Response(); + + /** + * Model tests for Model200Response + */ + @Test + public void testModel200Response() { + // TODO: test Model200Response + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..b0d5fa0ec460 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelFileTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelFileTest.java new file mode 100644 index 000000000000..03567262c412 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelFileTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelFile + */ +public class ModelFileTest { + private final ModelFile model = new ModelFile(); + + /** + * Model tests for ModelFile + */ + @Test + public void testModelFile() { + // TODO: test ModelFile + } + + /** + * Test the property 'sourceURI' + */ + @Test + public void sourceURITest() { + // TODO: test sourceURI + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelListTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelListTest.java new file mode 100644 index 000000000000..670e48650b33 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelListTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelList + */ +public class ModelListTest { + private final ModelList model = new ModelList(); + + /** + * Model tests for ModelList + */ + @Test + public void testModelList() { + // TODO: test ModelList + } + + /** + * Test the property '_123list' + */ + @Test + public void _123listTest() { + // TODO: test _123list + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelReturnTest.java new file mode 100644 index 000000000000..74f4be0f5993 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelReturnTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelReturn + */ +public class ModelReturnTest { + private final ModelReturn model = new ModelReturn(); + + /** + * Model tests for ModelReturn + */ + @Test + public void testModelReturn() { + // TODO: test ModelReturn + } + + /** + * Test the property '_return' + */ + @Test + public void _returnTest() { + // TODO: test _return + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java new file mode 100644 index 000000000000..641fd15c14a9 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.ArrayAnyOf; +import org.openapitools.client.model.ArrayOneOf; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ModelWithOneOfAnyOfProperties + */ +public class ModelWithOneOfAnyOfPropertiesTest { + private final ModelWithOneOfAnyOfProperties model = new ModelWithOneOfAnyOfProperties(); + + /** + * Model tests for ModelWithOneOfAnyOfProperties + */ + @Test + public void testModelWithOneOfAnyOfProperties() { + // TODO: test ModelWithOneOfAnyOfProperties + } + + /** + * Test the property 'oneofProp' + */ + @Test + public void oneofPropTest() { + // TODO: test oneofProp + } + + /** + * Test the property 'anyofProp' + */ + @Test + public void anyofPropTest() { + // TODO: test anyofProp + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NameTest.java new file mode 100644 index 000000000000..83b9901518f7 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NameTest.java @@ -0,0 +1,71 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Name + */ +public class NameTest { + private final Name model = new Name(); + + /** + * Model tests for Name + */ + @Test + public void testName() { + // TODO: test Name + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'snakeCase' + */ + @Test + public void snakeCaseTest() { + // TODO: test snakeCase + } + + /** + * Test the property 'property' + */ + @Test + public void propertyTest() { + // TODO: test property + } + + /** + * Test the property '_123number' + */ + @Test + public void _123numberTest() { + // TODO: test _123number + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java new file mode 100644 index 000000000000..417d2f5d90f2 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NestedArrayWithDefaultValues + */ +public class NestedArrayWithDefaultValuesTest { + private final NestedArrayWithDefaultValues model = new NestedArrayWithDefaultValues(); + + /** + * Model tests for NestedArrayWithDefaultValues + */ + @Test + public void testNestedArrayWithDefaultValues() { + // TODO: test NestedArrayWithDefaultValues + } + + /** + * Test the property 'nestedArray' + */ + @Test + public void nestedArrayTest() { + // TODO: test nestedArray + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java new file mode 100644 index 000000000000..a06ff0a63d43 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NewPetCategoryInlineAllofAllOfCategoryTag + */ +public class NewPetCategoryInlineAllofAllOfCategoryTagTest { + private final NewPetCategoryInlineAllofAllOfCategoryTag model = new NewPetCategoryInlineAllofAllOfCategoryTag(); + + /** + * Model tests for NewPetCategoryInlineAllofAllOfCategoryTag + */ + @Test + public void testNewPetCategoryInlineAllofAllOfCategoryTag() { + // TODO: test NewPetCategoryInlineAllofAllOfCategoryTag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java new file mode 100644 index 000000000000..82894a281ee6 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.NewPetCategoryInlineAllofAllOfCategoryTag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NewPetCategoryInlineAllof + */ +public class NewPetCategoryInlineAllofTest { + private final NewPetCategoryInlineAllof model = new NewPetCategoryInlineAllof(); + + /** + * Model tests for NewPetCategoryInlineAllof + */ + @Test + public void testNewPetCategoryInlineAllof() { + // TODO: test NewPetCategoryInlineAllof + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'categoryTag' + */ + @Test + public void categoryTagTest() { + // TODO: test categoryTag + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NewPetTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NewPetTest.java new file mode 100644 index 000000000000..1649c8c2a7eb --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NewPetTest.java @@ -0,0 +1,117 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.NewPetCategoryInlineAllof; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NewPet + */ +public class NewPetTest { + private final NewPet model = new NewPet(); + + /** + * Model tests for NewPet + */ + @Test + public void testNewPet() { + // TODO: test NewPet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'categoryInlineAllof' + */ + @Test + public void categoryInlineAllofTest() { + // TODO: test categoryInlineAllof + } + + /** + * Test the property 'categoryAllOfRef' + */ + @Test + public void categoryAllOfRefTest() { + // TODO: test categoryAllOfRef + } + + /** + * Test the property 'categoryAllOfRefDescription' + */ + @Test + public void categoryAllOfRefDescriptionTest() { + // TODO: test categoryAllOfRefDescription + } + + /** + * Test the property 'categoryAllOfRefDescriptionReadonly' + */ + @Test + public void categoryAllOfRefDescriptionReadonlyTest() { + // TODO: test categoryAllOfRefDescriptionReadonly + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableClassTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableClassTest.java new file mode 100644 index 000000000000..0a0595ca0e65 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableClassTest.java @@ -0,0 +1,144 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableClass + */ +public class NullableClassTest { + private final NullableClass model = new NullableClass(); + + /** + * Model tests for NullableClass + */ + @Test + public void testNullableClass() { + // TODO: test NullableClass + } + + /** + * Test the property 'integerProp' + */ + @Test + public void integerPropTest() { + // TODO: test integerProp + } + + /** + * Test the property 'numberProp' + */ + @Test + public void numberPropTest() { + // TODO: test numberProp + } + + /** + * Test the property 'booleanProp' + */ + @Test + public void booleanPropTest() { + // TODO: test booleanProp + } + + /** + * Test the property 'stringProp' + */ + @Test + public void stringPropTest() { + // TODO: test stringProp + } + + /** + * Test the property 'dateProp' + */ + @Test + public void datePropTest() { + // TODO: test dateProp + } + + /** + * Test the property 'datetimeProp' + */ + @Test + public void datetimePropTest() { + // TODO: test datetimeProp + } + + /** + * Test the property 'arrayNullableProp' + */ + @Test + public void arrayNullablePropTest() { + // TODO: test arrayNullableProp + } + + /** + * Test the property 'arrayAndItemsNullableProp' + */ + @Test + public void arrayAndItemsNullablePropTest() { + // TODO: test arrayAndItemsNullableProp + } + + /** + * Test the property 'arrayItemsNullable' + */ + @Test + public void arrayItemsNullableTest() { + // TODO: test arrayItemsNullable + } + + /** + * Test the property 'objectNullableProp' + */ + @Test + public void objectNullablePropTest() { + // TODO: test objectNullableProp + } + + /** + * Test the property 'objectAndItemsNullableProp' + */ + @Test + public void objectAndItemsNullablePropTest() { + // TODO: test objectAndItemsNullableProp + } + + /** + * Test the property 'objectItemsNullable' + */ + @Test + public void objectItemsNullableTest() { + // TODO: test objectItemsNullable + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableEnumTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableEnumTest.java new file mode 100644 index 000000000000..8bcd02d221e0 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableEnumTest.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.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableEnum + */ +public class NullableEnumTest { + /** + * Model tests for NullableEnum + */ + @Test + public void testNullableEnum() { + // TODO: test NullableEnum + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java new file mode 100644 index 000000000000..607852269149 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsMapError + */ +public class NullableFieldsMapErrorTest { + private final NullableFieldsMapError model = new NullableFieldsMapError(); + + /** + * Model tests for NullableFieldsMapError + */ + @Test + public void testNullableFieldsMapError() { + // TODO: test NullableFieldsMapError + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'reason' + */ + @Test + public void reasonTest() { + // TODO: test reason + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java new file mode 100644 index 000000000000..fd8899f1cfd5 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java @@ -0,0 +1,68 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsMapError; +import org.openapitools.client.model.NullableFieldsMapSuccess; +import org.openapitools.client.model.NullableFieldsValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsMapResponse + */ +public class NullableFieldsMapResponseTest { + private final NullableFieldsMapResponse model = new NullableFieldsMapResponse(); + + /** + * Model tests for NullableFieldsMapResponse + */ + @Test + public void testNullableFieldsMapResponse() { + // TODO: test NullableFieldsMapResponse + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'positions' + */ + @Test + public void positionsTest() { + // TODO: test positions + } + + /** + * Test the property 'reason' + */ + @Test + public void reasonTest() { + // TODO: test reason + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java new file mode 100644 index 000000000000..3db23e24446a --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.client.model.NullableFieldsValue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsMapSuccess + */ +public class NullableFieldsMapSuccessTest { + private final NullableFieldsMapSuccess model = new NullableFieldsMapSuccess(); + + /** + * Model tests for NullableFieldsMapSuccess + */ + @Test + public void testNullableFieldsMapSuccess() { + // TODO: test NullableFieldsMapSuccess + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'positions' + */ + @Test + public void positionsTest() { + // TODO: test positions + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java new file mode 100644 index 000000000000..919338e6e501 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableFieldsValue + */ +public class NullableFieldsValueTest { + private final NullableFieldsValue model = new NullableFieldsValue(); + + /** + * Model tests for NullableFieldsValue + */ + @Test + public void testNullableFieldsValue() { + // TODO: test NullableFieldsValue + } + + /** + * Test the property 'before' + */ + @Test + public void beforeTest() { + // TODO: test before + } + + /** + * Test the property 'after' + */ + @Test + public void afterTest() { + // TODO: test after + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableShapeTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableShapeTest.java new file mode 100644 index 000000000000..80dfa386455c --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NullableShapeTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NullableShape + */ +public class NullableShapeTest { + private final NullableShape model = new NullableShape(); + + /** + * Model tests for NullableShape + */ + @Test + public void testNullableShape() { + // TODO: test NullableShape + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NumberOnlyTest.java new file mode 100644 index 000000000000..263fba35a860 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/NumberOnlyTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for NumberOnly + */ +public class NumberOnlyTest { + private final NumberOnly model = new NumberOnly(); + + /** + * Model tests for NumberOnly + */ + @Test + public void testNumberOnly() { + // TODO: test NumberOnly + } + + /** + * Test the property 'justNumber' + */ + @Test + public void justNumberTest() { + // TODO: test justNumber + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java new file mode 100644 index 000000000000..452495e83d31 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.DeprecatedObject; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ObjectWithDeprecatedFields + */ +public class ObjectWithDeprecatedFieldsTest { + private final ObjectWithDeprecatedFields model = new ObjectWithDeprecatedFields(); + + /** + * Model tests for ObjectWithDeprecatedFields + */ + @Test + public void testObjectWithDeprecatedFields() { + // TODO: test ObjectWithDeprecatedFields + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'deprecatedRef' + */ + @Test + public void deprecatedRefTest() { + // TODO: test deprecatedRef + } + + /** + * Test the property 'bars' + */ + @Test + public void barsTest() { + // TODO: test bars + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..023271431452 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterCompositeTest.java new file mode 100644 index 000000000000..5ed682c3550d --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterCompositeTest.java @@ -0,0 +1,64 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterComposite + */ +public class OuterCompositeTest { + private final OuterComposite model = new OuterComposite(); + + /** + * Model tests for OuterComposite + */ + @Test + public void testOuterComposite() { + // TODO: test OuterComposite + } + + /** + * Test the property 'myNumber' + */ + @Test + public void myNumberTest() { + // TODO: test myNumber + } + + /** + * Test the property 'myString' + */ + @Test + public void myStringTest() { + // TODO: test myString + } + + /** + * Test the property 'myBoolean' + */ + @Test + public void myBooleanTest() { + // TODO: test myBoolean + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java new file mode 100644 index 000000000000..6b324784e1d6 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.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.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumDefaultValue + */ +public class OuterEnumDefaultValueTest { + /** + * Model tests for OuterEnumDefaultValue + */ + @Test + public void testOuterEnumDefaultValue() { + // TODO: test OuterEnumDefaultValue + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java new file mode 100644 index 000000000000..ffb20a97973b --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.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.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumIntegerDefaultValue + */ +public class OuterEnumIntegerDefaultValueTest { + /** + * Model tests for OuterEnumIntegerDefaultValue + */ + @Test + public void testOuterEnumIntegerDefaultValue() { + // TODO: test OuterEnumIntegerDefaultValue + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java new file mode 100644 index 000000000000..be0665bb740e --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.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.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnumInteger + */ +public class OuterEnumIntegerTest { + /** + * Model tests for OuterEnumInteger + */ + @Test + public void testOuterEnumInteger() { + // TODO: test OuterEnumInteger + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumTest.java new file mode 100644 index 000000000000..8ab11b65cbde --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/OuterEnumTest.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.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for OuterEnum + */ +public class OuterEnumTest { + /** + * Model tests for OuterEnum + */ + @Test + public void testOuterEnum() { + // TODO: test OuterEnum + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ParentPetTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ParentPetTest.java new file mode 100644 index 000000000000..ff05354d318c --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ParentPetTest.java @@ -0,0 +1,48 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.GrandparentAnimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ParentPet + */ +public class ParentPetTest { + private final ParentPet model = new ParentPet(); + + /** + * Model tests for ParentPet + */ + @Test + public void testParentPet() { + // TODO: test ParentPet + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetCompositionTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetCompositionTest.java new file mode 100644 index 000000000000..7429b7afc0f5 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetCompositionTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetComposition + */ +public class PetCompositionTest { + private final PetComposition model = new PetComposition(); + + /** + * Model tests for PetComposition + */ + @Test + public void testPetComposition() { + // TODO: test PetComposition + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetRefTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetRefTest.java new file mode 100644 index 000000000000..a47d91415890 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetRefTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetRef + */ +public class PetRefTest { + private final PetRef model = new PetRef(); + + /** + * Model tests for PetRef + */ + @Test + public void testPetRef() { + // TODO: test PetRef + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..2dd31e219736 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java new file mode 100644 index 000000000000..62afc3dbcfe7 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetUsingAllOf + */ +public class PetUsingAllOfTest { + private final PetUsingAllOf model = new PetUsingAllOf(); + + /** + * Model tests for PetUsingAllOf + */ + @Test + public void testPetUsingAllOf() { + // TODO: test PetUsingAllOf + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java new file mode 100644 index 000000000000..a338a337dc6d --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PetWithRequiredTags + */ +public class PetWithRequiredTagsTest { + private final PetWithRequiredTags model = new PetWithRequiredTags(); + + /** + * Model tests for PetWithRequiredTags + */ + @Test + public void testPetWithRequiredTags() { + // TODO: test PetWithRequiredTags + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PigTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PigTest.java new file mode 100644 index 000000000000..ee15260d7184 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PigTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.DanishPig; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Pig + */ +public class PigTest { + private final Pig model = new Pig(); + + /** + * Model tests for Pig + */ + @Test + public void testPig() { + // TODO: test Pig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java new file mode 100644 index 000000000000..112efcc90a2e --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for PropertyNameCollision + */ +public class PropertyNameCollisionTest { + private final PropertyNameCollision model = new PropertyNameCollision(); + + /** + * Model tests for PropertyNameCollision + */ + @Test + public void testPropertyNameCollision() { + // TODO: test PropertyNameCollision + } + + /** + * Test the property 'underscoreType' + */ + @Test + public void underscoreTypeTest() { + // TODO: test underscoreType + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'typeWithUnderscore' + */ + @Test + public void typeWithUnderscoreTest() { + // TODO: test typeWithUnderscore + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java new file mode 100644 index 000000000000..5c857a2417ce --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for QuadrilateralInterface + */ +public class QuadrilateralInterfaceTest { + private final QuadrilateralInterface model = new QuadrilateralInterface(); + + /** + * Model tests for QuadrilateralInterface + */ + @Test + public void testQuadrilateralInterface() { + // TODO: test QuadrilateralInterface + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/QuadrilateralTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/QuadrilateralTest.java new file mode 100644 index 000000000000..5312bdf72ab7 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/QuadrilateralTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Quadrilateral + */ +public class QuadrilateralTest { + private final Quadrilateral model = new Quadrilateral(); + + /** + * Model tests for Quadrilateral + */ + @Test + public void testQuadrilateral() { + // TODO: test Quadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java new file mode 100644 index 000000000000..290d52b66012 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ReadOnlyFirst + */ +public class ReadOnlyFirstTest { + private final ReadOnlyFirst model = new ReadOnlyFirst(); + + /** + * Model tests for ReadOnlyFirst + */ + @Test + public void testReadOnlyFirst() { + // TODO: test ReadOnlyFirst + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'baz' + */ + @Test + public void bazTest() { + // TODO: test baz + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java new file mode 100644 index 000000000000..4adb311eb1ea --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java @@ -0,0 +1,160 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.client.model.NullableEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for RequiredNullableBody + */ +public class RequiredNullableBodyTest { + private final RequiredNullableBody model = new RequiredNullableBody(); + + /** + * Model tests for RequiredNullableBody + */ + @Test + public void testRequiredNullableBody() { + // TODO: test RequiredNullableBody + } + + /** + * Test the property 'integerProp' + */ + @Test + public void integerPropTest() { + // TODO: test integerProp + } + + /** + * Test the property 'numberProp' + */ + @Test + public void numberPropTest() { + // TODO: test numberProp + } + + /** + * Test the property 'booleanProp' + */ + @Test + public void booleanPropTest() { + // TODO: test booleanProp + } + + /** + * Test the property 'stringProp' + */ + @Test + public void stringPropTest() { + // TODO: test stringProp + } + + /** + * Test the property 'dateProp' + */ + @Test + public void datePropTest() { + // TODO: test dateProp + } + + /** + * Test the property 'datetimeProp' + */ + @Test + public void datetimePropTest() { + // TODO: test datetimeProp + } + + /** + * Test the property 'arrayNullableProp' + */ + @Test + public void arrayNullablePropTest() { + // TODO: test arrayNullableProp + } + + /** + * Test the property 'arrayAndItemsNullableProp' + */ + @Test + public void arrayAndItemsNullablePropTest() { + // TODO: test arrayAndItemsNullableProp + } + + /** + * Test the property 'arrayItemsNullable' + */ + @Test + public void arrayItemsNullableTest() { + // TODO: test arrayItemsNullable + } + + /** + * Test the property 'objectNullableProp' + */ + @Test + public void objectNullablePropTest() { + // TODO: test objectNullableProp + } + + /** + * Test the property 'objectAndItemsNullableProp' + */ + @Test + public void objectAndItemsNullablePropTest() { + // TODO: test objectAndItemsNullableProp + } + + /** + * Test the property 'objectItemsNullable' + */ + @Test + public void objectItemsNullableTest() { + // TODO: test objectItemsNullable + } + + /** + * Test the property 'customRefEnum' + */ + @Test + public void customRefEnumTest() { + // TODO: test customRefEnum + } + + /** + * Test the property 'customEnum' + */ + @Test + public void customEnumTest() { + // TODO: test customEnum + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java new file mode 100644 index 000000000000..bf1d99112e63 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java @@ -0,0 +1,35 @@ +/* + * 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.math.BigDecimal; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ScalarAnyOf + */ +public class ScalarAnyOfTest { + private final ScalarAnyOf model = new ScalarAnyOf(); + + /** + * Model tests for ScalarAnyOf + */ + @Test + public void testScalarAnyOf() { + // TODO: test ScalarAnyOf + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ScalarTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ScalarTest.java new file mode 100644 index 000000000000..e0c971eac8dc --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ScalarTest.java @@ -0,0 +1,35 @@ +/* + * 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.math.BigDecimal; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Scalar + */ +public class ScalarTest { + private final Scalar model = new Scalar(); + + /** + * Model tests for Scalar + */ + @Test + public void testScalar() { + // TODO: test Scalar + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java new file mode 100644 index 000000000000..0ab91258620c --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ScaleneTriangle + */ +public class ScaleneTriangleTest { + private final ScaleneTriangle model = new ScaleneTriangle(); + + /** + * Model tests for ScaleneTriangle + */ + @Test + public void testScaleneTriangle() { + // TODO: test ScaleneTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java new file mode 100644 index 000000000000..2ab7b72807bb --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ShapeInterface + */ +public class ShapeInterfaceTest { + private final ShapeInterface model = new ShapeInterface(); + + /** + * Model tests for ShapeInterface + */ + @Test + public void testShapeInterface() { + // TODO: test ShapeInterface + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java new file mode 100644 index 000000000000..2f4f5e120653 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ShapeOrNull + */ +public class ShapeOrNullTest { + private final ShapeOrNull model = new ShapeOrNull(); + + /** + * Model tests for ShapeOrNull + */ + @Test + public void testShapeOrNull() { + // TODO: test ShapeOrNull + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ShapeTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ShapeTest.java new file mode 100644 index 000000000000..9d27178dc8a5 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ShapeTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Shape + */ +public class ShapeTest { + private final Shape model = new Shape(); + + /** + * Model tests for Shape + */ + @Test + public void testShape() { + // TODO: test Shape + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java new file mode 100644 index 000000000000..91ff50124c59 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SimpleQuadrilateral + */ +public class SimpleQuadrilateralTest { + private final SimpleQuadrilateral model = new SimpleQuadrilateral(); + + /** + * Model tests for SimpleQuadrilateral + */ + @Test + public void testSimpleQuadrilateral() { + // TODO: test SimpleQuadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java new file mode 100644 index 000000000000..79ca40f11d3a --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for SpecialModelName + */ +public class SpecialModelNameTest { + private final SpecialModelName model = new SpecialModelName(); + + /** + * Model tests for SpecialModelName + */ + @Test + public void testSpecialModelName() { + // TODO: test SpecialModelName + } + + /** + * Test the property '$specialPropertyName' + */ + @Test + public void $specialPropertyNameTest() { + // TODO: test $specialPropertyName + } + + /** + * Test the property 'specialModelName' + */ + @Test + public void specialModelNameTest() { + // TODO: test specialModelName + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..bf9338f4f91a --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java new file mode 100644 index 000000000000..3143f3c189ec --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TestInlineFreeformAdditionalPropertiesRequest + */ +public class TestInlineFreeformAdditionalPropertiesRequestTest { + private final TestInlineFreeformAdditionalPropertiesRequest model = new TestInlineFreeformAdditionalPropertiesRequest(); + + /** + * Model tests for TestInlineFreeformAdditionalPropertiesRequest + */ + @Test + public void testTestInlineFreeformAdditionalPropertiesRequest() { + // TODO: test TestInlineFreeformAdditionalPropertiesRequest + } + + /** + * Test the property 'someProperty' + */ + @Test + public void somePropertyTest() { + // TODO: test someProperty + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java new file mode 100644 index 000000000000..04acb60ed411 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java @@ -0,0 +1,47 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TriangleInterface + */ +public class TriangleInterfaceTest { + private final TriangleInterface model = new TriangleInterface(); + + /** + * Model tests for TriangleInterface + */ + @Test + public void testTriangleInterface() { + // TODO: test TriangleInterface + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TriangleTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TriangleTest.java new file mode 100644 index 000000000000..28dfe44d05b4 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/TriangleTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.EquilateralTriangle; +import org.openapitools.client.model.IsoscelesTriangle; +import org.openapitools.client.model.ScaleneTriangle; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Triangle + */ +public class TriangleTest { + private final Triangle model = new Triangle(); + + /** + * Model tests for Triangle + */ + @Test + public void testTriangle() { + // TODO: test Triangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..c6d819a5840c --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,136 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + + /** + * Test the property 'objectWithNoDeclaredProps' + */ + @Test + public void objectWithNoDeclaredPropsTest() { + // TODO: test objectWithNoDeclaredProps + } + + /** + * Test the property 'objectWithNoDeclaredPropsNullable' + */ + @Test + public void objectWithNoDeclaredPropsNullableTest() { + // TODO: test objectWithNoDeclaredPropsNullable + } + + /** + * Test the property 'anyTypeProp' + */ + @Test + public void anyTypePropTest() { + // TODO: test anyTypeProp + } + + /** + * Test the property 'anyTypePropNullable' + */ + @Test + public void anyTypePropNullableTest() { + // TODO: test anyTypePropNullable + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ValueTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ValueTest.java new file mode 100644 index 000000000000..69a85d2116cc --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ValueTest.java @@ -0,0 +1,35 @@ +/* + * 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.List; +import org.openapitools.client.model.Scalar; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Value + */ +public class ValueTest { + private final Value model = new Value(); + + /** + * Model tests for Value + */ + @Test + public void testValue() { + // TODO: test Value + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/VariableTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/VariableTest.java new file mode 100644 index 000000000000..05df81dd4e64 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/VariableTest.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.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.openapitools.client.model.Value; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Variable + */ +public class VariableTest { + private final Variable model = new Variable(); + + /** + * Model tests for Variable + */ + @Test + public void testVariable() { + // TODO: test Variable + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'value' + */ + @Test + public void valueTest() { + // TODO: test value + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/WhaleTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/WhaleTest.java new file mode 100644 index 000000000000..40adf4f16c69 --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/WhaleTest.java @@ -0,0 +1,63 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Whale + */ +public class WhaleTest { + private final Whale model = new Whale(); + + /** + * Model tests for Whale + */ + @Test + public void testWhale() { + // TODO: test Whale + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ZebraTest.java b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ZebraTest.java new file mode 100644 index 000000000000..7b04b26fd1ca --- /dev/null +++ b/samples/client/petstore/java/okhttp/src/test/java/org/openapitools/client/model/ZebraTest.java @@ -0,0 +1,55 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Zebra + */ +public class ZebraTest { + private final Zebra model = new Zebra(); + + /** + * Model tests for Zebra + */ + @Test + public void testZebra() { + // TODO: test Zebra + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} From 7e874abe5393d1e47026c758494a85f440a72ea2 Mon Sep 17 00:00:00 2001 From: rar91279 Date: Tue, 21 Jul 2026 00:09:26 +0200 Subject: [PATCH 3/5] Update Java generator docs to include OkHttp support for Jackson 3 and missed Samples files --- docs/generators/java-microprofile.md | 2 +- docs/generators/java.md | 4 +- .../java/okhttp/.openapi-generator/FILES | 12 -- .../java/okhttp/.openapi-generator/VERSION | 2 +- samples/client/echo_api/java/okhttp/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../org/openapitools/client/model/Bird.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../openapitools/client/model/DataQuery.java | 2 +- .../client/model/DefaultValue.java | 2 +- .../client/model/NumberPropertiesOnly.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../org/openapitools/client/model/Query.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- .../TestFormObjectMultipartRequestMarker.java | 2 +- ...deTrueObjectAllOfQueryObjectParameter.java | 2 +- ...deTrueArrayStringQueryObjectParameter.java | 2 +- .../.openapi-generator/FILES | 4 - .../.openapi-generator/VERSION | 2 +- .../others/java/okhttp-oneOf-array/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../client/model/MyExampleGet200Response.java | 2 +- .../org/openapitools/client/model/OneOf1.java | 2 +- .../okhttp-oneOf/.openapi-generator/FILES | 3 - .../okhttp-oneOf/.openapi-generator/VERSION | 2 +- .../client/others/java/okhttp-oneOf/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../client/model/MyExamplePostRequest.java | 2 +- .../okhttp-streaming/.openapi-generator/FILES | 4 - .../.openapi-generator/VERSION | 2 +- .../others/java/okhttp-streaming/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../client/model/SimpleOneOf.java | 2 +- .../openapitools/client/model/SomeObj.java | 2 +- .../.openapi-generator/FILES | 1 - .../.openapi-generator/VERSION | 2 +- .../README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../org/openapitools/client/auth/OAuth.java | 2 +- .../openapitools/client/auth/OAuthFlow.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../java/okhttp-3.1/.openapi-generator/FILES | 26 ---- .../okhttp-3.1/.openapi-generator/VERSION | 2 +- .../client/petstore/java/okhttp-3.1/README.md | 2 +- .../petstore/java/okhttp-3.1/api/openapi.yaml | 4 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../org/openapitools/client/auth/OAuth.java | 2 +- .../openapitools/client/auth/OAuthFlow.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../client/model/AllOfSimpleModel.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../client/model/AnyTypeTest.java | 2 +- .../client/model/ArrayOfSameRef.java | 2 +- .../org/openapitools/client/model/Cat.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../client/model/CircularReference1.java | 2 +- .../client/model/CircularReference2.java | 2 +- .../client/model/CircularReference3.java | 2 +- .../org/openapitools/client/model/Dog.java | 2 +- ...FakeWebhooksSourcesDeletedPostRequest.java | 2 +- ...ebhooksSourcesDeletedPostRequestEvent.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../client/model/OneOfStringOrInt.java | 2 +- .../org/openapitools/client/model/Order.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../model/PetWithTypesObjectNullAndRef.java | 2 +- ...evelParameterOneofRefToOneofParameter.java | 2 +- ...oRefParameterAnyofRefToAnyofParameter.java | 2 +- .../SelfReferenceAdditionalProperties.java | 2 +- .../client/model/SelfReferenceAnyOf.java | 2 +- .../client/model/SelfReferenceOneOf.java | 2 +- .../model/SimpleModelWithArrayProperty.java | 2 +- .../client/model/StringOrInt.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- .../org/openapitools/client/model/User.java | 2 +- .../.openapi-generator/FILES | 4 - .../.openapi-generator/VERSION | 2 +- .../java/okhttp-awsv4signature/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/AWS4Auth.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../org/openapitools/client/auth/OAuth.java | 2 +- .../openapitools/client/auth/OAuthFlow.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../org/openapitools/client/model/Order.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- .../org/openapitools/client/model/User.java | 2 +- .../.openapi-generator/FILES | 46 ------- .../.openapi-generator/VERSION | 2 +- .../java/okhttp-dynamicOperations/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../org/openapitools/client/auth/OAuth.java | 2 +- .../openapitools/client/auth/OAuthFlow.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../model/AdditionalPropertiesAnyType.java | 2 +- .../model/AdditionalPropertiesArray.java | 2 +- .../model/AdditionalPropertiesBoolean.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/AdditionalPropertiesInteger.java | 2 +- .../model/AdditionalPropertiesNumber.java | 2 +- .../model/AdditionalPropertiesObject.java | 2 +- .../model/AdditionalPropertiesString.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 2 +- .../org/openapitools/client/model/BigCat.java | 2 +- .../client/model/Capitalization.java | 2 +- .../org/openapitools/client/model/Cat.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../openapitools/client/model/ClassModel.java | 2 +- .../org/openapitools/client/model/Client.java | 2 +- .../org/openapitools/client/model/Dog.java | 2 +- .../openapitools/client/model/EnumArrays.java | 2 +- .../openapitools/client/model/EnumTest.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/FormatTest.java | 2 +- .../client/model/HasOnlyReadOnly.java | 2 +- .../openapitools/client/model/MapTest.java | 2 +- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../client/model/Model200Response.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../openapitools/client/model/ModelFile.java | 2 +- .../openapitools/client/model/ModelList.java | 2 +- .../client/model/ModelReturn.java | 2 +- .../org/openapitools/client/model/Name.java | 2 +- .../openapitools/client/model/NumberOnly.java | 2 +- .../org/openapitools/client/model/Order.java | 2 +- .../client/model/OuterComposite.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../client/model/ReadOnlyFirst.java | 2 +- .../client/model/SpecialModelName.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../org/openapitools/client/model/User.java | 2 +- .../openapitools/client/model/XmlItem.java | 2 +- .../.openapi-generator/FILES | 3 - .../.openapi-generator/VERSION | 2 +- .../java/okhttp-group-parameter/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../org/openapitools/client/auth/OAuth.java | 2 +- .../openapitools/client/auth/OAuthFlow.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../org/openapitools/client/model/Order.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- .../org/openapitools/client/model/User.java | 2 +- .../okhttp-jackson/.openapi-generator/FILES | 122 ------------------ .../okhttp-jackson/.openapi-generator/VERSION | 2 +- .../petstore/java/okhttp-jackson/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/RFC3339DateFormat.java | 2 +- .../client/RFC3339InstantDeserializer.java | 2 +- .../client/RFC3339JavaTimeModule.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../org/openapitools/client/auth/OAuth.java | 2 +- .../openapitools/client/auth/OAuthFlow.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../client/model/AllOfModelArrayAnyOf.java | 2 +- .../AllOfModelArrayAnyOfAllOfAttributes.java | 2 +- .../AllOfModelArrayAnyOfAllOfAttributesC.java | 2 +- ...OfModelArrayAnyOfAllOfLinkListColumn1.java | 2 +- ...elArrayAnyOfAllOfLinkListColumn1Value.java | 2 +- .../client/model/AllOfRefToDouble.java | 2 +- .../client/model/AllOfRefToFloat.java | 2 +- .../client/model/AllOfRefToLong.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Apple.java | 2 +- .../openapitools/client/model/AppleReq.java | 2 +- .../openapitools/client/model/ArrayAnyOf.java | 2 +- .../client/model/ArrayDefault.java | 2 +- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfInlineAllOf.java | 2 +- ...InlineAllOfArrayAllofDogPropertyInner.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayOneOf.java | 2 +- .../openapitools/client/model/ArrayTest.java | 2 +- .../org/openapitools/client/model/Banana.java | 2 +- .../openapitools/client/model/BananaReq.java | 2 +- .../openapitools/client/model/BasquePig.java | 2 +- .../client/model/Capitalization.java | 2 +- .../org/openapitools/client/model/Cat.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../openapitools/client/model/ClassModel.java | 2 +- .../org/openapitools/client/model/Client.java | 2 +- .../client/model/ComplexQuadrilateral.java | 2 +- .../openapitools/client/model/DanishPig.java | 2 +- .../client/model/DeprecatedObject.java | 2 +- .../org/openapitools/client/model/Dog.java | 2 +- .../openapitools/client/model/Drawing.java | 2 +- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/EnumStringDiscriminator.java | 2 +- .../openapitools/client/model/EnumTest.java | 2 +- .../client/model/EquilateralTriangle.java | 2 +- ...akeAnyOfWIthSameErasureGet200Response.java | 2 +- ...akeOneOfWIthSameErasureGet200Response.java | 2 +- .../model/FakeRefParameterPetIdParameter.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../org/openapitools/client/model/Foo.java | 2 +- .../client/model/FooGetDefaultResponse.java | 2 +- .../openapitools/client/model/FormatTest.java | 2 +- .../client/model/FreeFormObjectTestClass.java | 2 +- .../FreeFormObjectTestClassProperties.java | 2 +- .../org/openapitools/client/model/Fruit.java | 2 +- .../openapitools/client/model/FruitReq.java | 2 +- .../openapitools/client/model/GmFruit.java | 2 +- .../client/model/GrandparentAnimal.java | 2 +- .../client/model/HasOnlyReadOnly.java | 2 +- .../client/model/HealthCheckResult.java | 2 +- .../client/model/IsoscelesTriangle.java | 2 +- .../org/openapitools/client/model/Mammal.java | 2 +- .../client/model/MammalAnyof.java | 2 +- .../openapitools/client/model/MapTest.java | 2 +- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../client/model/Model200Response.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../openapitools/client/model/ModelFile.java | 2 +- .../openapitools/client/model/ModelList.java | 2 +- .../client/model/ModelReturn.java | 2 +- .../model/ModelWithOneOfAnyOfProperties.java | 2 +- .../org/openapitools/client/model/Name.java | 2 +- .../model/NestedArrayWithDefaultValues.java | 2 +- .../org/openapitools/client/model/NewPet.java | 2 +- .../model/NewPetCategoryInlineAllof.java | 2 +- ...etCategoryInlineAllofAllOfCategoryTag.java | 2 +- .../client/model/NullableClass.java | 2 +- .../client/model/NullableFieldsMapError.java | 2 +- .../model/NullableFieldsMapResponse.java | 2 +- .../model/NullableFieldsMapSuccess.java | 2 +- .../client/model/NullableFieldsValue.java | 2 +- .../client/model/NullableShape.java | 2 +- .../openapitools/client/model/NumberOnly.java | 2 +- .../model/ObjectWithDeprecatedFields.java | 2 +- .../org/openapitools/client/model/Order.java | 2 +- .../client/model/OuterComposite.java | 2 +- .../openapitools/client/model/ParentPet.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../client/model/PetComposition.java | 2 +- .../org/openapitools/client/model/PetRef.java | 2 +- .../client/model/PetUsingAllOf.java | 2 +- .../client/model/PetWithRequiredTags.java | 2 +- .../org/openapitools/client/model/Pig.java | 2 +- .../client/model/PropertyNameCollision.java | 2 +- .../client/model/Quadrilateral.java | 2 +- .../client/model/QuadrilateralInterface.java | 2 +- .../client/model/ReadOnlyFirst.java | 2 +- .../client/model/RequiredNullableBody.java | 2 +- .../org/openapitools/client/model/Scalar.java | 2 +- .../client/model/ScalarAnyOf.java | 2 +- .../client/model/ScaleneTriangle.java | 2 +- .../org/openapitools/client/model/Shape.java | 2 +- .../client/model/ShapeInterface.java | 2 +- .../client/model/ShapeOrNull.java | 2 +- .../client/model/SimpleQuadrilateral.java | 2 +- .../client/model/SpecialModelName.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- ...neFreeformAdditionalPropertiesRequest.java | 2 +- .../openapitools/client/model/Triangle.java | 2 +- .../client/model/TriangleInterface.java | 2 +- .../org/openapitools/client/model/User.java | 2 +- .../org/openapitools/client/model/Value.java | 2 +- .../openapitools/client/model/Variable.java | 2 +- .../org/openapitools/client/model/Whale.java | 2 +- .../org/openapitools/client/model/Zebra.java | 2 +- .../okhttp-jackson3/.openapi-generator/FILES | 122 ------------------ .../.openapi-generator/VERSION | 2 +- .../petstore/java/okhttp-jackson3/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/RFC3339DateFormat.java | 2 +- .../client/RFC3339InstantDeserializer.java | 2 +- .../client/RFC3339JavaTimeModule.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../org/openapitools/client/auth/OAuth.java | 2 +- .../openapitools/client/auth/OAuthFlow.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../client/model/AllOfModelArrayAnyOf.java | 2 +- .../AllOfModelArrayAnyOfAllOfAttributes.java | 2 +- .../AllOfModelArrayAnyOfAllOfAttributesC.java | 2 +- ...OfModelArrayAnyOfAllOfLinkListColumn1.java | 2 +- ...elArrayAnyOfAllOfLinkListColumn1Value.java | 2 +- .../client/model/AllOfRefToDouble.java | 2 +- .../client/model/AllOfRefToFloat.java | 2 +- .../client/model/AllOfRefToLong.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Apple.java | 2 +- .../openapitools/client/model/AppleReq.java | 2 +- .../openapitools/client/model/ArrayAnyOf.java | 2 +- .../client/model/ArrayDefault.java | 2 +- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfInlineAllOf.java | 2 +- ...InlineAllOfArrayAllofDogPropertyInner.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayOneOf.java | 2 +- .../openapitools/client/model/ArrayTest.java | 2 +- .../org/openapitools/client/model/Banana.java | 2 +- .../openapitools/client/model/BananaReq.java | 2 +- .../openapitools/client/model/BasquePig.java | 2 +- .../client/model/Capitalization.java | 2 +- .../org/openapitools/client/model/Cat.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../openapitools/client/model/ClassModel.java | 2 +- .../org/openapitools/client/model/Client.java | 2 +- .../client/model/ComplexQuadrilateral.java | 2 +- .../openapitools/client/model/DanishPig.java | 2 +- .../client/model/DeprecatedObject.java | 2 +- .../org/openapitools/client/model/Dog.java | 2 +- .../openapitools/client/model/Drawing.java | 2 +- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/EnumStringDiscriminator.java | 2 +- .../openapitools/client/model/EnumTest.java | 2 +- .../client/model/EquilateralTriangle.java | 2 +- ...akeAnyOfWIthSameErasureGet200Response.java | 2 +- ...akeOneOfWIthSameErasureGet200Response.java | 2 +- .../model/FakeRefParameterPetIdParameter.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../org/openapitools/client/model/Foo.java | 2 +- .../client/model/FooGetDefaultResponse.java | 2 +- .../openapitools/client/model/FormatTest.java | 2 +- .../client/model/FreeFormObjectTestClass.java | 2 +- .../FreeFormObjectTestClassProperties.java | 2 +- .../org/openapitools/client/model/Fruit.java | 2 +- .../openapitools/client/model/FruitReq.java | 2 +- .../openapitools/client/model/GmFruit.java | 2 +- .../client/model/GrandparentAnimal.java | 2 +- .../client/model/HasOnlyReadOnly.java | 2 +- .../client/model/HealthCheckResult.java | 2 +- .../client/model/IsoscelesTriangle.java | 2 +- .../org/openapitools/client/model/Mammal.java | 2 +- .../client/model/MammalAnyof.java | 2 +- .../openapitools/client/model/MapTest.java | 2 +- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../client/model/Model200Response.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../openapitools/client/model/ModelFile.java | 2 +- .../openapitools/client/model/ModelList.java | 2 +- .../client/model/ModelReturn.java | 2 +- .../model/ModelWithOneOfAnyOfProperties.java | 2 +- .../org/openapitools/client/model/Name.java | 2 +- .../model/NestedArrayWithDefaultValues.java | 2 +- .../org/openapitools/client/model/NewPet.java | 2 +- .../model/NewPetCategoryInlineAllof.java | 2 +- ...etCategoryInlineAllofAllOfCategoryTag.java | 2 +- .../client/model/NullableClass.java | 2 +- .../client/model/NullableFieldsMapError.java | 2 +- .../model/NullableFieldsMapResponse.java | 2 +- .../model/NullableFieldsMapSuccess.java | 2 +- .../client/model/NullableFieldsValue.java | 2 +- .../client/model/NullableShape.java | 2 +- .../openapitools/client/model/NumberOnly.java | 2 +- .../model/ObjectWithDeprecatedFields.java | 2 +- .../org/openapitools/client/model/Order.java | 2 +- .../client/model/OuterComposite.java | 2 +- .../openapitools/client/model/ParentPet.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../client/model/PetComposition.java | 2 +- .../org/openapitools/client/model/PetRef.java | 2 +- .../client/model/PetUsingAllOf.java | 2 +- .../client/model/PetWithRequiredTags.java | 2 +- .../org/openapitools/client/model/Pig.java | 2 +- .../client/model/PropertyNameCollision.java | 2 +- .../client/model/Quadrilateral.java | 2 +- .../client/model/QuadrilateralInterface.java | 2 +- .../client/model/ReadOnlyFirst.java | 2 +- .../client/model/RequiredNullableBody.java | 2 +- .../org/openapitools/client/model/Scalar.java | 2 +- .../client/model/ScalarAnyOf.java | 2 +- .../client/model/ScaleneTriangle.java | 2 +- .../org/openapitools/client/model/Shape.java | 2 +- .../client/model/ShapeInterface.java | 2 +- .../client/model/ShapeOrNull.java | 2 +- .../client/model/SimpleQuadrilateral.java | 2 +- .../client/model/SpecialModelName.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- ...neFreeformAdditionalPropertiesRequest.java | 2 +- .../openapitools/client/model/Triangle.java | 2 +- .../client/model/TriangleInterface.java | 2 +- .../org/openapitools/client/model/User.java | 2 +- .../org/openapitools/client/model/Value.java | 2 +- .../openapitools/client/model/Variable.java | 2 +- .../org/openapitools/client/model/Whale.java | 2 +- .../org/openapitools/client/model/Zebra.java | 2 +- .../okhttp-jsonb/.openapi-generator/FILES | 122 ------------------ .../okhttp-jsonb/.openapi-generator/VERSION | 2 +- .../petstore/java/okhttp-jsonb/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../org/openapitools/client/auth/OAuth.java | 2 +- .../openapitools/client/auth/OAuthFlow.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../client/model/AllOfModelArrayAnyOf.java | 2 +- .../AllOfModelArrayAnyOfAllOfAttributes.java | 2 +- .../AllOfModelArrayAnyOfAllOfAttributesC.java | 2 +- ...OfModelArrayAnyOfAllOfLinkListColumn1.java | 2 +- ...elArrayAnyOfAllOfLinkListColumn1Value.java | 2 +- .../client/model/AllOfRefToDouble.java | 2 +- .../client/model/AllOfRefToFloat.java | 2 +- .../client/model/AllOfRefToLong.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Apple.java | 2 +- .../openapitools/client/model/AppleReq.java | 2 +- .../openapitools/client/model/ArrayAnyOf.java | 2 +- .../client/model/ArrayDefault.java | 2 +- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfInlineAllOf.java | 2 +- ...InlineAllOfArrayAllofDogPropertyInner.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayOneOf.java | 2 +- .../openapitools/client/model/ArrayTest.java | 2 +- .../org/openapitools/client/model/Banana.java | 2 +- .../openapitools/client/model/BananaReq.java | 2 +- .../openapitools/client/model/BasquePig.java | 2 +- .../client/model/Capitalization.java | 2 +- .../org/openapitools/client/model/Cat.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../openapitools/client/model/ClassModel.java | 2 +- .../org/openapitools/client/model/Client.java | 2 +- .../client/model/ComplexQuadrilateral.java | 2 +- .../openapitools/client/model/DanishPig.java | 2 +- .../client/model/DeprecatedObject.java | 2 +- .../org/openapitools/client/model/Dog.java | 2 +- .../openapitools/client/model/Drawing.java | 2 +- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/EnumStringDiscriminator.java | 2 +- .../openapitools/client/model/EnumTest.java | 2 +- .../client/model/EquilateralTriangle.java | 2 +- ...akeAnyOfWIthSameErasureGet200Response.java | 2 +- ...akeOneOfWIthSameErasureGet200Response.java | 2 +- .../model/FakeRefParameterPetIdParameter.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../org/openapitools/client/model/Foo.java | 2 +- .../client/model/FooGetDefaultResponse.java | 2 +- .../openapitools/client/model/FormatTest.java | 2 +- .../client/model/FreeFormObjectTestClass.java | 2 +- .../FreeFormObjectTestClassProperties.java | 2 +- .../org/openapitools/client/model/Fruit.java | 2 +- .../openapitools/client/model/FruitReq.java | 2 +- .../openapitools/client/model/GmFruit.java | 2 +- .../client/model/GrandparentAnimal.java | 2 +- .../client/model/HasOnlyReadOnly.java | 2 +- .../client/model/HealthCheckResult.java | 2 +- .../client/model/IsoscelesTriangle.java | 2 +- .../org/openapitools/client/model/Mammal.java | 2 +- .../client/model/MammalAnyof.java | 2 +- .../openapitools/client/model/MapTest.java | 2 +- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../client/model/Model200Response.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../openapitools/client/model/ModelFile.java | 2 +- .../openapitools/client/model/ModelList.java | 2 +- .../client/model/ModelReturn.java | 2 +- .../model/ModelWithOneOfAnyOfProperties.java | 2 +- .../org/openapitools/client/model/Name.java | 2 +- .../model/NestedArrayWithDefaultValues.java | 2 +- .../org/openapitools/client/model/NewPet.java | 2 +- .../model/NewPetCategoryInlineAllof.java | 2 +- ...etCategoryInlineAllofAllOfCategoryTag.java | 2 +- .../client/model/NullableClass.java | 2 +- .../client/model/NullableFieldsMapError.java | 2 +- .../model/NullableFieldsMapResponse.java | 2 +- .../model/NullableFieldsMapSuccess.java | 2 +- .../client/model/NullableFieldsValue.java | 2 +- .../client/model/NullableShape.java | 2 +- .../openapitools/client/model/NumberOnly.java | 2 +- .../model/ObjectWithDeprecatedFields.java | 2 +- .../org/openapitools/client/model/Order.java | 2 +- .../client/model/OuterComposite.java | 2 +- .../openapitools/client/model/ParentPet.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../client/model/PetComposition.java | 2 +- .../org/openapitools/client/model/PetRef.java | 2 +- .../client/model/PetUsingAllOf.java | 2 +- .../client/model/PetWithRequiredTags.java | 2 +- .../org/openapitools/client/model/Pig.java | 2 +- .../client/model/PropertyNameCollision.java | 2 +- .../client/model/Quadrilateral.java | 2 +- .../client/model/QuadrilateralInterface.java | 2 +- .../client/model/ReadOnlyFirst.java | 2 +- .../client/model/RequiredNullableBody.java | 2 +- .../org/openapitools/client/model/Scalar.java | 2 +- .../client/model/ScalarAnyOf.java | 2 +- .../client/model/ScaleneTriangle.java | 2 +- .../org/openapitools/client/model/Shape.java | 2 +- .../client/model/ShapeInterface.java | 2 +- .../client/model/ShapeOrNull.java | 2 +- .../client/model/SimpleQuadrilateral.java | 2 +- .../client/model/SpecialModelName.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- ...neFreeformAdditionalPropertiesRequest.java | 2 +- .../openapitools/client/model/Triangle.java | 2 +- .../client/model/TriangleInterface.java | 2 +- .../org/openapitools/client/model/User.java | 2 +- .../org/openapitools/client/model/Value.java | 2 +- .../openapitools/client/model/Variable.java | 2 +- .../org/openapitools/client/model/Whale.java | 2 +- .../org/openapitools/client/model/Zebra.java | 2 +- .../okhttp-jspecify/.openapi-generator/FILES | 3 - .../.openapi-generator/VERSION | 2 +- .../petstore/java/okhttp-jspecify/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../org/openapitools/client/model/Foo.java | 2 +- .../.openapi-generator/FILES | 12 -- .../.openapi-generator/VERSION | 2 +- .../java/okhttp-nullable-required/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../org/openapitools/client/auth/OAuth.java | 2 +- .../openapitools/client/auth/OAuthFlow.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../org/openapitools/client/model/Order.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../model/PetWithRequiredNullableCases1.java | 2 +- .../model/PetWithRequiredNullableCases2.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- .../org/openapitools/client/model/User.java | 2 +- .../.openapi-generator/FILES | 52 -------- .../.openapi-generator/VERSION | 2 +- .../java/okhttp-parcelableModel/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../org/openapitools/client/auth/OAuth.java | 2 +- .../openapitools/client/auth/OAuthFlow.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../model/AdditionalPropertiesAnyType.java | 2 +- .../model/AdditionalPropertiesArray.java | 2 +- .../model/AdditionalPropertiesBoolean.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../model/AdditionalPropertiesInteger.java | 2 +- .../model/AdditionalPropertiesNumber.java | 2 +- .../model/AdditionalPropertiesObject.java | 2 +- .../model/AdditionalPropertiesString.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayTest.java | 2 +- .../org/openapitools/client/model/BigCat.java | 2 +- .../client/model/Capitalization.java | 2 +- .../org/openapitools/client/model/Cat.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../openapitools/client/model/ClassModel.java | 2 +- .../org/openapitools/client/model/Client.java | 2 +- .../org/openapitools/client/model/Dog.java | 2 +- .../openapitools/client/model/EnumArrays.java | 2 +- .../openapitools/client/model/EnumTest.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../openapitools/client/model/FormatTest.java | 2 +- .../client/model/HasOnlyReadOnly.java | 2 +- .../openapitools/client/model/MapTest.java | 2 +- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../client/model/Model200Response.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../openapitools/client/model/ModelFile.java | 2 +- .../openapitools/client/model/ModelList.java | 2 +- .../client/model/ModelReturn.java | 2 +- .../org/openapitools/client/model/Name.java | 2 +- .../openapitools/client/model/NumberOnly.java | 2 +- .../org/openapitools/client/model/Order.java | 2 +- .../client/model/OuterComposite.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../client/model/ReadOnlyFirst.java | 2 +- .../client/model/SpecialModelName.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- .../client/model/TypeHolderDefault.java | 2 +- .../client/model/TypeHolderExample.java | 2 +- .../org/openapitools/client/model/User.java | 2 +- .../openapitools/client/model/XmlItem.java | 2 +- .../okhttp-swagger1/.openapi-generator/FILES | 8 -- .../.openapi-generator/VERSION | 2 +- .../petstore/java/okhttp-swagger1/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../org/openapitools/client/auth/OAuth.java | 2 +- .../openapitools/client/auth/OAuthFlow.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../org/openapitools/client/model/Order.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- .../org/openapitools/client/model/User.java | 2 +- .../okhttp-swagger2/.openapi-generator/FILES | 10 -- .../.openapi-generator/VERSION | 2 +- .../petstore/java/okhttp-swagger2/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../org/openapitools/client/auth/OAuth.java | 2 +- .../openapitools/client/auth/OAuthFlow.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../org/openapitools/client/model/Order.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- .../org/openapitools/client/model/User.java | 2 +- .../java/okhttp/.openapi-generator/FILES | 122 ------------------ .../java/okhttp/.openapi-generator/VERSION | 2 +- samples/client/petstore/java/okhttp/README.md | 2 +- .../org/openapitools/client/ApiException.java | 2 +- .../openapitools/client/Configuration.java | 2 +- .../java/org/openapitools/client/Pair.java | 2 +- .../client/ServerConfiguration.java | 2 +- .../openapitools/client/ServerVariable.java | 2 +- .../org/openapitools/client/StringUtil.java | 2 +- .../openapitools/client/auth/ApiKeyAuth.java | 2 +- .../client/auth/Authentication.java | 2 +- .../client/auth/HttpBasicAuth.java | 2 +- .../client/auth/HttpBearerAuth.java | 2 +- .../org/openapitools/client/auth/OAuth.java | 2 +- .../openapitools/client/auth/OAuthFlow.java | 2 +- .../client/model/AbstractOpenApiSchema.java | 2 +- .../model/AdditionalPropertiesClass.java | 2 +- .../client/model/AllOfModelArrayAnyOf.java | 2 +- .../AllOfModelArrayAnyOfAllOfAttributes.java | 2 +- .../AllOfModelArrayAnyOfAllOfAttributesC.java | 2 +- ...OfModelArrayAnyOfAllOfLinkListColumn1.java | 2 +- ...elArrayAnyOfAllOfLinkListColumn1Value.java | 2 +- .../client/model/AllOfRefToDouble.java | 2 +- .../client/model/AllOfRefToFloat.java | 2 +- .../client/model/AllOfRefToLong.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Apple.java | 2 +- .../openapitools/client/model/AppleReq.java | 2 +- .../openapitools/client/model/ArrayAnyOf.java | 2 +- .../client/model/ArrayDefault.java | 2 +- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../client/model/ArrayOfInlineAllOf.java | 2 +- ...InlineAllOfArrayAllofDogPropertyInner.java | 2 +- .../client/model/ArrayOfNumberOnly.java | 2 +- .../openapitools/client/model/ArrayOneOf.java | 2 +- .../openapitools/client/model/ArrayTest.java | 2 +- .../org/openapitools/client/model/Banana.java | 2 +- .../openapitools/client/model/BananaReq.java | 2 +- .../openapitools/client/model/BasquePig.java | 2 +- .../client/model/Capitalization.java | 2 +- .../org/openapitools/client/model/Cat.java | 2 +- .../openapitools/client/model/Category.java | 2 +- .../openapitools/client/model/ClassModel.java | 2 +- .../org/openapitools/client/model/Client.java | 2 +- .../client/model/ComplexQuadrilateral.java | 2 +- .../openapitools/client/model/DanishPig.java | 2 +- .../client/model/DeprecatedObject.java | 2 +- .../org/openapitools/client/model/Dog.java | 2 +- .../openapitools/client/model/Drawing.java | 2 +- .../openapitools/client/model/EnumArrays.java | 2 +- .../client/model/EnumStringDiscriminator.java | 2 +- .../openapitools/client/model/EnumTest.java | 2 +- .../client/model/EquilateralTriangle.java | 2 +- ...akeAnyOfWIthSameErasureGet200Response.java | 2 +- ...akeOneOfWIthSameErasureGet200Response.java | 2 +- .../model/FakeRefParameterPetIdParameter.java | 2 +- .../client/model/FileSchemaTestClass.java | 2 +- .../org/openapitools/client/model/Foo.java | 2 +- .../client/model/FooGetDefaultResponse.java | 2 +- .../openapitools/client/model/FormatTest.java | 2 +- .../client/model/FreeFormObjectTestClass.java | 2 +- .../FreeFormObjectTestClassProperties.java | 2 +- .../org/openapitools/client/model/Fruit.java | 2 +- .../openapitools/client/model/FruitReq.java | 2 +- .../openapitools/client/model/GmFruit.java | 2 +- .../client/model/GrandparentAnimal.java | 2 +- .../client/model/HasOnlyReadOnly.java | 2 +- .../client/model/HealthCheckResult.java | 2 +- .../client/model/IsoscelesTriangle.java | 2 +- .../org/openapitools/client/model/Mammal.java | 2 +- .../client/model/MammalAnyof.java | 2 +- .../openapitools/client/model/MapTest.java | 2 +- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../client/model/Model200Response.java | 2 +- .../client/model/ModelApiResponse.java | 2 +- .../openapitools/client/model/ModelFile.java | 2 +- .../openapitools/client/model/ModelList.java | 2 +- .../client/model/ModelReturn.java | 2 +- .../model/ModelWithOneOfAnyOfProperties.java | 2 +- .../org/openapitools/client/model/Name.java | 2 +- .../model/NestedArrayWithDefaultValues.java | 2 +- .../org/openapitools/client/model/NewPet.java | 2 +- .../model/NewPetCategoryInlineAllof.java | 2 +- ...etCategoryInlineAllofAllOfCategoryTag.java | 2 +- .../client/model/NullableClass.java | 2 +- .../client/model/NullableFieldsMapError.java | 2 +- .../model/NullableFieldsMapResponse.java | 2 +- .../model/NullableFieldsMapSuccess.java | 2 +- .../client/model/NullableFieldsValue.java | 2 +- .../client/model/NullableShape.java | 2 +- .../openapitools/client/model/NumberOnly.java | 2 +- .../model/ObjectWithDeprecatedFields.java | 2 +- .../org/openapitools/client/model/Order.java | 2 +- .../client/model/OuterComposite.java | 2 +- .../openapitools/client/model/ParentPet.java | 2 +- .../org/openapitools/client/model/Pet.java | 2 +- .../client/model/PetComposition.java | 2 +- .../org/openapitools/client/model/PetRef.java | 2 +- .../client/model/PetUsingAllOf.java | 2 +- .../client/model/PetWithRequiredTags.java | 2 +- .../org/openapitools/client/model/Pig.java | 2 +- .../client/model/PropertyNameCollision.java | 2 +- .../client/model/Quadrilateral.java | 2 +- .../client/model/QuadrilateralInterface.java | 2 +- .../client/model/ReadOnlyFirst.java | 2 +- .../client/model/RequiredNullableBody.java | 2 +- .../org/openapitools/client/model/Scalar.java | 2 +- .../client/model/ScalarAnyOf.java | 2 +- .../client/model/ScaleneTriangle.java | 2 +- .../org/openapitools/client/model/Shape.java | 2 +- .../client/model/ShapeInterface.java | 2 +- .../client/model/ShapeOrNull.java | 2 +- .../client/model/SimpleQuadrilateral.java | 2 +- .../client/model/SpecialModelName.java | 2 +- .../org/openapitools/client/model/Tag.java | 2 +- ...neFreeformAdditionalPropertiesRequest.java | 2 +- .../openapitools/client/model/Triangle.java | 2 +- .../client/model/TriangleInterface.java | 2 +- .../org/openapitools/client/model/User.java | 2 +- .../org/openapitools/client/model/Value.java | 2 +- .../openapitools/client/model/Variable.java | 2 +- .../org/openapitools/client/model/Whale.java | 2 +- .../org/openapitools/client/model/Zebra.java | 2 +- 877 files changed, 860 insertions(+), 1538 deletions(-) diff --git a/docs/generators/java-microprofile.md b/docs/generators/java-microprofile.md index 5dcf4794792d..01cbe2f9ebd2 100644 --- a/docs/generators/java-microprofile.md +++ b/docs/generators/java-microprofile.md @@ -98,7 +98,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useDeductionForOneOfInterfaces|Annotate discriminator-free oneOf interfaces with Jackson's @JsonTypeInfo(use = Id.DEDUCTION) and @JsonSubTypes so the concrete subtype is resolved from the JSON field set rather than a type-tag property. Has no effect when a discriminator is present (name-based resolution is used instead). Requires subtypes to have structurally distinct sets of properties.| |false| |useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false| |useGzipFeature|Send gzip-encoded requests| |false| -|useJackson3|Use Jackson 3 instead of Jackson 2. Supported for 'native', 'apache-httpclient', and 'jersey3' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).| |false| +|useJackson3|Use Jackson 3 instead of Jackson 2. Supported for 'native', 'apache-httpclient', 'jersey3', and 'okhttp' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).| |false| |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useJspecify|Use Jspecify for null checks. Only supported for [native, okhttp, restclient, resttemplate, webclient]| |false| |useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson, okhttp support this option.| |false| diff --git a/docs/generators/java.md b/docs/generators/java.md index 8115baee4fa8..aa4f8fcb02e3 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -11,7 +11,7 @@ title: Documentation for the java Generator | generator type | CLIENT | | | generator language | Java | | | generator default templating engine | mustache | | -| helpTxt | Generates a Java client library (HTTP lib: Jersey (1.x, 2.x), Retrofit (2.x), OpenFeign (10.x) and more. | | +| helpTxt | Generates a Java client library (HTTP lib: Jersey (1.x, 2.x), Retrofit (2.x), OpenFeign (10.x), OkHttp and more. | | ## CONFIG OPTIONS These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. @@ -98,7 +98,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useDeductionForOneOfInterfaces|Annotate discriminator-free oneOf interfaces with Jackson's @JsonTypeInfo(use = Id.DEDUCTION) and @JsonSubTypes so the concrete subtype is resolved from the JSON field set rather than a type-tag property. Has no effect when a discriminator is present (name-based resolution is used instead). Requires subtypes to have structurally distinct sets of properties.| |false| |useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false| |useGzipFeature|Send gzip-encoded requests| |false| -|useJackson3|Use Jackson 3 instead of Jackson 2. Supported for 'native', 'apache-httpclient', and 'jersey3' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).| |false| +|useJackson3|Use Jackson 3 instead of Jackson 2. Supported for 'native', 'apache-httpclient', 'jersey3', and 'okhttp' libraries (requires Java 17+) and for Spring 'resttemplate', 'webclient', and 'restclient' libraries (require useSpringBoot4=true).| |false| |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useJspecify|Use Jspecify for null checks. Only supported for [native, okhttp, restclient, resttemplate, webclient]| |false| |useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson, okhttp support this option.| |false| diff --git a/samples/client/echo_api/java/okhttp/.openapi-generator/FILES b/samples/client/echo_api/java/okhttp/.openapi-generator/FILES index 92c9a620b940..fba1fa8d9475 100644 --- a/samples/client/echo_api/java/okhttp/.openapi-generator/FILES +++ b/samples/client/echo_api/java/okhttp/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -68,14 +67,3 @@ src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java -src/test/java/org/openapitools/client/api/AuthApiTest.java -src/test/java/org/openapitools/client/api/BodyApiTest.java -src/test/java/org/openapitools/client/api/FormApiTest.java -src/test/java/org/openapitools/client/api/HeaderApiTest.java -src/test/java/org/openapitools/client/api/PathApiTest.java -src/test/java/org/openapitools/client/api/QueryApiTest.java -src/test/java/org/openapitools/client/model/StringEnumRefTest.java -src/test/java/org/openapitools/client/model/TagTest.java -src/test/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarkerTest.java -src/test/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.java -src/test/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.java diff --git a/samples/client/echo_api/java/okhttp/.openapi-generator/VERSION b/samples/client/echo_api/java/okhttp/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/echo_api/java/okhttp/.openapi-generator/VERSION +++ b/samples/client/echo_api/java/okhttp/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/echo_api/java/okhttp/README.md b/samples/client/echo_api/java/okhttp/README.md index 9be234ee3d2c..79922b965264 100644 --- a/samples/client/echo_api/java/okhttp/README.md +++ b/samples/client/echo_api/java/okhttp/README.md @@ -2,7 +2,7 @@ Echo Server API - API version: 0.1.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT Echo Server API diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiException.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiException.java index 8d0a87fbc8f9..7f216723942c 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Configuration.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Configuration.java index 3e89fc9d1bf4..db937df07b2c 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "0.1.0"; diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Pair.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Pair.java index d1fae1e9e59b..bd7f88f094aa 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java index a4e83eee7d63..5a981892593f 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java index 2139c6c8c510..72934f49e5ae 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java index 3e909a428230..7b51729d0c47 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 43667b658353..d9194bcab8dc 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java index 951184215a07..24da09ba01d1 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index ea1ec808247e..e257fd2a3805 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index 12a64f0c4152..16dc8b30b450 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index 3f4a671a37b6..a6426cf0cd88 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Bird.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Bird.java index b29ba67d3336..fdba7e6d7459 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Bird.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Bird.java @@ -48,7 +48,7 @@ /** * Bird */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Bird { public static final String SERIALIZED_NAME_SIZE = "size"; @SerializedName(SERIALIZED_NAME_SIZE) diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Category.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Category.java index 64fc82ec9d4d..66e629f1b617 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Category.java @@ -48,7 +48,7 @@ /** * Category */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DataQuery.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DataQuery.java index 718b29086c9d..a024a7c566b7 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DataQuery.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DataQuery.java @@ -53,7 +53,7 @@ /** * DataQuery */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class DataQuery extends Query { public static final String SERIALIZED_NAME_SUFFIX = "suffix"; @SerializedName(SERIALIZED_NAME_SUFFIX) diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DefaultValue.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DefaultValue.java index 661720bc725e..ef3821331ab5 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DefaultValue.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/DefaultValue.java @@ -53,7 +53,7 @@ /** * to test the default value of properties */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class DefaultValue { public static final String SERIALIZED_NAME_ARRAY_STRING_ENUM_REF_DEFAULT = "array_string_enum_ref_default"; @SerializedName(SERIALIZED_NAME_ARRAY_STRING_ENUM_REF_DEFAULT) diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java index 0f8351db73e4..e6bdc0e4c05d 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java @@ -49,7 +49,7 @@ /** * NumberPropertiesOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NumberPropertiesOnly { public static final String SERIALIZED_NAME_NUMBER = "number"; @SerializedName(SERIALIZED_NAME_NUMBER) diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java index 322b1a1fb99e..01fd3a7b2e98 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java @@ -53,7 +53,7 @@ /** * Pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Query.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Query.java index d4e8f1070a40..6bd964d4827c 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Query.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Query.java @@ -51,7 +51,7 @@ /** * Query */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Query { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java index 54335f38f48d..ffa7ff6a3974 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java @@ -48,7 +48,7 @@ /** * Tag */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java index 3465a851a6ff..0474fe614bfa 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java @@ -48,7 +48,7 @@ /** * TestFormObjectMultipartRequestMarker */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class TestFormObjectMultipartRequestMarker { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java index 1ff0062bc133..ae9fb7417bed 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java @@ -48,7 +48,7 @@ /** * TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter { public static final String SERIALIZED_NAME_SIZE = "size"; @SerializedName(SERIALIZED_NAME_SIZE) diff --git a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java index 39433329c8e2..e80ba0875611 100644 --- a/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java +++ b/samples/client/echo_api/java/okhttp/src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java @@ -51,7 +51,7 @@ /** * TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { public static final String SERIALIZED_NAME_VALUES = "values"; @SerializedName(SERIALIZED_NAME_VALUES) diff --git a/samples/client/others/java/okhttp-oneOf-array/.openapi-generator/FILES b/samples/client/others/java/okhttp-oneOf-array/.openapi-generator/FILES index 63017fb66a0f..0a83797dcc6d 100644 --- a/samples/client/others/java/okhttp-oneOf-array/.openapi-generator/FILES +++ b/samples/client/others/java/okhttp-oneOf-array/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -38,6 +37,3 @@ src/main/java/org/openapitools/client/auth/HttpBearerAuth.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java src/main/java/org/openapitools/client/model/MyExampleGet200Response.java src/main/java/org/openapitools/client/model/OneOf1.java -src/test/java/org/openapitools/client/api/DefaultApiTest.java -src/test/java/org/openapitools/client/model/MyExampleGet200ResponseTest.java -src/test/java/org/openapitools/client/model/OneOf1Test.java diff --git a/samples/client/others/java/okhttp-oneOf-array/.openapi-generator/VERSION b/samples/client/others/java/okhttp-oneOf-array/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/others/java/okhttp-oneOf-array/.openapi-generator/VERSION +++ b/samples/client/others/java/okhttp-oneOf-array/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/others/java/okhttp-oneOf-array/README.md b/samples/client/others/java/okhttp-oneOf-array/README.md index d560b1a80c1d..257f6a3aafe8 100644 --- a/samples/client/others/java/okhttp-oneOf-array/README.md +++ b/samples/client/others/java/okhttp-oneOf-array/README.md @@ -2,7 +2,7 @@ oneOf with array inside - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiException.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiException.java index 2378fe28ee09..69ff1c7ed199 100644 --- a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Configuration.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Configuration.java index 7c6465977ef1..557424871e61 100644 --- a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Pair.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Pair.java index 92939e1d6b2c..d5b2cb63a9d0 100644 --- a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerConfiguration.java index e1725f7e308c..adf8ca0d17b5 100644 --- a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerVariable.java index cdf697b171ee..4e4608168a02 100644 --- a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/StringUtil.java index 22718e035fbd..0fbc929fcae9 100644 --- a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 95009b88da79..e75059f3900b 100644 --- a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/Authentication.java index 19b41c1e2ad9..2af05c774f1f 100644 --- a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index 895207adf05f..24780668fabd 100644 --- a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index 8b6cef17746c..3f942839b79a 100644 --- a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index 7fffad995826..bd8a9dcc941f 100644 --- a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/MyExampleGet200Response.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/MyExampleGet200Response.java index b65e6c7bf388..35e2b15a7791 100644 --- a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/MyExampleGet200Response.java +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/MyExampleGet200Response.java @@ -59,7 +59,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class MyExampleGet200Response extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(MyExampleGet200Response.class.getName()); diff --git a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/OneOf1.java b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/OneOf1.java index 1bd952ab2576..ec9aae49bb3f 100644 --- a/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/OneOf1.java +++ b/samples/client/others/java/okhttp-oneOf-array/src/main/java/org/openapitools/client/model/OneOf1.java @@ -50,7 +50,7 @@ /** * OneOf1 */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OneOf1 { public static final String SERIALIZED_NAME_MESSAGE1 = "message1"; @SerializedName(SERIALIZED_NAME_MESSAGE1) diff --git a/samples/client/others/java/okhttp-oneOf/.openapi-generator/FILES b/samples/client/others/java/okhttp-oneOf/.openapi-generator/FILES index c8c7620d5886..9d036421140f 100644 --- a/samples/client/others/java/okhttp-oneOf/.openapi-generator/FILES +++ b/samples/client/others/java/okhttp-oneOf/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -36,5 +35,3 @@ src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java src/main/java/org/openapitools/client/model/MyExamplePostRequest.java -src/test/java/org/openapitools/client/api/DefaultApiTest.java -src/test/java/org/openapitools/client/model/MyExamplePostRequestTest.java diff --git a/samples/client/others/java/okhttp-oneOf/.openapi-generator/VERSION b/samples/client/others/java/okhttp-oneOf/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/others/java/okhttp-oneOf/.openapi-generator/VERSION +++ b/samples/client/others/java/okhttp-oneOf/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/others/java/okhttp-oneOf/README.md b/samples/client/others/java/okhttp-oneOf/README.md index 33a90e1a2503..6ae96affa517 100644 --- a/samples/client/others/java/okhttp-oneOf/README.md +++ b/samples/client/others/java/okhttp-oneOf/README.md @@ -2,7 +2,7 @@ oneOf two primitives - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiException.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiException.java index d33a2b82f52a..7f9076c6f25b 100644 --- a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Configuration.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Configuration.java index 22e4cc65546f..570e0f256d25 100644 --- a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Pair.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Pair.java index 5d400085c8c4..5030a5f829e4 100644 --- a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerConfiguration.java index 314240400732..c3d1d8686f54 100644 --- a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerVariable.java index 5679fe99a1b5..8a2b4b504236 100644 --- a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/StringUtil.java index b398ff061495..c0c0fbb6f888 100644 --- a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 80ce7f2d60fa..5d1bef14b1db 100644 --- a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/Authentication.java index 30e0b4696c2e..8f4fd4cc280d 100644 --- a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index 0c2622e74956..9126357c7413 100644 --- a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index ccd81d89cc1f..09e1b8d30d13 100644 --- a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index 9abe3834dd71..1625a349ad53 100644 --- a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java index 70bc1ad51ca8..837449b49fa5 100644 --- a/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java +++ b/samples/client/others/java/okhttp-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class MyExamplePostRequest extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(MyExamplePostRequest.class.getName()); diff --git a/samples/client/others/java/okhttp-streaming/.openapi-generator/FILES b/samples/client/others/java/okhttp-streaming/.openapi-generator/FILES index cf544ffa67a5..0e647d377508 100644 --- a/samples/client/others/java/okhttp-streaming/.openapi-generator/FILES +++ b/samples/client/others/java/okhttp-streaming/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -38,6 +37,3 @@ src/main/java/org/openapitools/client/auth/HttpBearerAuth.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java src/main/java/org/openapitools/client/model/SimpleOneOf.java src/main/java/org/openapitools/client/model/SomeObj.java -src/test/java/org/openapitools/client/api/PingApiTest.java -src/test/java/org/openapitools/client/model/SimpleOneOfTest.java -src/test/java/org/openapitools/client/model/SomeObjTest.java diff --git a/samples/client/others/java/okhttp-streaming/.openapi-generator/VERSION b/samples/client/others/java/okhttp-streaming/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/others/java/okhttp-streaming/.openapi-generator/VERSION +++ b/samples/client/others/java/okhttp-streaming/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/others/java/okhttp-streaming/README.md b/samples/client/others/java/okhttp-streaming/README.md index 7c095605e022..3e1b80d2a56e 100644 --- a/samples/client/others/java/okhttp-streaming/README.md +++ b/samples/client/others/java/okhttp-streaming/README.md @@ -2,7 +2,7 @@ ping some object - API version: 1.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiException.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiException.java index 61272b770b71..5af63875d647 100644 --- a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Configuration.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Configuration.java index 620825a03a63..1dac36361d14 100644 --- a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0"; diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Pair.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Pair.java index 1e7c6513059f..06ed5c69ee4e 100644 --- a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerConfiguration.java index 574af8480e31..97db32eef527 100644 --- a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerVariable.java index cc4ad5662cad..33809b3f521a 100644 --- a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/StringUtil.java index d26541fb68f8..090ca233f36f 100644 --- a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 5e9365e8496a..7f1f94fc1e6a 100644 --- a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/Authentication.java index 293103ff5b18..c94133f976f5 100644 --- a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index a6721964ac96..7aacbdfead8b 100644 --- a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index 3b18484db67f..94b43936343f 100644 --- a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index 0731563893df..307a46663b6c 100644 --- a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java index 8c99dd367449..1208b40511b4 100644 --- a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java @@ -50,7 +50,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class SimpleOneOf extends AbstractOpenApiSchema implements Serializable { private static final Logger log = Logger.getLogger(SimpleOneOf.class.getName()); diff --git a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SomeObj.java b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SomeObj.java index 7bfd57c0c641..5431a221ed28 100644 --- a/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SomeObj.java +++ b/samples/client/others/java/okhttp-streaming/src/main/java/org/openapitools/client/model/SomeObj.java @@ -49,7 +49,7 @@ /** * SomeObj */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class SomeObj implements Serializable { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/FILES index 40f8656e27ea..e51b0aac4512 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/README.md b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/README.md index 798d4c01fde7..b14a7fac3c7c 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/README.md +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/README.md @@ -2,7 +2,7 @@ OpenAPI Petstore - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiException.java index bbe1b2c8ee33..9485c28b6f26 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Configuration.java index ba56d6cab13d..0ed7ce6f5a7a 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Pair.java index 8b84ab37c82a..aa0e33c628b8 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerConfiguration.java index ae47d8bdb452..29afa7de9e13 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerVariable.java index 1b09cdb8d75c..dfc4e3418738 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/StringUtil.java index a4859da9a700..dcde7de52e55 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 334ae1f6fd40..b4aecef2c8d4 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/Authentication.java index 07839e9966cf..3a053490df87 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index 85d6556f1f68..566f23165854 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index f728b306c358..f45c6ba8b3be 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuth.java index 0b5e71fe6212..eda5efa2c900 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 0de7ae9fc491..136f78f5a053 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -16,7 +16,7 @@ /** * OAuth flows that are supported by this client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public enum OAuthFlow { ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 IMPLICIT, diff --git a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index bdd0ae91976f..f19d8a4b6628 100644 --- a/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp-3.1/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-3.1/.openapi-generator/FILES index d3b41a232a08..881a95e65ce4 100644 --- a/samples/client/petstore/java/okhttp-3.1/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-3.1/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -100,28 +99,3 @@ src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java src/main/java/org/openapitools/client/model/StringOrInt.java src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/User.java -src/test/java/org/openapitools/client/api/DefaultApiTest.java -src/test/java/org/openapitools/client/api/FakeApiTest.java -src/test/java/org/openapitools/client/api/PetApiTest.java -src/test/java/org/openapitools/client/api/StoreApiTest.java -src/test/java/org/openapitools/client/api/UserApiTest.java -src/test/java/org/openapitools/client/model/CircularReference2Test.java -src/test/java/org/openapitools/client/model/CircularReference3Test.java -src/test/java/org/openapitools/client/model/CodesEnumTest.java -src/test/java/org/openapitools/client/model/DogTest.java -src/test/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEventTest.java -src/test/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestTest.java -src/test/java/org/openapitools/client/model/ModelApiResponseTest.java -src/test/java/org/openapitools/client/model/OneOfStringOrIntTest.java -src/test/java/org/openapitools/client/model/OrderTest.java -src/test/java/org/openapitools/client/model/PetTest.java -src/test/java/org/openapitools/client/model/PetWithTypesObjectNullAndRefTest.java -src/test/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameterTest.java -src/test/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameterTest.java -src/test/java/org/openapitools/client/model/SelfReferenceAdditionalPropertiesTest.java -src/test/java/org/openapitools/client/model/SelfReferenceAnyOfTest.java -src/test/java/org/openapitools/client/model/SelfReferenceOneOfTest.java -src/test/java/org/openapitools/client/model/SimpleModelWithArrayPropertyTest.java -src/test/java/org/openapitools/client/model/StringOrIntTest.java -src/test/java/org/openapitools/client/model/TagTest.java -src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/okhttp-3.1/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-3.1/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp-3.1/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp-3.1/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-3.1/README.md b/samples/client/petstore/java/okhttp-3.1/README.md index 1adc63426c9d..a2f956fe4019 100644 --- a/samples/client/petstore/java/okhttp-3.1/README.md +++ b/samples/client/petstore/java/okhttp-3.1/README.md @@ -2,7 +2,7 @@ OpenAPI Petstore - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. diff --git a/samples/client/petstore/java/okhttp-3.1/api/openapi.yaml b/samples/client/petstore/java/okhttp-3.1/api/openapi.yaml index 3c2a8895c3be..4348ded2a682 100644 --- a/samples/client/petstore/java/okhttp-3.1/api/openapi.yaml +++ b/samples/client/petstore/java/okhttp-3.1/api/openapi.yaml @@ -824,9 +824,7 @@ paths: application/json: schema: items: - allOf: - - $ref: "#/components/schemas/myObject" - nullable: true + $ref: "#/components/schemas/myObject" nullable: true type: array default: null diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiException.java index bbe1b2c8ee33..9485c28b6f26 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Configuration.java index ba56d6cab13d..0ed7ce6f5a7a 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Pair.java index 8b84ab37c82a..aa0e33c628b8 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerConfiguration.java index ae47d8bdb452..29afa7de9e13 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerVariable.java index 1b09cdb8d75c..dfc4e3418738 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/StringUtil.java index a4859da9a700..dcde7de52e55 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 334ae1f6fd40..b4aecef2c8d4 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/Authentication.java index 07839e9966cf..3a053490df87 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index 85d6556f1f68..566f23165854 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index f728b306c358..f45c6ba8b3be 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuth.java index 0b5e71fe6212..eda5efa2c900 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 0de7ae9fc491..136f78f5a053 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -16,7 +16,7 @@ /** * OAuth flows that are supported by this client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public enum OAuthFlow { ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 IMPLICIT, diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index bdd0ae91976f..f19d8a4b6628 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AllOfSimpleModel.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AllOfSimpleModel.java index e5e302aa0671..f744165112a7 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AllOfSimpleModel.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AllOfSimpleModel.java @@ -51,7 +51,7 @@ /** * AllOfSimpleModel */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfSimpleModel { public static final String SERIALIZED_NAME_ARRAY_OF_STRINGS = "arrayOfStrings"; @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRINGS) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Animal.java index 6d8843ed3434..36460a8ca1b5 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Animal.java @@ -48,7 +48,7 @@ /** * Animal */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AnyTypeTest.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AnyTypeTest.java index 93c3e174e71d..44a2da2cb967 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AnyTypeTest.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/AnyTypeTest.java @@ -52,7 +52,7 @@ /** * AnyTypeTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AnyTypeTest { public static final String SERIALIZED_NAME_ANY_TYPE_PROPERTY = "any_type_property"; @SerializedName(SERIALIZED_NAME_ANY_TYPE_PROPERTY) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ArrayOfSameRef.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ArrayOfSameRef.java index dc3a12928cc2..e03cdda678b8 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ArrayOfSameRef.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ArrayOfSameRef.java @@ -52,7 +52,7 @@ /** * ArrayOfSameRef */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOfSameRef { public static final String SERIALIZED_NAME_ARRAY_FOO_ONE = "arrayFooOne"; @SerializedName(SERIALIZED_NAME_ARRAY_FOO_ONE) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Cat.java index ea2537618d1f..bc2eb4e55f02 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Cat.java @@ -49,7 +49,7 @@ /** * Cat */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Cat extends Animal { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @SerializedName(SERIALIZED_NAME_DECLAWED) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Category.java index 1332de3a1697..75170905851e 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Category.java @@ -48,7 +48,7 @@ /** * A category for a pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference1.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference1.java index da15af42d2e1..51012b98bb25 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference1.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference1.java @@ -49,7 +49,7 @@ /** * CircularReference1 */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class CircularReference1 { public static final String SERIALIZED_NAME_PROP1 = "prop1"; @SerializedName(SERIALIZED_NAME_PROP1) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference2.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference2.java index b3970881184f..c88b32e97ae7 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference2.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference2.java @@ -49,7 +49,7 @@ /** * CircularReference2 */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class CircularReference2 { public static final String SERIALIZED_NAME_PROP1 = "prop1"; @SerializedName(SERIALIZED_NAME_PROP1) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference3.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference3.java index 1a403d0660e1..d36a93981443 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference3.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/CircularReference3.java @@ -49,7 +49,7 @@ /** * CircularReference3 */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class CircularReference3 { public static final String SERIALIZED_NAME_PROP1 = "prop1"; @SerializedName(SERIALIZED_NAME_PROP1) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Dog.java index 47eaca692db0..0e65c38e7e76 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Dog.java @@ -49,7 +49,7 @@ /** * Dog */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Dog extends Animal { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequest.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequest.java index 7fcb95cd550e..e37906c82910 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequest.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequest.java @@ -50,7 +50,7 @@ /** * inline schema in webhooks */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FakeWebhooksSourcesDeletedPostRequest { public static final String SERIALIZED_NAME_EVENT_TIMESTAMP = "event_timestamp"; @SerializedName(SERIALIZED_NAME_EVENT_TIMESTAMP) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEvent.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEvent.java index 55c7e9304cf2..0f81627b6e67 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEvent.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEvent.java @@ -48,7 +48,7 @@ /** * FakeWebhooksSourcesDeletedPostRequestEvent */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FakeWebhooksSourcesDeletedPostRequestEvent { public static final String SERIALIZED_NAME_EVENT_ID = "event_id"; @SerializedName(SERIALIZED_NAME_EVENT_ID) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 1bc343bd5338..bcb71975111c 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -48,7 +48,7 @@ /** * Describes the result of uploading an image resource */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/OneOfStringOrInt.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/OneOfStringOrInt.java index 058580b8da43..92354e2c47ae 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/OneOfStringOrInt.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/OneOfStringOrInt.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OneOfStringOrInt extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(OneOfStringOrInt.class.getName()); diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Order.java index db0571d69be1..7b8899c3232c 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Order.java @@ -49,7 +49,7 @@ /** * An order for a pets from the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Pet.java index 385b0eb2ad13..847f5f2df2cf 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Pet.java @@ -53,7 +53,7 @@ /** * A pet for sale in the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/PetWithTypesObjectNullAndRef.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/PetWithTypesObjectNullAndRef.java index c0a4c611876f..d64a42e1e28b 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/PetWithTypesObjectNullAndRef.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/PetWithTypesObjectNullAndRef.java @@ -49,7 +49,7 @@ /** * PetWithTypesObjectNullAndRef */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class PetWithTypesObjectNullAndRef { public static final String SERIALIZED_NAME_FIRST_PROPERTY = "first_property"; @SerializedName(SERIALIZED_NAME_FIRST_PROPERTY) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java index 143a1f91ea7e..aeb5c46fefc6 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RefRefToPathLevelParameterOneofRefToOneofParameter extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(RefRefToPathLevelParameterOneofRefToOneofParameter.class.getName()); diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java index 550b8b27b33e..e9326776e029 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java @@ -50,7 +50,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RefToRefParameterAnyofRefToAnyofParameter extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(RefToRefParameterAnyofRefToAnyofParameter.class.getName()); diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAdditionalProperties.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAdditionalProperties.java index 96087c314ad3..47847c48b760 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAdditionalProperties.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAdditionalProperties.java @@ -48,7 +48,7 @@ /** * SelfReferenceAdditionalProperties */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class SelfReferenceAdditionalProperties { public static final String SERIALIZED_NAME_DUMMY = "dummy"; @SerializedName(SERIALIZED_NAME_DUMMY) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java index 9ab6f5cc6046..71775caa26de 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class SelfReferenceAnyOf extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(SelfReferenceAnyOf.class.getName()); diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java index d003cac5b38e..9d08276c40c8 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class SelfReferenceOneOf extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(SelfReferenceOneOf.class.getName()); diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java index 5dce5dc12aca..8187e81331a4 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java @@ -51,7 +51,7 @@ /** * SimpleModelWithArrayProperty */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class SimpleModelWithArrayProperty { public static final String SERIALIZED_NAME_ARRAY_OF_STRINGS = "arrayOfStrings"; @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRINGS) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/StringOrInt.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/StringOrInt.java index d1509f3de8b9..eced9097cd92 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/StringOrInt.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/StringOrInt.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringOrInt extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(StringOrInt.class.getName()); diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Tag.java index de14a3aee9b3..c2492b60898a 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/Tag.java @@ -48,7 +48,7 @@ /** * A tag for a pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/User.java index 01d7a093236a..3e41dd625c81 100644 --- a/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-3.1/src/main/java/org/openapitools/client/model/User.java @@ -48,7 +48,7 @@ /** * A User who is purchasing from the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/FILES index ae8005a8abc5..19b673629ca7 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -55,6 +54,3 @@ src/main/java/org/openapitools/client/model/Order.java src/main/java/org/openapitools/client/model/Pet.java src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/User.java -src/test/java/org/openapitools/client/api/PetApiTest.java -src/test/java/org/openapitools/client/api/StoreApiTest.java -src/test/java/org/openapitools/client/api/UserApiTest.java diff --git a/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp-awsv4signature/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-awsv4signature/README.md b/samples/client/petstore/java/okhttp-awsv4signature/README.md index 57c164fe2035..78610a592f1b 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/README.md +++ b/samples/client/petstore/java/okhttp-awsv4signature/README.md @@ -2,7 +2,7 @@ OpenAPI Petstore - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiException.java index bbe1b2c8ee33..9485c28b6f26 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Configuration.java index ba56d6cab13d..0ed7ce6f5a7a 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Pair.java index 8b84ab37c82a..aa0e33c628b8 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerConfiguration.java index ae47d8bdb452..29afa7de9e13 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerVariable.java index 1b09cdb8d75c..dfc4e3418738 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/StringUtil.java index a4859da9a700..dcde7de52e55 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/AWS4Auth.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/AWS4Auth.java index 357580c13603..8a341e5f19fd 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/AWS4Auth.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/AWS4Auth.java @@ -38,7 +38,7 @@ import okio.Buffer; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AWS4Auth implements Authentication { private AwsCredentials credentials; diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 334ae1f6fd40..b4aecef2c8d4 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/Authentication.java index 07839e9966cf..3a053490df87 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index 85d6556f1f68..566f23165854 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index f728b306c358..f45c6ba8b3be 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuth.java index 0b5e71fe6212..eda5efa2c900 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 0de7ae9fc491..136f78f5a053 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -16,7 +16,7 @@ /** * OAuth flows that are supported by this client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public enum OAuthFlow { ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 IMPLICIT, diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index bdd0ae91976f..f19d8a4b6628 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Category.java index 1332de3a1697..75170905851e 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Category.java @@ -48,7 +48,7 @@ /** * A category for a pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 1bc343bd5338..bcb71975111c 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -48,7 +48,7 @@ /** * Describes the result of uploading an image resource */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Order.java index db0571d69be1..7b8899c3232c 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Order.java @@ -49,7 +49,7 @@ /** * An order for a pets from the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Pet.java index 385b0eb2ad13..847f5f2df2cf 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Pet.java @@ -53,7 +53,7 @@ /** * A pet for sale in the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Tag.java index de14a3aee9b3..c2492b60898a 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/Tag.java @@ -48,7 +48,7 @@ /** * A tag for a pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/User.java index 01d7a093236a..3e41dd625c81 100644 --- a/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-awsv4signature/src/main/java/org/openapitools/client/model/User.java @@ -48,7 +48,7 @@ /** * A User who is purchasing from the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/FILES index d8fcfa5a52db..61567b4d24af 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md build.gradle @@ -139,48 +138,3 @@ src/main/java/org/openapitools/client/model/TypeHolderExample.java src/main/java/org/openapitools/client/model/User.java src/main/java/org/openapitools/client/model/XmlItem.java src/main/resources/openapi/openapi.yaml -src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java -src/test/java/org/openapitools/client/api/FakeApiTest.java -src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java -src/test/java/org/openapitools/client/api/PetApiTest.java -src/test/java/org/openapitools/client/api/StoreApiTest.java -src/test/java/org/openapitools/client/api/UserApiTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java -src/test/java/org/openapitools/client/model/AnimalTest.java -src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java -src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java -src/test/java/org/openapitools/client/model/ArrayTestTest.java -src/test/java/org/openapitools/client/model/BigCatTest.java -src/test/java/org/openapitools/client/model/CapitalizationTest.java -src/test/java/org/openapitools/client/model/CatTest.java -src/test/java/org/openapitools/client/model/CategoryTest.java -src/test/java/org/openapitools/client/model/ClassModelTest.java -src/test/java/org/openapitools/client/model/ClientTest.java -src/test/java/org/openapitools/client/model/DogTest.java -src/test/java/org/openapitools/client/model/EnumArraysTest.java -src/test/java/org/openapitools/client/model/EnumClassTest.java -src/test/java/org/openapitools/client/model/EnumTestTest.java -src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java -src/test/java/org/openapitools/client/model/FormatTestTest.java -src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java -src/test/java/org/openapitools/client/model/MapTestTest.java -src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java -src/test/java/org/openapitools/client/model/Model200ResponseTest.java -src/test/java/org/openapitools/client/model/ModelApiResponseTest.java -src/test/java/org/openapitools/client/model/ModelFileTest.java -src/test/java/org/openapitools/client/model/ModelListTest.java -src/test/java/org/openapitools/client/model/ModelReturnTest.java -src/test/java/org/openapitools/client/model/NameTest.java -src/test/java/org/openapitools/client/model/NumberOnlyTest.java -src/test/java/org/openapitools/client/model/OrderTest.java -src/test/java/org/openapitools/client/model/OuterCompositeTest.java -src/test/java/org/openapitools/client/model/OuterEnumTest.java -src/test/java/org/openapitools/client/model/PetTest.java -src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java -src/test/java/org/openapitools/client/model/SpecialModelNameTest.java -src/test/java/org/openapitools/client/model/TagTest.java -src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java -src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java -src/test/java/org/openapitools/client/model/UserTest.java -src/test/java/org/openapitools/client/model/XmlItemTest.java diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp-dynamicOperations/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/README.md b/samples/client/petstore/java/okhttp-dynamicOperations/README.md index 91a7266702e6..c4172f600281 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/README.md +++ b/samples/client/petstore/java/okhttp-dynamicOperations/README.md @@ -2,7 +2,7 @@ OpenAPI Petstore - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiException.java index 0c0f52846910..9c908da3a538 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Configuration.java index 79955372fb33..91277dc82ed7 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Pair.java index 505e6f786f4c..2302aff4c8ae 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerConfiguration.java index 1787a231e76b..66eef5d718f2 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerVariable.java index bc81f54d83a6..d0c4814493ad 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/StringUtil.java index 6473166843d5..647c1e11fabc 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index ed5f5fbc16ef..aa7a99f8b6bc 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/Authentication.java index bd5e463d0b42..5fcf0aad8212 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index f655936f3a78..d7b733e2c91e 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index 5aff174aff81..bd3d7a329545 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuth.java index 6f945f45ed46..427a031ad1e2 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 59009502c11e..8d5408d02164 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -16,7 +16,7 @@ /** * OAuth flows that are supported by this client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public enum OAuthFlow { ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 IMPLICIT, diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index fc0f2c973b8d..f93e3410e7a0 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 11ff508eff98..888867b8316c 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -48,7 +48,7 @@ /** * AdditionalPropertiesAnyType */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesAnyType { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 522143d1ddd1..c5d578cbf49d 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -49,7 +49,7 @@ /** * AdditionalPropertiesArray */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesArray { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index f32945dec0a9..d205b93afb38 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -48,7 +48,7 @@ /** * AdditionalPropertiesBoolean */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesBoolean { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 0716e90f143a..8a6d07043a60 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -52,7 +52,7 @@ /** * AdditionalPropertiesClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesClass { public static final String SERIALIZED_NAME_MAP_STRING = "map_string"; @SerializedName(SERIALIZED_NAME_MAP_STRING) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index b6ad65a3d93b..39567e26f085 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -48,7 +48,7 @@ /** * AdditionalPropertiesInteger */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesInteger { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index e7e8fb3e2d97..2a87af7735b1 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -49,7 +49,7 @@ /** * AdditionalPropertiesNumber */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesNumber { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index e6c30e208bcb..a0157a4b84cb 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -49,7 +49,7 @@ /** * AdditionalPropertiesObject */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesObject { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 602531acecbd..94e5f9503fb9 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -48,7 +48,7 @@ /** * AdditionalPropertiesString */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesString { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java index 863dc4f2c6af..61eb307f1745 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java @@ -48,7 +48,7 @@ /** * Animal */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 9fa11c1dec04..2d0f09d8840e 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -52,7 +52,7 @@ /** * ArrayOfArrayOfNumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOfArrayOfNumberOnly { public static final String SERIALIZED_NAME_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_NUMBER) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 54bc3dab245c..35477c5cd14f 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -52,7 +52,7 @@ /** * ArrayOfNumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOfNumberOnly { public static final String SERIALIZED_NAME_ARRAY_NUMBER = "ArrayNumber"; @SerializedName(SERIALIZED_NAME_ARRAY_NUMBER) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java index 0b15754916be..0ff7b7fa42ea 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -52,7 +52,7 @@ /** * ArrayTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayTest { public static final String SERIALIZED_NAME_ARRAY_OF_STRING = "array_of_string"; @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRING) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java index 86dde9e1b54a..54e57b3da4e5 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java @@ -49,7 +49,7 @@ /** * BigCat */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class BigCat extends Cat { /** * Gets or Sets kind diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java index 291bb7beb6f7..fe8c4f2825be 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java @@ -48,7 +48,7 @@ /** * Capitalization */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Capitalization { public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java index e4cfbd7ad1a4..9fffa3468bdc 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java @@ -49,7 +49,7 @@ /** * Cat */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Cat extends Animal { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @SerializedName(SERIALIZED_NAME_DECLAWED) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java index cdcca238f7dd..e66f89810db0 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java @@ -48,7 +48,7 @@ /** * Category */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java index 6fae629ac3a7..870c99eab146 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java @@ -48,7 +48,7 @@ /** * Model for testing model with \"_class\" property */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ClassModel { public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java index 62f069e6fd3d..a261dc0662cc 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java @@ -48,7 +48,7 @@ /** * Client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Client { public static final String SERIALIZED_NAME_CLIENT = "client"; @SerializedName(SERIALIZED_NAME_CLIENT) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java index d4eea59a7489..a04316ce66a1 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java @@ -49,7 +49,7 @@ /** * Dog */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Dog extends Animal { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java index 47f4070936e1..8bd57d56a6ed 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -51,7 +51,7 @@ /** * EnumArrays */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class EnumArrays { /** * Gets or Sets justSymbol diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java index a9447d6d0f4c..6f92a1af5b5b 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java @@ -49,7 +49,7 @@ /** * EnumTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class EnumTest { /** * Gets or Sets enumString diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 0219e702328f..82d36642ade0 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -52,7 +52,7 @@ /** * FileSchemaTestClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FileSchemaTestClass { public static final String SERIALIZED_NAME_FILE = "file"; @SerializedName(SERIALIZED_NAME_FILE) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java index 2fff3e2bbf72..d8c5251a2371 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java @@ -53,7 +53,7 @@ /** * FormatTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FormatTest { public static final String SERIALIZED_NAME_INTEGER = "integer"; @SerializedName(SERIALIZED_NAME_INTEGER) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index df196bd860ad..a340e715afb1 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -48,7 +48,7 @@ /** * HasOnlyReadOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HasOnlyReadOnly { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java index 1fc4162a1ce4..edcd8ee2f43e 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java @@ -50,7 +50,7 @@ /** * MapTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class MapTest { public static final String SERIALIZED_NAME_MAP_MAP_OF_STRING = "map_map_of_string"; @SerializedName(SERIALIZED_NAME_MAP_MAP_OF_STRING) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 8bc28a991837..ba52faafbdba 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -53,7 +53,7 @@ /** * MixedPropertiesAndAdditionalPropertiesClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class MixedPropertiesAndAdditionalPropertiesClass { public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java index 9d77344b1312..79ffde2ca538 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java @@ -48,7 +48,7 @@ /** * Model for testing model name starting with number */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Model200Response { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 0226b8d4f78a..ca1668680dcc 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -48,7 +48,7 @@ /** * ModelApiResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java index 76effe548439..7818bf9dab2e 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java @@ -48,7 +48,7 @@ /** * Must be named `File` for test. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelFile { public static final String SERIALIZED_NAME_SOURCE_U_R_I = "sourceURI"; @SerializedName(SERIALIZED_NAME_SOURCE_U_R_I) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java index 928e9aff0df6..99fa11d889d6 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java @@ -48,7 +48,7 @@ /** * ModelList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelList { public static final String SERIALIZED_NAME_123LIST = "123-list"; @SerializedName(SERIALIZED_NAME_123LIST) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java index 63b1f166ea3d..1431f370b37b 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -48,7 +48,7 @@ /** * Model for testing reserved words */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelReturn { public static final String SERIALIZED_NAME_RETURN = "return"; @SerializedName(SERIALIZED_NAME_RETURN) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java index de9280ee45a0..c6969fa0e2f2 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java @@ -48,7 +48,7 @@ /** * Model for testing model name same as property name */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Name { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java index da3981561f21..1255059f338b 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -49,7 +49,7 @@ /** * NumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NumberOnly { public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; @SerializedName(SERIALIZED_NAME_JUST_NUMBER) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java index 452fc17cdf89..3db1dc965b17 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java @@ -49,7 +49,7 @@ /** * Order */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java index 5beecae7b654..b91ebce25002 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -49,7 +49,7 @@ /** * OuterComposite */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OuterComposite { public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; @SerializedName(SERIALIZED_NAME_MY_NUMBER) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java index d8d49aa73aa7..3acd8a858621 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java @@ -55,7 +55,7 @@ /** * Pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 36b08b00c770..2928d103eaeb 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -48,7 +48,7 @@ /** * ReadOnlyFirst */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ReadOnlyFirst { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java index 337e39c20b3e..8f05a6c77373 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -48,7 +48,7 @@ /** * SpecialModelName */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class SpecialModelName { public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java index fce033bea795..91ef62bc911d 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java @@ -48,7 +48,7 @@ /** * Tag */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 4540730ac5c7..b11b03548098 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -52,7 +52,7 @@ /** * TypeHolderDefault */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class TypeHolderDefault { public static final String SERIALIZED_NAME_STRING_ITEM = "string_item"; @SerializedName(SERIALIZED_NAME_STRING_ITEM) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java index d81650d6c8eb..1497135e3b67 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -52,7 +52,7 @@ /** * TypeHolderExample */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class TypeHolderExample { public static final String SERIALIZED_NAME_STRING_ITEM = "string_item"; @SerializedName(SERIALIZED_NAME_STRING_ITEM) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/User.java index f4f1f2701843..dcf4acac803c 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/User.java @@ -48,7 +48,7 @@ /** * User */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java index a5c8c84ad08d..b99d9670504c 100644 --- a/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java @@ -52,7 +52,7 @@ /** * XmlItem */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class XmlItem { public static final String SERIALIZED_NAME_ATTRIBUTE_STRING = "attribute_string"; @SerializedName(SERIALIZED_NAME_ATTRIBUTE_STRING) diff --git a/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/FILES index 98017590a055..f7c346d8876f 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -50,5 +49,3 @@ src/main/java/org/openapitools/client/model/Order.java src/main/java/org/openapitools/client/model/Pet.java src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/User.java -src/test/java/org/openapitools/client/api/PetApiTest.java -src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp-group-parameter/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-group-parameter/README.md b/samples/client/petstore/java/okhttp-group-parameter/README.md index fbd8bf8d5d81..bc19bbf8d913 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/README.md +++ b/samples/client/petstore/java/okhttp-group-parameter/README.md @@ -2,7 +2,7 @@ OpenAPI Petstore - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiException.java index bbe1b2c8ee33..9485c28b6f26 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Configuration.java index ba56d6cab13d..0ed7ce6f5a7a 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Pair.java index 8b84ab37c82a..aa0e33c628b8 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerConfiguration.java index ae47d8bdb452..29afa7de9e13 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerVariable.java index 1b09cdb8d75c..dfc4e3418738 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/StringUtil.java index a4859da9a700..dcde7de52e55 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 334ae1f6fd40..b4aecef2c8d4 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/Authentication.java index 07839e9966cf..3a053490df87 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index 85d6556f1f68..566f23165854 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index f728b306c358..f45c6ba8b3be 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuth.java index 0b5e71fe6212..eda5efa2c900 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 0de7ae9fc491..136f78f5a053 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -16,7 +16,7 @@ /** * OAuth flows that are supported by this client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public enum OAuthFlow { ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 IMPLICIT, diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index bdd0ae91976f..f19d8a4b6628 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Category.java index 1332de3a1697..75170905851e 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Category.java @@ -48,7 +48,7 @@ /** * A category for a pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 1bc343bd5338..bcb71975111c 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -48,7 +48,7 @@ /** * Describes the result of uploading an image resource */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Order.java index db0571d69be1..7b8899c3232c 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Order.java @@ -49,7 +49,7 @@ /** * An order for a pets from the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Pet.java index 385b0eb2ad13..847f5f2df2cf 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Pet.java @@ -53,7 +53,7 @@ /** * A pet for sale in the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Tag.java index de14a3aee9b3..c2492b60898a 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/Tag.java @@ -48,7 +48,7 @@ /** * A tag for a pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/User.java index 01d7a093236a..3e41dd625c81 100644 --- a/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-group-parameter/src/main/java/org/openapitools/client/model/User.java @@ -48,7 +48,7 @@ /** * A User who is purchasing from the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jackson/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-jackson/.openapi-generator/FILES index fecfdd629754..5a987dde702f 100644 --- a/samples/client/petstore/java/okhttp-jackson/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-jackson/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -281,124 +280,3 @@ src/main/java/org/openapitools/client/model/Value.java src/main/java/org/openapitools/client/model/Variable.java src/main/java/org/openapitools/client/model/Whale.java src/main/java/org/openapitools/client/model/Zebra.java -src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java -src/test/java/org/openapitools/client/api/DefaultApiTest.java -src/test/java/org/openapitools/client/api/FakeApiTest.java -src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java -src/test/java/org/openapitools/client/api/PetApiTest.java -src/test/java/org/openapitools/client/api/StoreApiTest.java -src/test/java/org/openapitools/client/api/UserApiTest.java -src/test/java/org/openapitools/client/api/ValuesApiTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java -src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java -src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java -src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java -src/test/java/org/openapitools/client/model/AnimalTest.java -src/test/java/org/openapitools/client/model/AppleReqTest.java -src/test/java/org/openapitools/client/model/AppleTest.java -src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java -src/test/java/org/openapitools/client/model/ArrayDefaultTest.java -src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java -src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java -src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java -src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java -src/test/java/org/openapitools/client/model/ArrayOneOfTest.java -src/test/java/org/openapitools/client/model/ArrayTestTest.java -src/test/java/org/openapitools/client/model/BananaReqTest.java -src/test/java/org/openapitools/client/model/BananaTest.java -src/test/java/org/openapitools/client/model/BasquePigTest.java -src/test/java/org/openapitools/client/model/CapitalizationTest.java -src/test/java/org/openapitools/client/model/CatTest.java -src/test/java/org/openapitools/client/model/CategoryTest.java -src/test/java/org/openapitools/client/model/ClassModelTest.java -src/test/java/org/openapitools/client/model/ClientTest.java -src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java -src/test/java/org/openapitools/client/model/DanishPigTest.java -src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java -src/test/java/org/openapitools/client/model/DogTest.java -src/test/java/org/openapitools/client/model/DrawingTest.java -src/test/java/org/openapitools/client/model/EnumArraysTest.java -src/test/java/org/openapitools/client/model/EnumClassTest.java -src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java -src/test/java/org/openapitools/client/model/EnumTestTest.java -src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java -src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java -src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java -src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java -src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java -src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java -src/test/java/org/openapitools/client/model/FooTest.java -src/test/java/org/openapitools/client/model/FormatTestTest.java -src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java -src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java -src/test/java/org/openapitools/client/model/FruitReqTest.java -src/test/java/org/openapitools/client/model/FruitTest.java -src/test/java/org/openapitools/client/model/GmFruitTest.java -src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java -src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java -src/test/java/org/openapitools/client/model/HealthCheckResultTest.java -src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java -src/test/java/org/openapitools/client/model/MammalAnyofTest.java -src/test/java/org/openapitools/client/model/MammalTest.java -src/test/java/org/openapitools/client/model/MapTestTest.java -src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java -src/test/java/org/openapitools/client/model/Model200ResponseTest.java -src/test/java/org/openapitools/client/model/ModelApiResponseTest.java -src/test/java/org/openapitools/client/model/ModelFileTest.java -src/test/java/org/openapitools/client/model/ModelListTest.java -src/test/java/org/openapitools/client/model/ModelReturnTest.java -src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java -src/test/java/org/openapitools/client/model/NameTest.java -src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java -src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java -src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java -src/test/java/org/openapitools/client/model/NewPetTest.java -src/test/java/org/openapitools/client/model/NullableClassTest.java -src/test/java/org/openapitools/client/model/NullableEnumTest.java -src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java -src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java -src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java -src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java -src/test/java/org/openapitools/client/model/NullableShapeTest.java -src/test/java/org/openapitools/client/model/NumberOnlyTest.java -src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java -src/test/java/org/openapitools/client/model/OrderTest.java -src/test/java/org/openapitools/client/model/OuterCompositeTest.java -src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java -src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java -src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java -src/test/java/org/openapitools/client/model/OuterEnumTest.java -src/test/java/org/openapitools/client/model/ParentPetTest.java -src/test/java/org/openapitools/client/model/PetCompositionTest.java -src/test/java/org/openapitools/client/model/PetRefTest.java -src/test/java/org/openapitools/client/model/PetTest.java -src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java -src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java -src/test/java/org/openapitools/client/model/PigTest.java -src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java -src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java -src/test/java/org/openapitools/client/model/QuadrilateralTest.java -src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java -src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java -src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java -src/test/java/org/openapitools/client/model/ScalarTest.java -src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java -src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java -src/test/java/org/openapitools/client/model/ShapeOrNullTest.java -src/test/java/org/openapitools/client/model/ShapeTest.java -src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java -src/test/java/org/openapitools/client/model/SpecialModelNameTest.java -src/test/java/org/openapitools/client/model/TagTest.java -src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java -src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java -src/test/java/org/openapitools/client/model/TriangleTest.java -src/test/java/org/openapitools/client/model/UserTest.java -src/test/java/org/openapitools/client/model/ValueTest.java -src/test/java/org/openapitools/client/model/VariableTest.java -src/test/java/org/openapitools/client/model/WhaleTest.java -src/test/java/org/openapitools/client/model/ZebraTest.java diff --git a/samples/client/petstore/java/okhttp-jackson/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-jackson/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp-jackson/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp-jackson/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-jackson/README.md b/samples/client/petstore/java/okhttp-jackson/README.md index 86feb56c87d9..c2f422a26ce0 100644 --- a/samples/client/petstore/java/okhttp-jackson/README.md +++ b/samples/client/petstore/java/okhttp-jackson/README.md @@ -2,7 +2,7 @@ OpenAPI Petstore - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiException.java index 0c0f52846910..9c908da3a538 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Configuration.java index 79955372fb33..91277dc82ed7 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Pair.java index 505e6f786f4c..2302aff4c8ae 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339DateFormat.java index f714c4f40799..6df05d06dd91 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339DateFormat.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -21,7 +21,7 @@ import java.util.TimeZone; import com.fasterxml.jackson.databind.util.StdDateFormat; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java index 7c21d936c8c7..3a579cd05009 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java @@ -28,7 +28,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RFC3339InstantDeserializer extends InstantDeserializer { private static final long serialVersionUID = 1L; private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java index b5d92286f00a..6aa78ceb40d7 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java @@ -19,7 +19,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.Module.SetupContext; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RFC3339JavaTimeModule extends SimpleModule { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerConfiguration.java index 1787a231e76b..66eef5d718f2 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerVariable.java index bc81f54d83a6..d0c4814493ad 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/StringUtil.java index 6473166843d5..647c1e11fabc 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index ed5f5fbc16ef..aa7a99f8b6bc 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/Authentication.java index bd5e463d0b42..5fcf0aad8212 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index f655936f3a78..d7b733e2c91e 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index 5aff174aff81..bd3d7a329545 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuth.java index 6f945f45ed46..427a031ad1e2 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 59009502c11e..8d5408d02164 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -16,7 +16,7 @@ /** * OAuth flows that are supported by this client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public enum OAuthFlow { ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 IMPLICIT, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index 1ec47bee4310..519b0151d737 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -22,7 +22,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 66b4cf7a5a8b..cfa3cae25ea7 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -47,7 +47,7 @@ /** * AdditionalPropertiesClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AdditionalPropertiesClass.JSON_PROPERTY_MAP_PROPERTY, AdditionalPropertiesClass.JSON_PROPERTY_MAP_OF_MAP_PROPERTY, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java index 4311c60ce2e5..27b5d4200e91 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java @@ -43,7 +43,7 @@ /** * AllOfModelArrayAnyOf */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AllOfModelArrayAnyOf.JSON_PROPERTY_ID, AllOfModelArrayAnyOf.JSON_PROPERTY_NAME, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java index 627ce13f13ce..3b808c6bc450 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java @@ -42,7 +42,7 @@ /** * AllOfModelArrayAnyOfAllOfAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AllOfModelArrayAnyOfAllOfAttributes.JSON_PROPERTY_C }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java index a5c5ad165d97..67e900fe592a 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java @@ -60,7 +60,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = AllOfModelArrayAnyOfAllOfAttributesC.AllOfModelArrayAnyOfAllOfAttributesCDeserializer.class) @JsonSerialize(using = AllOfModelArrayAnyOfAllOfAttributesC.AllOfModelArrayAnyOfAllOfAttributesCSerializer.class) public class AllOfModelArrayAnyOfAllOfAttributesC extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java index 817d6ac39847..13d0f7c95316 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java @@ -45,7 +45,7 @@ /** * AllOfModelArrayAnyOfAllOfLinkListColumn1 */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AllOfModelArrayAnyOfAllOfLinkListColumn1.JSON_PROPERTY_VALUE }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java index 914754b642d1..4946d7b254cf 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java @@ -58,7 +58,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = AllOfModelArrayAnyOfAllOfLinkListColumn1Value.AllOfModelArrayAnyOfAllOfLinkListColumn1ValueDeserializer.class) @JsonSerialize(using = AllOfModelArrayAnyOfAllOfLinkListColumn1Value.AllOfModelArrayAnyOfAllOfLinkListColumn1ValueSerializer.class) public class AllOfModelArrayAnyOfAllOfLinkListColumn1Value extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java index 655538e37aeb..ea19197f4843 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -41,7 +41,7 @@ /** * Object with allOf ref to double */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AllOfRefToDouble.JSON_PROPERTY_HEIGHT }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java index 945e824a80ca..cd9f32bc7a26 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -41,7 +41,7 @@ /** * Object with allOf ref to float */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AllOfRefToFloat.JSON_PROPERTY_WEIGHT }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToLong.java index cea0e86f9aeb..a58ac07601d3 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToLong.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -41,7 +41,7 @@ /** * Object with allOf ref to long */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AllOfRefToLong.JSON_PROPERTY_ID }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Animal.java index afd67c54d3d9..c3bd13e2ea70 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Animal.java @@ -44,7 +44,7 @@ /** * Animal */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonIgnoreProperties( value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization allowSetters = true // allows the className to be set during deserialization diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Apple.java index 63a133309e83..a83b6f930658 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Apple.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Apple.java @@ -41,7 +41,7 @@ /** * Apple */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Apple.JSON_PROPERTY_CULTIVAR, Apple.JSON_PROPERTY_ORIGIN diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AppleReq.java index a4f68e5be9fe..76ff3cf6509c 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AppleReq.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/AppleReq.java @@ -41,7 +41,7 @@ /** * AppleReq */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AppleReq.JSON_PROPERTY_CULTIVAR, AppleReq.JSON_PROPERTY_MEALY diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayAnyOf.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayAnyOf.java index bdc32afca0fc..13b9bcfe4eb9 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayAnyOf.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayAnyOf.java @@ -48,7 +48,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = ArrayAnyOf.ArrayAnyOfDeserializer.class) @JsonSerialize(using = ArrayAnyOf.ArrayAnyOfSerializer.class) public class ArrayAnyOf extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayDefault.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayDefault.java index cbeb53bbebb8..faf626a61495 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayDefault.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayDefault.java @@ -44,7 +44,7 @@ /** * ArrayDefault */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ArrayDefault.JSON_PROPERTY_WITH_DEFAULT_EMPTY_BRACKET, ArrayDefault.JSON_PROPERTY_WITHOUT_DEFAULT diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 55d8df1f17eb..14f79ee8e2fa 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -45,7 +45,7 @@ /** * ArrayOfArrayOfNumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java index aa9ca2954b56..526796c40812 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java @@ -45,7 +45,7 @@ /** * ArrayOfInlineAllOf */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ArrayOfInlineAllOf.JSON_PROPERTY_ID, ArrayOfInlineAllOf.JSON_PROPERTY_NAME, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java index 8b28de960822..cc50b3e6ad73 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java @@ -41,7 +41,7 @@ /** * ArrayOfInlineAllOfArrayAllofDogPropertyInner */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ArrayOfInlineAllOfArrayAllofDogPropertyInner.JSON_PROPERTY_BREED, ArrayOfInlineAllOfArrayAllofDogPropertyInner.JSON_PROPERTY_COLOR diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 7fb4614023ff..f265da109e7c 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -45,7 +45,7 @@ /** * ArrayOfNumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOneOf.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOneOf.java index 454e3fd5f59d..78630e35b642 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOneOf.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayOneOf.java @@ -48,7 +48,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = ArrayOneOf.ArrayOneOfDeserializer.class) @JsonSerialize(using = ArrayOneOf.ArrayOneOfSerializer.class) public class ArrayOneOf extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayTest.java index cc8722bd97c6..f27d3a171c41 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -45,7 +45,7 @@ /** * ArrayTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Banana.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Banana.java index a8151d252dfe..815a31d7938f 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Banana.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Banana.java @@ -42,7 +42,7 @@ /** * Banana */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Banana.JSON_PROPERTY_LENGTH_CM }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BananaReq.java index f1cc630ef0b0..5c97265fb274 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BananaReq.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BananaReq.java @@ -42,7 +42,7 @@ /** * BananaReq */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ BananaReq.JSON_PROPERTY_LENGTH_CM, BananaReq.JSON_PROPERTY_SWEET diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BasquePig.java index 71ac03a7cc6e..61dd9d8793f4 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BasquePig.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/BasquePig.java @@ -41,7 +41,7 @@ /** * BasquePig */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ BasquePig.JSON_PROPERTY_CLASS_NAME }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Capitalization.java index 1185c43743cc..72668a981573 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Capitalization.java @@ -41,7 +41,7 @@ /** * Capitalization */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Capitalization.JSON_PROPERTY_SMALL_CAMEL, Capitalization.JSON_PROPERTY_CAPITAL_CAMEL, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Cat.java index b3c0e810e351..f21c966473cd 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Cat.java @@ -46,7 +46,7 @@ /** * Cat */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonIgnoreProperties( value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization allowSetters = true // allows the className to be set during deserialization diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Category.java index 3fdfbf4488a6..2718c3d902bd 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Category.java @@ -41,7 +41,7 @@ /** * Category */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Category.JSON_PROPERTY_ID, Category.JSON_PROPERTY_NAME diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ClassModel.java index d9efc8b877aa..a4fff9ede5f8 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ClassModel.java @@ -41,7 +41,7 @@ /** * Model for testing model with \"_class\" property */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ClassModel.JSON_PROPERTY_PROPERTY_CLASS }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Client.java index 7e4e6e5e71ee..fa9f5aab6edf 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Client.java @@ -41,7 +41,7 @@ /** * Client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Client.JSON_PROPERTY_CLIENT }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java index 8b8b5d03b6ba..990b5aaaa638 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -41,7 +41,7 @@ /** * ComplexQuadrilateral */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ComplexQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, ComplexQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DanishPig.java index 6cca04b81255..69122f06c609 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DanishPig.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DanishPig.java @@ -41,7 +41,7 @@ /** * DanishPig */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ DanishPig.JSON_PROPERTY_CLASS_NAME }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DeprecatedObject.java index 950f3f417e17..7a7dd9e784c7 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DeprecatedObject.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -43,7 +43,7 @@ * @deprecated */ @Deprecated -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ DeprecatedObject.JSON_PROPERTY_NAME }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Dog.java index b622431d9d37..9157b9f7b282 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Dog.java @@ -45,7 +45,7 @@ /** * Dog */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonIgnoreProperties( value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization allowSetters = true // allows the className to be set during deserialization diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Drawing.java index 3fbacecbcdd7..b04b97a2d9b7 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Drawing.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Drawing.java @@ -52,7 +52,7 @@ /** * Drawing */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Drawing.JSON_PROPERTY_MAIN_SHAPE, Drawing.JSON_PROPERTY_SHAPE_OR_NULL, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumArrays.java index 2af92cd3a26b..e8b541e06412 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -44,7 +44,7 @@ /** * EnumArrays */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ EnumArrays.JSON_PROPERTY_JUST_SYMBOL, EnumArrays.JSON_PROPERTY_ARRAY_ENUM diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java index 6f379af414f1..e66387af10be 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java @@ -44,7 +44,7 @@ /** * An object to test discriminator of enum string */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonIgnoreProperties( value = "enum_str_type", // ignore manually set enum_str_type, it will be automatically generated by Jackson during serialization allowSetters = true // allows the enum_str_type to be set during deserialization diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumTest.java index f9ed98626685..90cb9ee604e6 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EnumTest.java @@ -49,7 +49,7 @@ /** * EnumTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ EnumTest.JSON_PROPERTY_ENUM_STRING, EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java index d6783c618dd4..7d39e1d05ab6 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -41,7 +41,7 @@ /** * EquilateralTriangle */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ EquilateralTriangle.JSON_PROPERTY_SHAPE_TYPE, EquilateralTriangle.JSON_PROPERTY_TRIANGLE_TYPE diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java index fde11aa5df8e..4abf93bffcc1 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = FakeAnyOfWIthSameErasureGet200Response.FakeAnyOfWIthSameErasureGet200ResponseDeserializer.class) @JsonSerialize(using = FakeAnyOfWIthSameErasureGet200Response.FakeAnyOfWIthSameErasureGet200ResponseSerializer.class) public class FakeAnyOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java index fb1adba68241..e6abbcefb9d5 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = FakeOneOfWIthSameErasureGet200Response.FakeOneOfWIthSameErasureGet200ResponseDeserializer.class) @JsonSerialize(using = FakeOneOfWIthSameErasureGet200Response.FakeOneOfWIthSameErasureGet200ResponseSerializer.class) public class FakeOneOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java index ad3dbffdca98..f7351aa0f137 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java @@ -48,7 +48,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = FakeRefParameterPetIdParameter.FakeRefParameterPetIdParameterDeserializer.class) @JsonSerialize(using = FakeRefParameterPetIdParameter.FakeRefParameterPetIdParameterSerializer.class) public class FakeRefParameterPetIdParameter extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 6c5ac5830186..4e1210d3e9e1 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -45,7 +45,7 @@ /** * FileSchemaTestClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ FileSchemaTestClass.JSON_PROPERTY_FILE, FileSchemaTestClass.JSON_PROPERTY_FILES diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Foo.java index 966b8f57c89a..a3fc01fd175a 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Foo.java @@ -41,7 +41,7 @@ /** * Foo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Foo.JSON_PROPERTY_BAR }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java index 117141b28783..2156bbe53381 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -42,7 +42,7 @@ /** * FooGetDefaultResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ FooGetDefaultResponse.JSON_PROPERTY_STRING }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FormatTest.java index e00e4d663914..89f29814fb79 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FormatTest.java @@ -46,7 +46,7 @@ /** * FormatTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ FormatTest.JSON_PROPERTY_INTEGER, FormatTest.JSON_PROPERTY_INT32, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java index cd49b5daab3a..afe4bbb7b3b5 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java @@ -42,7 +42,7 @@ /** * FreeFormObjectTestClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ FreeFormObjectTestClass.JSON_PROPERTY_NAME, FreeFormObjectTestClass.JSON_PROPERTY_PROPERTIES diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java index b60fc21ebc46..50f9f3258873 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = FreeFormObjectTestClassProperties.FreeFormObjectTestClassPropertiesDeserializer.class) @JsonSerialize(using = FreeFormObjectTestClassProperties.FreeFormObjectTestClassPropertiesSerializer.class) public class FreeFormObjectTestClassProperties extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Fruit.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Fruit.java index 9faef1e278d2..84ad0d5cd517 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Fruit.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Fruit.java @@ -55,7 +55,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Fruit.FruitDeserializer.class) @JsonSerialize(using = Fruit.FruitSerializer.class) public class Fruit extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FruitReq.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FruitReq.java index aef663ec802b..be2c958f00c8 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FruitReq.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/FruitReq.java @@ -55,7 +55,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = FruitReq.FruitReqDeserializer.class) @JsonSerialize(using = FruitReq.FruitReqSerializer.class) public class FruitReq extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GmFruit.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GmFruit.java index e10ae54d5749..12d9b8c03855 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GmFruit.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GmFruit.java @@ -55,7 +55,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = GmFruit.GmFruitDeserializer.class) @JsonSerialize(using = GmFruit.GmFruitSerializer.class) public class GmFruit extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GrandparentAnimal.java index 63cb68ffe0f3..f21af39db902 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GrandparentAnimal.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -44,7 +44,7 @@ /** * GrandparentAnimal */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonIgnoreProperties( value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization allowSetters = true // allows the pet_type to be set during deserialization diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index c49db8e90a3c..443d2c37efc1 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -41,7 +41,7 @@ /** * HasOnlyReadOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ HasOnlyReadOnly.JSON_PROPERTY_BAR, HasOnlyReadOnly.JSON_PROPERTY_FOO diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HealthCheckResult.java index 11121074badb..0217ed18935e 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -45,7 +45,7 @@ /** * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ HealthCheckResult.JSON_PROPERTY_NULLABLE_MESSAGE }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java index 30b14216a418..ea5e542ed53c 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -41,7 +41,7 @@ /** * IsoscelesTriangle */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ IsoscelesTriangle.JSON_PROPERTY_SHAPE_TYPE, IsoscelesTriangle.JSON_PROPERTY_TRIANGLE_TYPE diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Mammal.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Mammal.java index b293bcba31dd..727471ea0738 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Mammal.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Mammal.java @@ -58,7 +58,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Mammal.MammalDeserializer.class) @JsonSerialize(using = Mammal.MammalSerializer.class) public class Mammal extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MammalAnyof.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MammalAnyof.java index 3acecac86d58..4dace1132334 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MammalAnyof.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MammalAnyof.java @@ -58,7 +58,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = MammalAnyof.MammalAnyofDeserializer.class) @JsonSerialize(using = MammalAnyof.MammalAnyofSerializer.class) public class MammalAnyof extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MapTest.java index bf74f8741a6f..13f391cab47c 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MapTest.java @@ -43,7 +43,7 @@ /** * MapTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ MapTest.JSON_PROPERTY_MAP_MAP_OF_STRING, MapTest.JSON_PROPERTY_MAP_OF_ENUM_STRING, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 44b18c7d617a..209fc077ddc4 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -46,7 +46,7 @@ /** * MixedPropertiesAndAdditionalPropertiesClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Model200Response.java index e5d366c952db..09368d5e6618 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Model200Response.java @@ -41,7 +41,7 @@ /** * Model for testing model name starting with number */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Model200Response.JSON_PROPERTY_NAME, Model200Response.JSON_PROPERTY_PROPERTY_CLASS diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 17dd00b0e149..f0ccef5f72fd 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -41,7 +41,7 @@ /** * ModelApiResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ModelApiResponse.JSON_PROPERTY_CODE, ModelApiResponse.JSON_PROPERTY_TYPE, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelFile.java index 203a61b27ee2..c9ac76eb736e 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelFile.java @@ -41,7 +41,7 @@ /** * Must be named `File` for test. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ModelFile.JSON_PROPERTY_SOURCE_U_R_I }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelList.java index 6ce2a025f709..120e15007703 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelList.java @@ -41,7 +41,7 @@ /** * ModelList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ModelList.JSON_PROPERTY_123LIST }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelReturn.java index d088af9105fc..e0f1ddf3cfc9 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -41,7 +41,7 @@ /** * Model for testing reserved words */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ModelReturn.JSON_PROPERTY_RETURN }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java index 38a7644c5816..1b938590877b 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java @@ -43,7 +43,7 @@ /** * ModelWithOneOfAnyOfProperties */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ModelWithOneOfAnyOfProperties.JSON_PROPERTY_ONEOF_PROP, ModelWithOneOfAnyOfProperties.JSON_PROPERTY_ANYOF_PROP diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Name.java index 76b870a31a90..fa530a1142dc 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Name.java @@ -41,7 +41,7 @@ /** * Model for testing model name same as property name */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Name.JSON_PROPERTY_NAME, Name.JSON_PROPERTY_SNAKE_CASE, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java index cabe50bf5061..e8aec5ba8e35 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java @@ -44,7 +44,7 @@ /** * NestedArrayWithDefaultValues */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NestedArrayWithDefaultValues.JSON_PROPERTY_NESTED_ARRAY }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPet.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPet.java index 76a462ad38df..70d7dbefb2d7 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPet.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPet.java @@ -47,7 +47,7 @@ /** * NewPet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NewPet.JSON_PROPERTY_ID, NewPet.JSON_PROPERTY_CATEGORY_INLINE_ALLOF, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java index 20d65250a16d..f3104526e0f4 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java @@ -42,7 +42,7 @@ /** * NewPetCategoryInlineAllof */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NewPetCategoryInlineAllof.JSON_PROPERTY_ID, NewPetCategoryInlineAllof.JSON_PROPERTY_NAME, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java index 8dc723a2c0f2..3278a4b361c8 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java @@ -41,7 +41,7 @@ /** * NewPetCategoryInlineAllofAllOfCategoryTag */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NewPetCategoryInlineAllofAllOfCategoryTag.JSON_PROPERTY_ID, NewPetCategoryInlineAllofAllOfCategoryTag.JSON_PROPERTY_NAME diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableClass.java index 95d86a18c506..e292618d4ab3 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableClass.java @@ -53,7 +53,7 @@ /** * NullableClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NullableClass.JSON_PROPERTY_INTEGER_PROP, NullableClass.JSON_PROPERTY_NUMBER_PROP, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java index 6a064949eeb0..d93c5cb9b2bd 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java @@ -41,7 +41,7 @@ /** * Error response */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NullableFieldsMapError.JSON_PROPERTY_STATUS, NullableFieldsMapError.JSON_PROPERTY_REASON diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java index 8ebd2533c979..fb5d5bd0adf3 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java @@ -57,7 +57,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = NullableFieldsMapResponse.NullableFieldsMapResponseDeserializer.class) @JsonSerialize(using = NullableFieldsMapResponse.NullableFieldsMapResponseSerializer.class) public class NullableFieldsMapResponse extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java index 4058e725b9b8..32241bb7b834 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java @@ -44,7 +44,7 @@ /** * Success response containing a map of objects with nullable fields */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NullableFieldsMapSuccess.JSON_PROPERTY_STATUS, NullableFieldsMapSuccess.JSON_PROPERTY_POSITIONS diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsValue.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsValue.java index ef8499dabe52..78ffc32c303f 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsValue.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableFieldsValue.java @@ -41,7 +41,7 @@ /** * Object with required but nullable string fields */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NullableFieldsValue.JSON_PROPERTY_BEFORE, NullableFieldsValue.JSON_PROPERTY_AFTER diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableShape.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableShape.java index d221210bfb58..a902edf2a74a 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableShape.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NullableShape.java @@ -57,7 +57,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = NullableShape.NullableShapeDeserializer.class) @JsonSerialize(using = NullableShape.NullableShapeSerializer.class) public class NullableShape extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NumberOnly.java index 360fdeb4b9c8..6eaf7762b21c 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -42,7 +42,7 @@ /** * NumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NumberOnly.JSON_PROPERTY_JUST_NUMBER }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java index 2a8d8c3e614e..24ed52ea03e6 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -46,7 +46,7 @@ /** * ObjectWithDeprecatedFields */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ObjectWithDeprecatedFields.JSON_PROPERTY_UUID, ObjectWithDeprecatedFields.JSON_PROPERTY_ID, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Order.java index b61b3be46da7..fcd1a12958b3 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Order.java @@ -42,7 +42,7 @@ /** * Order */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Order.JSON_PROPERTY_ID, Order.JSON_PROPERTY_PET_ID, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterComposite.java index 64950afa2c28..2de7bab30c1b 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -42,7 +42,7 @@ /** * OuterComposite */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ OuterComposite.JSON_PROPERTY_MY_NUMBER, OuterComposite.JSON_PROPERTY_MY_STRING, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ParentPet.java index b93ce4f0a5b5..ed0168fd74b8 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ParentPet.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ParentPet.java @@ -45,7 +45,7 @@ /** * ParentPet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonIgnoreProperties( value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization allowSetters = true // allows the pet_type to be set during deserialization diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pet.java index c71cfe1939fd..4e947c3215af 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pet.java @@ -46,7 +46,7 @@ /** * Pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Pet.JSON_PROPERTY_ID, Pet.JSON_PROPERTY_CATEGORY, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetComposition.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetComposition.java index 206524cd04b2..3a1a606cb0b0 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetComposition.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetComposition.java @@ -46,7 +46,7 @@ /** * PetComposition */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ PetComposition.JSON_PROPERTY_ID, PetComposition.JSON_PROPERTY_CATEGORY, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetRef.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetRef.java index eaadbf8e6228..678354c37987 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetRef.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetRef.java @@ -46,7 +46,7 @@ /** * PetRef */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ PetRef.JSON_PROPERTY_ID, PetRef.JSON_PROPERTY_CATEGORY, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetUsingAllOf.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetUsingAllOf.java index ed49ce21bc2c..382db17f1f96 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetUsingAllOf.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetUsingAllOf.java @@ -46,7 +46,7 @@ /** * PetUsingAllOf */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ PetUsingAllOf.JSON_PROPERTY_ID, PetUsingAllOf.JSON_PROPERTY_CATEGORY, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java index 7bbd3b753da4..9ad2d24b3d40 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java @@ -46,7 +46,7 @@ /** * PetWithRequiredTags */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ PetWithRequiredTags.JSON_PROPERTY_ID, PetWithRequiredTags.JSON_PROPERTY_CATEGORY, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pig.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pig.java index e212d155a028..fc1ac9bebdcf 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pig.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Pig.java @@ -57,7 +57,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Pig.PigDeserializer.class) @JsonSerialize(using = Pig.PigSerializer.class) public class Pig extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PropertyNameCollision.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PropertyNameCollision.java index 88391bfbfc93..62a6eb26f97b 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PropertyNameCollision.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/PropertyNameCollision.java @@ -41,7 +41,7 @@ /** * PropertyNameCollision */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ PropertyNameCollision.JSON_PROPERTY_UNDERSCORE_TYPE, PropertyNameCollision.JSON_PROPERTY_TYPE, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Quadrilateral.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Quadrilateral.java index 4f3bdf229d29..9f47742d97de 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Quadrilateral.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Quadrilateral.java @@ -57,7 +57,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Quadrilateral.QuadrilateralDeserializer.class) @JsonSerialize(using = Quadrilateral.QuadrilateralSerializer.class) public class Quadrilateral extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java index 8f56679c5233..d758a2b54e95 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -41,7 +41,7 @@ /** * QuadrilateralInterface */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ QuadrilateralInterface.JSON_PROPERTY_QUADRILATERAL_TYPE }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 44a818ddcfa1..d7387f190c79 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -41,7 +41,7 @@ /** * ReadOnlyFirst */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ReadOnlyFirst.JSON_PROPERTY_BAR, ReadOnlyFirst.JSON_PROPERTY_BAZ diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/RequiredNullableBody.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/RequiredNullableBody.java index 73cc58231c49..80d6fb4d03e8 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/RequiredNullableBody.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/RequiredNullableBody.java @@ -50,7 +50,7 @@ /** * RequiredNullableBody */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ RequiredNullableBody.JSON_PROPERTY_INTEGER_PROP, RequiredNullableBody.JSON_PROPERTY_NUMBER_PROP, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Scalar.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Scalar.java index 66c48b107722..5c16acb28eb4 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Scalar.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Scalar.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Scalar.ScalarDeserializer.class) @JsonSerialize(using = Scalar.ScalarSerializer.class) public class Scalar extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScalarAnyOf.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScalarAnyOf.java index 4d46bac820b0..a45eda60d420 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScalarAnyOf.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScalarAnyOf.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = ScalarAnyOf.ScalarAnyOfDeserializer.class) @JsonSerialize(using = ScalarAnyOf.ScalarAnyOfSerializer.class) public class ScalarAnyOf extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java index 339e35185b7b..53a62ca1c894 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -41,7 +41,7 @@ /** * ScaleneTriangle */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ScaleneTriangle.JSON_PROPERTY_SHAPE_TYPE, ScaleneTriangle.JSON_PROPERTY_TRIANGLE_TYPE diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Shape.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Shape.java index dcc46c50756c..999198803ab8 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Shape.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Shape.java @@ -57,7 +57,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Shape.ShapeDeserializer.class) @JsonSerialize(using = Shape.ShapeSerializer.class) public class Shape extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeInterface.java index fe0b8c0b7ac9..4d5013a187b8 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeInterface.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -41,7 +41,7 @@ /** * ShapeInterface */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ShapeInterface.JSON_PROPERTY_SHAPE_TYPE }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeOrNull.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeOrNull.java index d80538aff9ea..867feb9fb1c9 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeOrNull.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/ShapeOrNull.java @@ -57,7 +57,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = ShapeOrNull.ShapeOrNullDeserializer.class) @JsonSerialize(using = ShapeOrNull.ShapeOrNullSerializer.class) public class ShapeOrNull extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java index 230c6e2863a4..b4a276dbc8d4 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -41,7 +41,7 @@ /** * SimpleQuadrilateral */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ SimpleQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, SimpleQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SpecialModelName.java index 52bfceee2175..b5bf8a9eca2d 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -41,7 +41,7 @@ /** * SpecialModelName */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME, SpecialModelName.JSON_PROPERTY_SPECIAL_MODEL_NAME diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Tag.java index 1f4d3f731d74..57c5acf2d12e 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Tag.java @@ -41,7 +41,7 @@ /** * Tag */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Tag.JSON_PROPERTY_ID, Tag.JSON_PROPERTY_NAME diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java index 85b52d505172..13b4ff19524b 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -41,7 +41,7 @@ /** * TestInlineFreeformAdditionalPropertiesRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ TestInlineFreeformAdditionalPropertiesRequest.JSON_PROPERTY_SOME_PROPERTY }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Triangle.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Triangle.java index e3803ca6a49e..d3009c5cda8e 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Triangle.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Triangle.java @@ -58,7 +58,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Triangle.TriangleDeserializer.class) @JsonSerialize(using = Triangle.TriangleSerializer.class) public class Triangle extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TriangleInterface.java index 3a17117ea063..85fd0ad31efa 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TriangleInterface.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -41,7 +41,7 @@ /** * TriangleInterface */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ TriangleInterface.JSON_PROPERTY_TRIANGLE_TYPE }) diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/User.java index 0da80f57f7ef..ac0154aa12f3 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/User.java @@ -45,7 +45,7 @@ /** * User */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ User.JSON_PROPERTY_ID, User.JSON_PROPERTY_USERNAME, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Value.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Value.java index 8166990305ae..8ddd5e6c306c 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Value.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Value.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Value.ValueDeserializer.class) @JsonSerialize(using = Value.ValueSerializer.class) public class Value extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Variable.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Variable.java index 00124759755f..f01a03508229 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Variable.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Variable.java @@ -42,7 +42,7 @@ /** * Value object */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Variable.JSON_PROPERTY_NAME, Variable.JSON_PROPERTY_VALUE diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Whale.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Whale.java index 66a49c369e21..bc70983c7581 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Whale.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Whale.java @@ -41,7 +41,7 @@ /** * Whale */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Whale.JSON_PROPERTY_HAS_BALEEN, Whale.JSON_PROPERTY_HAS_TEETH, diff --git a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Zebra.java b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Zebra.java index 46426bb614cc..70db2c0ecd37 100644 --- a/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Zebra.java +++ b/samples/client/petstore/java/okhttp-jackson/src/main/java/org/openapitools/client/model/Zebra.java @@ -41,7 +41,7 @@ /** * Zebra */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Zebra.JSON_PROPERTY_TYPE, Zebra.JSON_PROPERTY_CLASS_NAME diff --git a/samples/client/petstore/java/okhttp-jackson3/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-jackson3/.openapi-generator/FILES index fecfdd629754..5a987dde702f 100644 --- a/samples/client/petstore/java/okhttp-jackson3/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-jackson3/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -281,124 +280,3 @@ src/main/java/org/openapitools/client/model/Value.java src/main/java/org/openapitools/client/model/Variable.java src/main/java/org/openapitools/client/model/Whale.java src/main/java/org/openapitools/client/model/Zebra.java -src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java -src/test/java/org/openapitools/client/api/DefaultApiTest.java -src/test/java/org/openapitools/client/api/FakeApiTest.java -src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java -src/test/java/org/openapitools/client/api/PetApiTest.java -src/test/java/org/openapitools/client/api/StoreApiTest.java -src/test/java/org/openapitools/client/api/UserApiTest.java -src/test/java/org/openapitools/client/api/ValuesApiTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java -src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java -src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java -src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java -src/test/java/org/openapitools/client/model/AnimalTest.java -src/test/java/org/openapitools/client/model/AppleReqTest.java -src/test/java/org/openapitools/client/model/AppleTest.java -src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java -src/test/java/org/openapitools/client/model/ArrayDefaultTest.java -src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java -src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java -src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java -src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java -src/test/java/org/openapitools/client/model/ArrayOneOfTest.java -src/test/java/org/openapitools/client/model/ArrayTestTest.java -src/test/java/org/openapitools/client/model/BananaReqTest.java -src/test/java/org/openapitools/client/model/BananaTest.java -src/test/java/org/openapitools/client/model/BasquePigTest.java -src/test/java/org/openapitools/client/model/CapitalizationTest.java -src/test/java/org/openapitools/client/model/CatTest.java -src/test/java/org/openapitools/client/model/CategoryTest.java -src/test/java/org/openapitools/client/model/ClassModelTest.java -src/test/java/org/openapitools/client/model/ClientTest.java -src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java -src/test/java/org/openapitools/client/model/DanishPigTest.java -src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java -src/test/java/org/openapitools/client/model/DogTest.java -src/test/java/org/openapitools/client/model/DrawingTest.java -src/test/java/org/openapitools/client/model/EnumArraysTest.java -src/test/java/org/openapitools/client/model/EnumClassTest.java -src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java -src/test/java/org/openapitools/client/model/EnumTestTest.java -src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java -src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java -src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java -src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java -src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java -src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java -src/test/java/org/openapitools/client/model/FooTest.java -src/test/java/org/openapitools/client/model/FormatTestTest.java -src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java -src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java -src/test/java/org/openapitools/client/model/FruitReqTest.java -src/test/java/org/openapitools/client/model/FruitTest.java -src/test/java/org/openapitools/client/model/GmFruitTest.java -src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java -src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java -src/test/java/org/openapitools/client/model/HealthCheckResultTest.java -src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java -src/test/java/org/openapitools/client/model/MammalAnyofTest.java -src/test/java/org/openapitools/client/model/MammalTest.java -src/test/java/org/openapitools/client/model/MapTestTest.java -src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java -src/test/java/org/openapitools/client/model/Model200ResponseTest.java -src/test/java/org/openapitools/client/model/ModelApiResponseTest.java -src/test/java/org/openapitools/client/model/ModelFileTest.java -src/test/java/org/openapitools/client/model/ModelListTest.java -src/test/java/org/openapitools/client/model/ModelReturnTest.java -src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java -src/test/java/org/openapitools/client/model/NameTest.java -src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java -src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java -src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java -src/test/java/org/openapitools/client/model/NewPetTest.java -src/test/java/org/openapitools/client/model/NullableClassTest.java -src/test/java/org/openapitools/client/model/NullableEnumTest.java -src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java -src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java -src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java -src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java -src/test/java/org/openapitools/client/model/NullableShapeTest.java -src/test/java/org/openapitools/client/model/NumberOnlyTest.java -src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java -src/test/java/org/openapitools/client/model/OrderTest.java -src/test/java/org/openapitools/client/model/OuterCompositeTest.java -src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java -src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java -src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java -src/test/java/org/openapitools/client/model/OuterEnumTest.java -src/test/java/org/openapitools/client/model/ParentPetTest.java -src/test/java/org/openapitools/client/model/PetCompositionTest.java -src/test/java/org/openapitools/client/model/PetRefTest.java -src/test/java/org/openapitools/client/model/PetTest.java -src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java -src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java -src/test/java/org/openapitools/client/model/PigTest.java -src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java -src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java -src/test/java/org/openapitools/client/model/QuadrilateralTest.java -src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java -src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java -src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java -src/test/java/org/openapitools/client/model/ScalarTest.java -src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java -src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java -src/test/java/org/openapitools/client/model/ShapeOrNullTest.java -src/test/java/org/openapitools/client/model/ShapeTest.java -src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java -src/test/java/org/openapitools/client/model/SpecialModelNameTest.java -src/test/java/org/openapitools/client/model/TagTest.java -src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java -src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java -src/test/java/org/openapitools/client/model/TriangleTest.java -src/test/java/org/openapitools/client/model/UserTest.java -src/test/java/org/openapitools/client/model/ValueTest.java -src/test/java/org/openapitools/client/model/VariableTest.java -src/test/java/org/openapitools/client/model/WhaleTest.java -src/test/java/org/openapitools/client/model/ZebraTest.java diff --git a/samples/client/petstore/java/okhttp-jackson3/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-jackson3/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp-jackson3/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp-jackson3/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-jackson3/README.md b/samples/client/petstore/java/okhttp-jackson3/README.md index 8ddb00a689e3..0558efec0e49 100644 --- a/samples/client/petstore/java/okhttp-jackson3/README.md +++ b/samples/client/petstore/java/okhttp-jackson3/README.md @@ -2,7 +2,7 @@ OpenAPI Petstore - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiException.java index 0c0f52846910..9c908da3a538 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Configuration.java index 79955372fb33..91277dc82ed7 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Pair.java index 505e6f786f4c..2302aff4c8ae 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339DateFormat.java index 5ca15b8b1b9c..88a04734c837 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339DateFormat.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -21,7 +21,7 @@ import java.util.TimeZone; import tools.jackson.databind.util.StdDateFormat; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java index 65590aa32eda..6250a4925e71 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java @@ -28,7 +28,7 @@ import tools.jackson.databind.cfg.DateTimeFeature; import tools.jackson.databind.ext.javatime.deser.InstantDeserializer; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RFC3339InstantDeserializer extends InstantDeserializer { private static final long serialVersionUID = 1L; private final static boolean DEFAULT_NORMALIZE_ZONE_ID = DateTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java index 13cf27ee8bc0..0d7bd814830c 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java @@ -18,7 +18,7 @@ import tools.jackson.databind.module.SimpleModule; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RFC3339JavaTimeModule extends SimpleModule { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerConfiguration.java index 1787a231e76b..66eef5d718f2 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerVariable.java index bc81f54d83a6..d0c4814493ad 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/StringUtil.java index 6473166843d5..647c1e11fabc 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index ed5f5fbc16ef..aa7a99f8b6bc 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/Authentication.java index bd5e463d0b42..5fcf0aad8212 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index f655936f3a78..d7b733e2c91e 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index 5aff174aff81..bd3d7a329545 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuth.java index 6f945f45ed46..427a031ad1e2 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 59009502c11e..8d5408d02164 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -16,7 +16,7 @@ /** * OAuth flows that are supported by this client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public enum OAuthFlow { ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 IMPLICIT, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index 1ec47bee4310..519b0151d737 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -22,7 +22,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 4b9fa640514a..f8fda4161a94 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -46,7 +46,7 @@ /** * AdditionalPropertiesClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AdditionalPropertiesClass.JSON_PROPERTY_MAP_PROPERTY, AdditionalPropertiesClass.JSON_PROPERTY_MAP_OF_MAP_PROPERTY, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java index 389e299d0a88..6e45e01fb7cf 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java @@ -42,7 +42,7 @@ /** * AllOfModelArrayAnyOf */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AllOfModelArrayAnyOf.JSON_PROPERTY_ID, AllOfModelArrayAnyOf.JSON_PROPERTY_NAME, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java index 627ce13f13ce..3b808c6bc450 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java @@ -42,7 +42,7 @@ /** * AllOfModelArrayAnyOfAllOfAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AllOfModelArrayAnyOfAllOfAttributes.JSON_PROPERTY_C }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java index 9b93c4df2c34..962613c94773 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java @@ -61,7 +61,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = AllOfModelArrayAnyOfAllOfAttributesC.AllOfModelArrayAnyOfAllOfAttributesCDeserializer.class) @JsonSerialize(using = AllOfModelArrayAnyOfAllOfAttributesC.AllOfModelArrayAnyOfAllOfAttributesCSerializer.class) public class AllOfModelArrayAnyOfAllOfAttributesC extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java index 817d6ac39847..13d0f7c95316 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java @@ -45,7 +45,7 @@ /** * AllOfModelArrayAnyOfAllOfLinkListColumn1 */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AllOfModelArrayAnyOfAllOfLinkListColumn1.JSON_PROPERTY_VALUE }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java index 33860667f95d..2b636b2d2fac 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java @@ -59,7 +59,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = AllOfModelArrayAnyOfAllOfLinkListColumn1Value.AllOfModelArrayAnyOfAllOfLinkListColumn1ValueDeserializer.class) @JsonSerialize(using = AllOfModelArrayAnyOfAllOfLinkListColumn1Value.AllOfModelArrayAnyOfAllOfLinkListColumn1ValueSerializer.class) public class AllOfModelArrayAnyOfAllOfLinkListColumn1Value extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java index 71b842fbb9bb..ca63aa86478a 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -40,7 +40,7 @@ /** * Object with allOf ref to double */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AllOfRefToDouble.JSON_PROPERTY_HEIGHT }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java index e0a0402f07f3..8988b40a19fd 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -40,7 +40,7 @@ /** * Object with allOf ref to float */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AllOfRefToFloat.JSON_PROPERTY_WEIGHT }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java index 4c7c0ee614c3..e164d30c6e8c 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -40,7 +40,7 @@ /** * Object with allOf ref to long */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AllOfRefToLong.JSON_PROPERTY_ID }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Animal.java index bc96655498ce..6b9b6a743ade 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Animal.java @@ -43,7 +43,7 @@ /** * Animal */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonIgnoreProperties( value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization allowSetters = true // allows the className to be set during deserialization diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Apple.java index 63a133309e83..a83b6f930658 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Apple.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Apple.java @@ -41,7 +41,7 @@ /** * Apple */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Apple.JSON_PROPERTY_CULTIVAR, Apple.JSON_PROPERTY_ORIGIN diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AppleReq.java index a4f68e5be9fe..76ff3cf6509c 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AppleReq.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/AppleReq.java @@ -41,7 +41,7 @@ /** * AppleReq */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ AppleReq.JSON_PROPERTY_CULTIVAR, AppleReq.JSON_PROPERTY_MEALY diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayAnyOf.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayAnyOf.java index d7e5187554de..a113b7564264 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayAnyOf.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayAnyOf.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = ArrayAnyOf.ArrayAnyOfDeserializer.class) @JsonSerialize(using = ArrayAnyOf.ArrayAnyOfSerializer.class) public class ArrayAnyOf extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayDefault.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayDefault.java index cfcaebff5241..5bfe8102f880 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayDefault.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayDefault.java @@ -43,7 +43,7 @@ /** * ArrayDefault */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ArrayDefault.JSON_PROPERTY_WITH_DEFAULT_EMPTY_BRACKET, ArrayDefault.JSON_PROPERTY_WITHOUT_DEFAULT diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 7e21cafd3073..4786cc132567 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -44,7 +44,7 @@ /** * ArrayOfArrayOfNumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java index 84dca923f39a..b37ad72ca6eb 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java @@ -44,7 +44,7 @@ /** * ArrayOfInlineAllOf */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ArrayOfInlineAllOf.JSON_PROPERTY_ID, ArrayOfInlineAllOf.JSON_PROPERTY_NAME, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java index 8b28de960822..cc50b3e6ad73 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java @@ -41,7 +41,7 @@ /** * ArrayOfInlineAllOfArrayAllofDogPropertyInner */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ArrayOfInlineAllOfArrayAllofDogPropertyInner.JSON_PROPERTY_BREED, ArrayOfInlineAllOfArrayAllofDogPropertyInner.JSON_PROPERTY_COLOR diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index c7ce704f955c..c390d574844c 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -44,7 +44,7 @@ /** * ArrayOfNumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOneOf.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOneOf.java index ebe804dd72cd..8e0de39c7a9f 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOneOf.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayOneOf.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = ArrayOneOf.ArrayOneOfDeserializer.class) @JsonSerialize(using = ArrayOneOf.ArrayOneOfSerializer.class) public class ArrayOneOf extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayTest.java index c59c1bcdcb27..51a08c110897 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -44,7 +44,7 @@ /** * ArrayTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Banana.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Banana.java index a8151d252dfe..815a31d7938f 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Banana.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Banana.java @@ -42,7 +42,7 @@ /** * Banana */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Banana.JSON_PROPERTY_LENGTH_CM }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BananaReq.java index f1cc630ef0b0..5c97265fb274 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BananaReq.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BananaReq.java @@ -42,7 +42,7 @@ /** * BananaReq */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ BananaReq.JSON_PROPERTY_LENGTH_CM, BananaReq.JSON_PROPERTY_SWEET diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BasquePig.java index e05a52c5eb4c..9ecff4c241f7 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BasquePig.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/BasquePig.java @@ -40,7 +40,7 @@ /** * BasquePig */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ BasquePig.JSON_PROPERTY_CLASS_NAME }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Capitalization.java index 45a9d2335ed4..9771ee79871d 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Capitalization.java @@ -40,7 +40,7 @@ /** * Capitalization */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Capitalization.JSON_PROPERTY_SMALL_CAMEL, Capitalization.JSON_PROPERTY_CAPITAL_CAMEL, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Cat.java index 980281ce2059..d3958a029166 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Cat.java @@ -45,7 +45,7 @@ /** * Cat */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonIgnoreProperties( value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization allowSetters = true // allows the className to be set during deserialization diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Category.java index e443e5ccb839..7874a719bd9a 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Category.java @@ -40,7 +40,7 @@ /** * Category */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Category.JSON_PROPERTY_ID, Category.JSON_PROPERTY_NAME diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ClassModel.java index 67fae0d33e96..a427e8cc98f5 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ClassModel.java @@ -40,7 +40,7 @@ /** * Model for testing model with \"_class\" property */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ClassModel.JSON_PROPERTY_PROPERTY_CLASS }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Client.java index e22d35659fe9..179e6f18cc8d 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Client.java @@ -40,7 +40,7 @@ /** * Client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Client.JSON_PROPERTY_CLIENT }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java index 471b1f5dbb95..4bb07450905a 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -40,7 +40,7 @@ /** * ComplexQuadrilateral */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ComplexQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, ComplexQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DanishPig.java index 7ae7106cdf6f..2b715471eb55 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DanishPig.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DanishPig.java @@ -40,7 +40,7 @@ /** * DanishPig */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ DanishPig.JSON_PROPERTY_CLASS_NAME }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DeprecatedObject.java index bf3474837eff..b9c40094aba4 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DeprecatedObject.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -42,7 +42,7 @@ * @deprecated */ @Deprecated -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ DeprecatedObject.JSON_PROPERTY_NAME }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Dog.java index 5e210193afc5..3bdd33330362 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Dog.java @@ -44,7 +44,7 @@ /** * Dog */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonIgnoreProperties( value = "className", // ignore manually set className, it will be automatically generated by Jackson during serialization allowSetters = true // allows the className to be set during deserialization diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Drawing.java index 0ebf6bda0c8a..33140a560b35 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Drawing.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Drawing.java @@ -51,7 +51,7 @@ /** * Drawing */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Drawing.JSON_PROPERTY_MAIN_SHAPE, Drawing.JSON_PROPERTY_SHAPE_OR_NULL, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumArrays.java index 2f1c9f431fde..f560c753ab52 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -43,7 +43,7 @@ /** * EnumArrays */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ EnumArrays.JSON_PROPERTY_JUST_SYMBOL, EnumArrays.JSON_PROPERTY_ARRAY_ENUM diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java index 30ce3ab6aa23..a3238c088d98 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java @@ -43,7 +43,7 @@ /** * An object to test discriminator of enum string */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonIgnoreProperties( value = "enum_str_type", // ignore manually set enum_str_type, it will be automatically generated by Jackson during serialization allowSetters = true // allows the enum_str_type to be set during deserialization diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumTest.java index f9ed98626685..90cb9ee604e6 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EnumTest.java @@ -49,7 +49,7 @@ /** * EnumTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ EnumTest.JSON_PROPERTY_ENUM_STRING, EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java index 63fc4bf0f914..a518ec7ea70c 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -40,7 +40,7 @@ /** * EquilateralTriangle */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ EquilateralTriangle.JSON_PROPERTY_SHAPE_TYPE, EquilateralTriangle.JSON_PROPERTY_TRIANGLE_TYPE diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java index bde28b1435d3..0892c539dae2 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java @@ -50,7 +50,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = FakeAnyOfWIthSameErasureGet200Response.FakeAnyOfWIthSameErasureGet200ResponseDeserializer.class) @JsonSerialize(using = FakeAnyOfWIthSameErasureGet200Response.FakeAnyOfWIthSameErasureGet200ResponseSerializer.class) public class FakeAnyOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java index 90b5f1cde9bb..34d75c365624 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java @@ -50,7 +50,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = FakeOneOfWIthSameErasureGet200Response.FakeOneOfWIthSameErasureGet200ResponseDeserializer.class) @JsonSerialize(using = FakeOneOfWIthSameErasureGet200Response.FakeOneOfWIthSameErasureGet200ResponseSerializer.class) public class FakeOneOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java index 43bf1a4c60fb..1069d1644bf8 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java @@ -49,7 +49,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = FakeRefParameterPetIdParameter.FakeRefParameterPetIdParameterDeserializer.class) @JsonSerialize(using = FakeRefParameterPetIdParameter.FakeRefParameterPetIdParameterSerializer.class) public class FakeRefParameterPetIdParameter extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index b54cc56a1bc3..ba7d12060a6c 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -44,7 +44,7 @@ /** * FileSchemaTestClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ FileSchemaTestClass.JSON_PROPERTY_FILE, FileSchemaTestClass.JSON_PROPERTY_FILES diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Foo.java index 48d20549e301..0c0d150d5b77 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Foo.java @@ -40,7 +40,7 @@ /** * Foo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Foo.JSON_PROPERTY_BAR }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java index 117141b28783..2156bbe53381 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -42,7 +42,7 @@ /** * FooGetDefaultResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ FooGetDefaultResponse.JSON_PROPERTY_STRING }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FormatTest.java index e00e4d663914..89f29814fb79 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FormatTest.java @@ -46,7 +46,7 @@ /** * FormatTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ FormatTest.JSON_PROPERTY_INTEGER, FormatTest.JSON_PROPERTY_INT32, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java index 5a3ebe45120f..8fbe9a02b69d 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java @@ -41,7 +41,7 @@ /** * FreeFormObjectTestClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ FreeFormObjectTestClass.JSON_PROPERTY_NAME, FreeFormObjectTestClass.JSON_PROPERTY_PROPERTIES diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java index 343e04eb30e6..adf3b9f63ec6 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java @@ -50,7 +50,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = FreeFormObjectTestClassProperties.FreeFormObjectTestClassPropertiesDeserializer.class) @JsonSerialize(using = FreeFormObjectTestClassProperties.FreeFormObjectTestClassPropertiesSerializer.class) public class FreeFormObjectTestClassProperties extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Fruit.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Fruit.java index a9acf71299e7..64ee2e788f15 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Fruit.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Fruit.java @@ -56,7 +56,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Fruit.FruitDeserializer.class) @JsonSerialize(using = Fruit.FruitSerializer.class) public class Fruit extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FruitReq.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FruitReq.java index 8d1d6eacad2b..c5aba929cba0 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FruitReq.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/FruitReq.java @@ -56,7 +56,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = FruitReq.FruitReqDeserializer.class) @JsonSerialize(using = FruitReq.FruitReqSerializer.class) public class FruitReq extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GmFruit.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GmFruit.java index c4c3a4d0c92d..745990821e62 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GmFruit.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GmFruit.java @@ -56,7 +56,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = GmFruit.GmFruitDeserializer.class) @JsonSerialize(using = GmFruit.GmFruitSerializer.class) public class GmFruit extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java index 6090e464651e..d9439b7098a0 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -43,7 +43,7 @@ /** * GrandparentAnimal */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonIgnoreProperties( value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization allowSetters = true // allows the pet_type to be set during deserialization diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index c49db8e90a3c..443d2c37efc1 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -41,7 +41,7 @@ /** * HasOnlyReadOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ HasOnlyReadOnly.JSON_PROPERTY_BAR, HasOnlyReadOnly.JSON_PROPERTY_FOO diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HealthCheckResult.java index 2e34ff5ca05e..2104f19b501f 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -44,7 +44,7 @@ /** * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ HealthCheckResult.JSON_PROPERTY_NULLABLE_MESSAGE }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java index fa8df0d4e4e8..5aaedcd8a925 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -40,7 +40,7 @@ /** * IsoscelesTriangle */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ IsoscelesTriangle.JSON_PROPERTY_SHAPE_TYPE, IsoscelesTriangle.JSON_PROPERTY_TRIANGLE_TYPE diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Mammal.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Mammal.java index 0a041094ffe3..f6fdfd210d2f 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Mammal.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Mammal.java @@ -59,7 +59,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Mammal.MammalDeserializer.class) @JsonSerialize(using = Mammal.MammalSerializer.class) public class Mammal extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MammalAnyof.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MammalAnyof.java index 09e2a169ce54..44656a0d146c 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MammalAnyof.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MammalAnyof.java @@ -59,7 +59,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = MammalAnyof.MammalAnyofDeserializer.class) @JsonSerialize(using = MammalAnyof.MammalAnyofSerializer.class) public class MammalAnyof extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MapTest.java index 471c71011971..f375c526e206 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MapTest.java @@ -42,7 +42,7 @@ /** * MapTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ MapTest.JSON_PROPERTY_MAP_MAP_OF_STRING, MapTest.JSON_PROPERTY_MAP_OF_ENUM_STRING, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 7ce74f3a9a41..610f4e836618 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -45,7 +45,7 @@ /** * MixedPropertiesAndAdditionalPropertiesClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Model200Response.java index e5d366c952db..09368d5e6618 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Model200Response.java @@ -41,7 +41,7 @@ /** * Model for testing model name starting with number */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Model200Response.JSON_PROPERTY_NAME, Model200Response.JSON_PROPERTY_PROPERTY_CLASS diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 17dd00b0e149..f0ccef5f72fd 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -41,7 +41,7 @@ /** * ModelApiResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ModelApiResponse.JSON_PROPERTY_CODE, ModelApiResponse.JSON_PROPERTY_TYPE, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelFile.java index 203a61b27ee2..c9ac76eb736e 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelFile.java @@ -41,7 +41,7 @@ /** * Must be named `File` for test. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ModelFile.JSON_PROPERTY_SOURCE_U_R_I }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelList.java index 6ce2a025f709..120e15007703 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelList.java @@ -41,7 +41,7 @@ /** * ModelList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ModelList.JSON_PROPERTY_123LIST }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelReturn.java index d088af9105fc..e0f1ddf3cfc9 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -41,7 +41,7 @@ /** * Model for testing reserved words */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ModelReturn.JSON_PROPERTY_RETURN }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java index 11284554eed8..17340696ebf5 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java @@ -42,7 +42,7 @@ /** * ModelWithOneOfAnyOfProperties */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ModelWithOneOfAnyOfProperties.JSON_PROPERTY_ONEOF_PROP, ModelWithOneOfAnyOfProperties.JSON_PROPERTY_ANYOF_PROP diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Name.java index 98fc8c2be4ee..1e3365ac2eb2 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Name.java @@ -40,7 +40,7 @@ /** * Model for testing model name same as property name */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Name.JSON_PROPERTY_NAME, Name.JSON_PROPERTY_SNAKE_CASE, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java index 1a3f326727f8..0c1e3d7becc1 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java @@ -43,7 +43,7 @@ /** * NestedArrayWithDefaultValues */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NestedArrayWithDefaultValues.JSON_PROPERTY_NESTED_ARRAY }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPet.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPet.java index 677b5eb9ee9c..5f3480f3e4bd 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPet.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPet.java @@ -46,7 +46,7 @@ /** * NewPet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NewPet.JSON_PROPERTY_ID, NewPet.JSON_PROPERTY_CATEGORY_INLINE_ALLOF, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java index 20d65250a16d..f3104526e0f4 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java @@ -42,7 +42,7 @@ /** * NewPetCategoryInlineAllof */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NewPetCategoryInlineAllof.JSON_PROPERTY_ID, NewPetCategoryInlineAllof.JSON_PROPERTY_NAME, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java index 8dc723a2c0f2..3278a4b361c8 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java @@ -41,7 +41,7 @@ /** * NewPetCategoryInlineAllofAllOfCategoryTag */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NewPetCategoryInlineAllofAllOfCategoryTag.JSON_PROPERTY_ID, NewPetCategoryInlineAllofAllOfCategoryTag.JSON_PROPERTY_NAME diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java index a054631207dc..f7d346a61501 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableClass.java @@ -52,7 +52,7 @@ /** * NullableClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NullableClass.JSON_PROPERTY_INTEGER_PROP, NullableClass.JSON_PROPERTY_NUMBER_PROP, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java index 543f6e662bc7..a3ea0d55f99a 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java @@ -40,7 +40,7 @@ /** * Error response */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NullableFieldsMapError.JSON_PROPERTY_STATUS, NullableFieldsMapError.JSON_PROPERTY_REASON diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java index b5d8a78ded81..4cdb6b20746a 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java @@ -57,7 +57,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = NullableFieldsMapResponse.NullableFieldsMapResponseDeserializer.class) @JsonSerialize(using = NullableFieldsMapResponse.NullableFieldsMapResponseSerializer.class) public class NullableFieldsMapResponse extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java index b42100d23ed0..8f2c0edcc29b 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java @@ -43,7 +43,7 @@ /** * Success response containing a map of objects with nullable fields */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NullableFieldsMapSuccess.JSON_PROPERTY_STATUS, NullableFieldsMapSuccess.JSON_PROPERTY_POSITIONS diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsValue.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsValue.java index b5773ee48b60..7d520008a8db 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsValue.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableFieldsValue.java @@ -40,7 +40,7 @@ /** * Object with required but nullable string fields */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NullableFieldsValue.JSON_PROPERTY_BEFORE, NullableFieldsValue.JSON_PROPERTY_AFTER diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableShape.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableShape.java index 5d6c76a215d7..f782e4bef65d 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableShape.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NullableShape.java @@ -57,7 +57,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = NullableShape.NullableShapeDeserializer.class) @JsonSerialize(using = NullableShape.NullableShapeSerializer.class) public class NullableShape extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NumberOnly.java index 586e5afbae94..69b80b817027 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -41,7 +41,7 @@ /** * NumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ NumberOnly.JSON_PROPERTY_JUST_NUMBER }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java index 703c21e23c48..643f90b9bf61 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -45,7 +45,7 @@ /** * ObjectWithDeprecatedFields */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ObjectWithDeprecatedFields.JSON_PROPERTY_UUID, ObjectWithDeprecatedFields.JSON_PROPERTY_ID, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Order.java index 1b4d43394d63..091f6eb694d2 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Order.java @@ -41,7 +41,7 @@ /** * Order */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Order.JSON_PROPERTY_ID, Order.JSON_PROPERTY_PET_ID, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterComposite.java index 58b0322b87cc..211ee41a69f7 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -41,7 +41,7 @@ /** * OuterComposite */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ OuterComposite.JSON_PROPERTY_MY_NUMBER, OuterComposite.JSON_PROPERTY_MY_STRING, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ParentPet.java index 6c270e01feef..8a59e1f321f1 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ParentPet.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ParentPet.java @@ -44,7 +44,7 @@ /** * ParentPet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonIgnoreProperties( value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization allowSetters = true // allows the pet_type to be set during deserialization diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pet.java index 80d399a0d3fe..bea07309e480 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pet.java @@ -45,7 +45,7 @@ /** * Pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Pet.JSON_PROPERTY_ID, Pet.JSON_PROPERTY_CATEGORY, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetComposition.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetComposition.java index 1279cbfb87fa..9b4a8119b2a2 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetComposition.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetComposition.java @@ -45,7 +45,7 @@ /** * PetComposition */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ PetComposition.JSON_PROPERTY_ID, PetComposition.JSON_PROPERTY_CATEGORY, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetRef.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetRef.java index 0d3d07fd4bb9..8cc757cdba5d 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetRef.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetRef.java @@ -45,7 +45,7 @@ /** * PetRef */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ PetRef.JSON_PROPERTY_ID, PetRef.JSON_PROPERTY_CATEGORY, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetUsingAllOf.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetUsingAllOf.java index 2109b845074c..522a488d0795 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetUsingAllOf.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetUsingAllOf.java @@ -45,7 +45,7 @@ /** * PetUsingAllOf */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ PetUsingAllOf.JSON_PROPERTY_ID, PetUsingAllOf.JSON_PROPERTY_CATEGORY, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java index d662947eddec..665cff65a7fd 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java @@ -45,7 +45,7 @@ /** * PetWithRequiredTags */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ PetWithRequiredTags.JSON_PROPERTY_ID, PetWithRequiredTags.JSON_PROPERTY_CATEGORY, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pig.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pig.java index 424af469ec66..aca189cefc79 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pig.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Pig.java @@ -57,7 +57,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Pig.PigDeserializer.class) @JsonSerialize(using = Pig.PigSerializer.class) public class Pig extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PropertyNameCollision.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PropertyNameCollision.java index b0432b9716dd..fdc9fb82aa7d 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PropertyNameCollision.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/PropertyNameCollision.java @@ -40,7 +40,7 @@ /** * PropertyNameCollision */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ PropertyNameCollision.JSON_PROPERTY_UNDERSCORE_TYPE, PropertyNameCollision.JSON_PROPERTY_TYPE, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Quadrilateral.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Quadrilateral.java index 4cc7c6318adf..3c551d9c9086 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Quadrilateral.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Quadrilateral.java @@ -57,7 +57,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Quadrilateral.QuadrilateralDeserializer.class) @JsonSerialize(using = Quadrilateral.QuadrilateralSerializer.class) public class Quadrilateral extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java index 608e60c73525..cff48a253651 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -40,7 +40,7 @@ /** * QuadrilateralInterface */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ QuadrilateralInterface.JSON_PROPERTY_QUADRILATERAL_TYPE }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index cf9751878072..163a5ddcabe5 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -40,7 +40,7 @@ /** * ReadOnlyFirst */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ReadOnlyFirst.JSON_PROPERTY_BAR, ReadOnlyFirst.JSON_PROPERTY_BAZ diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/RequiredNullableBody.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/RequiredNullableBody.java index 893a88a35047..18803202a7b0 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/RequiredNullableBody.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/RequiredNullableBody.java @@ -49,7 +49,7 @@ /** * RequiredNullableBody */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ RequiredNullableBody.JSON_PROPERTY_INTEGER_PROP, RequiredNullableBody.JSON_PROPERTY_NUMBER_PROP, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Scalar.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Scalar.java index de04a61dad37..1f4c4d4d04dc 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Scalar.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Scalar.java @@ -50,7 +50,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Scalar.ScalarDeserializer.class) @JsonSerialize(using = Scalar.ScalarSerializer.class) public class Scalar extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScalarAnyOf.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScalarAnyOf.java index 6edae4af3417..0a067582e6c4 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScalarAnyOf.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScalarAnyOf.java @@ -50,7 +50,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = ScalarAnyOf.ScalarAnyOfDeserializer.class) @JsonSerialize(using = ScalarAnyOf.ScalarAnyOfSerializer.class) public class ScalarAnyOf extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java index 08c3cc3d58ed..ea54ed78a900 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -40,7 +40,7 @@ /** * ScaleneTriangle */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ScaleneTriangle.JSON_PROPERTY_SHAPE_TYPE, ScaleneTriangle.JSON_PROPERTY_TRIANGLE_TYPE diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Shape.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Shape.java index 31f573929840..77ed6886cb56 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Shape.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Shape.java @@ -57,7 +57,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Shape.ShapeDeserializer.class) @JsonSerialize(using = Shape.ShapeSerializer.class) public class Shape extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeInterface.java index 12671e3e37cc..99f4d94220b4 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeInterface.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -40,7 +40,7 @@ /** * ShapeInterface */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ ShapeInterface.JSON_PROPERTY_SHAPE_TYPE }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeOrNull.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeOrNull.java index d1521a0f102e..ec04edfc9702 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeOrNull.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/ShapeOrNull.java @@ -57,7 +57,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = ShapeOrNull.ShapeOrNullDeserializer.class) @JsonSerialize(using = ShapeOrNull.ShapeOrNullSerializer.class) public class ShapeOrNull extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java index c798b2e49a6f..4fc590019a0a 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -40,7 +40,7 @@ /** * SimpleQuadrilateral */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ SimpleQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, SimpleQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SpecialModelName.java index 52bfceee2175..b5bf8a9eca2d 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -41,7 +41,7 @@ /** * SpecialModelName */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME, SpecialModelName.JSON_PROPERTY_SPECIAL_MODEL_NAME diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Tag.java index b93a61a4970e..b19bfba58024 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Tag.java @@ -40,7 +40,7 @@ /** * Tag */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Tag.JSON_PROPERTY_ID, Tag.JSON_PROPERTY_NAME diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java index 85b52d505172..13b4ff19524b 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -41,7 +41,7 @@ /** * TestInlineFreeformAdditionalPropertiesRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ TestInlineFreeformAdditionalPropertiesRequest.JSON_PROPERTY_SOME_PROPERTY }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Triangle.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Triangle.java index e3d271244b7b..319e8dc1552d 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Triangle.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Triangle.java @@ -58,7 +58,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Triangle.TriangleDeserializer.class) @JsonSerialize(using = Triangle.TriangleSerializer.class) public class Triangle extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TriangleInterface.java index 6c38cb508ddd..1627ffd31450 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TriangleInterface.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -40,7 +40,7 @@ /** * TriangleInterface */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ TriangleInterface.JSON_PROPERTY_TRIANGLE_TYPE }) diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/User.java index 9f25b199834b..3c8369c93f73 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/User.java @@ -44,7 +44,7 @@ /** * User */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ User.JSON_PROPERTY_ID, User.JSON_PROPERTY_USERNAME, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Value.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Value.java index 1c1a14aa2f68..e477d7b1dbbe 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Value.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Value.java @@ -50,7 +50,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonDeserialize(using = Value.ValueDeserializer.class) @JsonSerialize(using = Value.ValueSerializer.class) public class Value extends AbstractOpenApiSchema { diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Variable.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Variable.java index c13c70e5d3b5..c35b0e945c27 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Variable.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Variable.java @@ -41,7 +41,7 @@ /** * Value object */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Variable.JSON_PROPERTY_NAME, Variable.JSON_PROPERTY_VALUE diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Whale.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Whale.java index 66a49c369e21..bc70983c7581 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Whale.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Whale.java @@ -41,7 +41,7 @@ /** * Whale */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Whale.JSON_PROPERTY_HAS_BALEEN, Whale.JSON_PROPERTY_HAS_TEETH, diff --git a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Zebra.java b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Zebra.java index 46426bb614cc..70db2c0ecd37 100644 --- a/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Zebra.java +++ b/samples/client/petstore/java/okhttp-jackson3/src/main/java/org/openapitools/client/model/Zebra.java @@ -41,7 +41,7 @@ /** * Zebra */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") @JsonPropertyOrder({ Zebra.JSON_PROPERTY_TYPE, Zebra.JSON_PROPERTY_CLASS_NAME diff --git a/samples/client/petstore/java/okhttp-jsonb/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-jsonb/.openapi-generator/FILES index b42e6848a138..6d284356ea3d 100644 --- a/samples/client/petstore/java/okhttp-jsonb/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-jsonb/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -278,124 +277,3 @@ src/main/java/org/openapitools/client/model/Value.java src/main/java/org/openapitools/client/model/Variable.java src/main/java/org/openapitools/client/model/Whale.java src/main/java/org/openapitools/client/model/Zebra.java -src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java -src/test/java/org/openapitools/client/api/DefaultApiTest.java -src/test/java/org/openapitools/client/api/FakeApiTest.java -src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java -src/test/java/org/openapitools/client/api/PetApiTest.java -src/test/java/org/openapitools/client/api/StoreApiTest.java -src/test/java/org/openapitools/client/api/UserApiTest.java -src/test/java/org/openapitools/client/api/ValuesApiTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java -src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java -src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java -src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java -src/test/java/org/openapitools/client/model/AnimalTest.java -src/test/java/org/openapitools/client/model/AppleReqTest.java -src/test/java/org/openapitools/client/model/AppleTest.java -src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java -src/test/java/org/openapitools/client/model/ArrayDefaultTest.java -src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java -src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java -src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java -src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java -src/test/java/org/openapitools/client/model/ArrayOneOfTest.java -src/test/java/org/openapitools/client/model/ArrayTestTest.java -src/test/java/org/openapitools/client/model/BananaReqTest.java -src/test/java/org/openapitools/client/model/BananaTest.java -src/test/java/org/openapitools/client/model/BasquePigTest.java -src/test/java/org/openapitools/client/model/CapitalizationTest.java -src/test/java/org/openapitools/client/model/CatTest.java -src/test/java/org/openapitools/client/model/CategoryTest.java -src/test/java/org/openapitools/client/model/ClassModelTest.java -src/test/java/org/openapitools/client/model/ClientTest.java -src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java -src/test/java/org/openapitools/client/model/DanishPigTest.java -src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java -src/test/java/org/openapitools/client/model/DogTest.java -src/test/java/org/openapitools/client/model/DrawingTest.java -src/test/java/org/openapitools/client/model/EnumArraysTest.java -src/test/java/org/openapitools/client/model/EnumClassTest.java -src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java -src/test/java/org/openapitools/client/model/EnumTestTest.java -src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java -src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java -src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java -src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java -src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java -src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java -src/test/java/org/openapitools/client/model/FooTest.java -src/test/java/org/openapitools/client/model/FormatTestTest.java -src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java -src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java -src/test/java/org/openapitools/client/model/FruitReqTest.java -src/test/java/org/openapitools/client/model/FruitTest.java -src/test/java/org/openapitools/client/model/GmFruitTest.java -src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java -src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java -src/test/java/org/openapitools/client/model/HealthCheckResultTest.java -src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java -src/test/java/org/openapitools/client/model/MammalAnyofTest.java -src/test/java/org/openapitools/client/model/MammalTest.java -src/test/java/org/openapitools/client/model/MapTestTest.java -src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java -src/test/java/org/openapitools/client/model/Model200ResponseTest.java -src/test/java/org/openapitools/client/model/ModelApiResponseTest.java -src/test/java/org/openapitools/client/model/ModelFileTest.java -src/test/java/org/openapitools/client/model/ModelListTest.java -src/test/java/org/openapitools/client/model/ModelReturnTest.java -src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java -src/test/java/org/openapitools/client/model/NameTest.java -src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java -src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java -src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java -src/test/java/org/openapitools/client/model/NewPetTest.java -src/test/java/org/openapitools/client/model/NullableClassTest.java -src/test/java/org/openapitools/client/model/NullableEnumTest.java -src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java -src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java -src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java -src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java -src/test/java/org/openapitools/client/model/NullableShapeTest.java -src/test/java/org/openapitools/client/model/NumberOnlyTest.java -src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java -src/test/java/org/openapitools/client/model/OrderTest.java -src/test/java/org/openapitools/client/model/OuterCompositeTest.java -src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java -src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java -src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java -src/test/java/org/openapitools/client/model/OuterEnumTest.java -src/test/java/org/openapitools/client/model/ParentPetTest.java -src/test/java/org/openapitools/client/model/PetCompositionTest.java -src/test/java/org/openapitools/client/model/PetRefTest.java -src/test/java/org/openapitools/client/model/PetTest.java -src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java -src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java -src/test/java/org/openapitools/client/model/PigTest.java -src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java -src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java -src/test/java/org/openapitools/client/model/QuadrilateralTest.java -src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java -src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java -src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java -src/test/java/org/openapitools/client/model/ScalarTest.java -src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java -src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java -src/test/java/org/openapitools/client/model/ShapeOrNullTest.java -src/test/java/org/openapitools/client/model/ShapeTest.java -src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java -src/test/java/org/openapitools/client/model/SpecialModelNameTest.java -src/test/java/org/openapitools/client/model/TagTest.java -src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java -src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java -src/test/java/org/openapitools/client/model/TriangleTest.java -src/test/java/org/openapitools/client/model/UserTest.java -src/test/java/org/openapitools/client/model/ValueTest.java -src/test/java/org/openapitools/client/model/VariableTest.java -src/test/java/org/openapitools/client/model/WhaleTest.java -src/test/java/org/openapitools/client/model/ZebraTest.java diff --git a/samples/client/petstore/java/okhttp-jsonb/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-jsonb/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp-jsonb/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp-jsonb/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-jsonb/README.md b/samples/client/petstore/java/okhttp-jsonb/README.md index faa11e4781f9..258c3cf029aa 100644 --- a/samples/client/petstore/java/okhttp-jsonb/README.md +++ b/samples/client/petstore/java/okhttp-jsonb/README.md @@ -2,7 +2,7 @@ OpenAPI Petstore - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiException.java index 2068c528745f..fcbae4c64fd5 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Configuration.java index 668203bd35fc..85c7d9bfdc39 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Pair.java index 31957380cc4e..0f8c237a9222 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerConfiguration.java index d779bc444980..3f8b5d69d236 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerVariable.java index ff4eab3cc4d3..cdb33ff2d286 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/StringUtil.java index c0fd50b06b44..a6fa58f27aba 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 677f8b441fe6..46949d5ec4db 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/Authentication.java index 19583eb3062a..529782c0821e 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index cb5aab7cb017..b790dfbc5622 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index 42d103390f85..8c2a63f80c64 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuth.java index f78703725750..1100485169d7 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 57aab92c1470..9fe44e9385b9 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -16,7 +16,7 @@ /** * OAuth flows that are supported by this client */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public enum OAuthFlow { ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 IMPLICIT, diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index 2a13fa371613..817d02137a08 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index be1a17800fdd..8f9c7925c549 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -35,7 +35,7 @@ /** * AdditionalPropertiesClass */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesClass { public static final String SERIALIZED_NAME_MAP_PROPERTY = "map_property"; @JsonbProperty(SERIALIZED_NAME_MAP_PROPERTY) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java index 1c5758167bdf..cf0cf6379a13 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java @@ -34,7 +34,7 @@ /** * AllOfModelArrayAnyOf */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfModelArrayAnyOf { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java index 60f4d88d551f..f4904ab8f8b7 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java @@ -33,7 +33,7 @@ /** * AllOfModelArrayAnyOfAllOfAttributes */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfModelArrayAnyOfAllOfAttributes { public static final String SERIALIZED_NAME_C = "C"; @JsonbProperty(SERIALIZED_NAME_C) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java index e558c63e878c..30e01f758ecb 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java @@ -41,7 +41,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfModelArrayAnyOfAllOfAttributesC extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(AllOfModelArrayAnyOfAllOfAttributesC.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java index 7b82430c15bf..1d2f0dd084fb 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java @@ -36,7 +36,7 @@ /** * AllOfModelArrayAnyOfAllOfLinkListColumn1 */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfModelArrayAnyOfAllOfLinkListColumn1 { public static final String SERIALIZED_NAME_VALUE = "value"; @JsonbProperty(SERIALIZED_NAME_VALUE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java index 6917369d845c..c65d376b9193 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java @@ -36,7 +36,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfModelArrayAnyOfAllOfLinkListColumn1Value extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(AllOfModelArrayAnyOfAllOfLinkListColumn1Value.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java index 77134321de47..8859edab93c9 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -32,7 +32,7 @@ /** * Object with allOf ref to double */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfRefToDouble { public static final String SERIALIZED_NAME_HEIGHT = "height"; @JsonbProperty(SERIALIZED_NAME_HEIGHT) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java index d78a50016232..015d60791799 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -32,7 +32,7 @@ /** * Object with allOf ref to float */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfRefToFloat { public static final String SERIALIZED_NAME_WEIGHT = "weight"; @JsonbProperty(SERIALIZED_NAME_WEIGHT) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToLong.java index 18b6fa0fc13b..48f8e731816c 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToLong.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -32,7 +32,7 @@ /** * Object with allOf ref to long */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfRefToLong { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Animal.java index f91847826f44..3b01c55fdc24 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Animal.java @@ -32,7 +32,7 @@ /** * Animal */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @JsonbProperty(SERIALIZED_NAME_CLASS_NAME) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Apple.java index 8587480b7f25..7a2700d71a93 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Apple.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Apple.java @@ -32,7 +32,7 @@ /** * Apple */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Apple { public static final String SERIALIZED_NAME_CULTIVAR = "cultivar"; @JsonbProperty(SERIALIZED_NAME_CULTIVAR) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AppleReq.java index b77fec341867..e638241fb8b5 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AppleReq.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/AppleReq.java @@ -32,7 +32,7 @@ /** * AppleReq */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AppleReq { public static final String SERIALIZED_NAME_CULTIVAR = "cultivar"; @JsonbProperty(SERIALIZED_NAME_CULTIVAR) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayAnyOf.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayAnyOf.java index c938b507089a..03c84310c400 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayAnyOf.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayAnyOf.java @@ -34,7 +34,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayAnyOf extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(ArrayAnyOf.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayDefault.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayDefault.java index 463174cea6ac..bd6a510ce19f 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayDefault.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayDefault.java @@ -35,7 +35,7 @@ /** * ArrayDefault */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayDefault { public static final String SERIALIZED_NAME_WITH_DEFAULT_EMPTY_BRACKET = "WithDefaultEmptyBracket"; @JsonbProperty(SERIALIZED_NAME_WITH_DEFAULT_EMPTY_BRACKET) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 8c04cd3c0939..c16a2fba48d2 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -36,7 +36,7 @@ /** * ArrayOfArrayOfNumberOnly */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOfArrayOfNumberOnly { public static final String SERIALIZED_NAME_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; @JsonbProperty(SERIALIZED_NAME_ARRAY_ARRAY_NUMBER) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java index a10141679626..0d0cf6b35a92 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java @@ -36,7 +36,7 @@ /** * ArrayOfInlineAllOf */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOfInlineAllOf { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java index b35b88a6c3c3..777244e68323 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java @@ -32,7 +32,7 @@ /** * ArrayOfInlineAllOfArrayAllofDogPropertyInner */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOfInlineAllOfArrayAllofDogPropertyInner { public static final String SERIALIZED_NAME_BREED = "breed"; @JsonbProperty(SERIALIZED_NAME_BREED) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 7faaa3feacd1..019ef053981b 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -36,7 +36,7 @@ /** * ArrayOfNumberOnly */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOfNumberOnly { public static final String SERIALIZED_NAME_ARRAY_NUMBER = "ArrayNumber"; @JsonbProperty(SERIALIZED_NAME_ARRAY_NUMBER) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOneOf.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOneOf.java index 6dd46938a0e8..bcd23a743176 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOneOf.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayOneOf.java @@ -34,7 +34,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOneOf extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(ArrayOneOf.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayTest.java index b902d7b08f17..bef3729d436b 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -36,7 +36,7 @@ /** * ArrayTest */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayTest { public static final String SERIALIZED_NAME_ARRAY_OF_STRING = "array_of_string"; @JsonbProperty(SERIALIZED_NAME_ARRAY_OF_STRING) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Banana.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Banana.java index 2356396531d6..fd8bf94c20a5 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Banana.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Banana.java @@ -33,7 +33,7 @@ /** * Banana */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Banana { public static final String SERIALIZED_NAME_LENGTH_CM = "lengthCm"; @JsonbProperty(SERIALIZED_NAME_LENGTH_CM) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BananaReq.java index 7003cecf1e9e..b77440143986 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BananaReq.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BananaReq.java @@ -33,7 +33,7 @@ /** * BananaReq */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class BananaReq { public static final String SERIALIZED_NAME_LENGTH_CM = "lengthCm"; @JsonbProperty(SERIALIZED_NAME_LENGTH_CM) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BasquePig.java index 62c0d7f0191c..79157df45a6d 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BasquePig.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/BasquePig.java @@ -32,7 +32,7 @@ /** * BasquePig */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class BasquePig { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @JsonbProperty(SERIALIZED_NAME_CLASS_NAME) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Capitalization.java index 5c97ebcce378..31f5d3b75261 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Capitalization.java @@ -32,7 +32,7 @@ /** * Capitalization */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Capitalization { public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; @JsonbProperty(SERIALIZED_NAME_SMALL_CAMEL) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Cat.java index 32b201ee9ac1..1d791c31d772 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Cat.java @@ -34,7 +34,7 @@ /** * Cat */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Cat extends Animal { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @JsonbProperty(SERIALIZED_NAME_DECLAWED) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Category.java index af65ab6b13a7..7eb361493748 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Category.java @@ -32,7 +32,7 @@ /** * Category */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Category { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ClassModel.java index 5096f22a6671..8c92e1d9b600 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ClassModel.java @@ -32,7 +32,7 @@ /** * Model for testing model with \"_class\" property */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ClassModel { public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; @JsonbProperty(SERIALIZED_NAME_PROPERTY_CLASS) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Client.java index 0524d88fa2cb..49bf684ea2e0 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Client.java @@ -32,7 +32,7 @@ /** * Client */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Client { public static final String SERIALIZED_NAME_CLIENT = "client"; @JsonbProperty(SERIALIZED_NAME_CLIENT) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java index 5d8b21e920cb..998faa2b1d0b 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -32,7 +32,7 @@ /** * ComplexQuadrilateral */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ComplexQuadrilateral { public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; @JsonbProperty(SERIALIZED_NAME_SHAPE_TYPE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DanishPig.java index 6044c3a5fe6c..9ce757564c7a 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DanishPig.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DanishPig.java @@ -32,7 +32,7 @@ /** * DanishPig */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class DanishPig { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @JsonbProperty(SERIALIZED_NAME_CLASS_NAME) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DeprecatedObject.java index 246eb446209e..ce3bd0eeb768 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DeprecatedObject.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -34,7 +34,7 @@ * @deprecated */ @Deprecated -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class DeprecatedObject { public static final String SERIALIZED_NAME_NAME = "name"; @JsonbProperty(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Dog.java index 0ef71c6ef893..ead091200692 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Dog.java @@ -33,7 +33,7 @@ /** * Dog */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Dog extends Animal { public static final String SERIALIZED_NAME_BREED = "breed"; @JsonbProperty(SERIALIZED_NAME_BREED) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Drawing.java index ea7803af610c..f6bfc45660cf 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Drawing.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Drawing.java @@ -40,7 +40,7 @@ /** * Drawing */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Drawing { public static final String SERIALIZED_NAME_MAIN_SHAPE = "mainShape"; @JsonbProperty(SERIALIZED_NAME_MAIN_SHAPE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumArrays.java index de69f9b63071..0afd4c6a5daf 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -35,7 +35,7 @@ /** * EnumArrays */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class EnumArrays { /** * Gets or Sets justSymbol diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java index eb8cd95cb598..53dd2c7c1d39 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java @@ -32,7 +32,7 @@ /** * An object to test discriminator of enum string */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class EnumStringDiscriminator { /** * enum string type diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumTest.java index 07e49bfb31db..e2534e1722d8 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EnumTest.java @@ -37,7 +37,7 @@ /** * EnumTest */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class EnumTest { /** * Gets or Sets enumString diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EquilateralTriangle.java index 53912da31e65..9748734b75b6 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EquilateralTriangle.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -32,7 +32,7 @@ /** * EquilateralTriangle */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class EquilateralTriangle { public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; @JsonbProperty(SERIALIZED_NAME_SHAPE_TYPE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java index 254922c87997..e2058a72c631 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java @@ -34,7 +34,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FakeAnyOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(FakeAnyOfWIthSameErasureGet200Response.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java index 17924e97f033..2f3cf8d29b5e 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java @@ -34,7 +34,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FakeOneOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(FakeOneOfWIthSameErasureGet200Response.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java index a853b333b387..ebba6cb0958a 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java @@ -33,7 +33,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FakeRefParameterPetIdParameter extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(FakeRefParameterPetIdParameter.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index bcebae670b3b..169af8251ee3 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -36,7 +36,7 @@ /** * FileSchemaTestClass */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FileSchemaTestClass { public static final String SERIALIZED_NAME_FILE = "file"; @JsonbProperty(SERIALIZED_NAME_FILE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Foo.java index 9f3d0e837080..3c1131a33d95 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Foo.java @@ -32,7 +32,7 @@ /** * Foo */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Foo { public static final String SERIALIZED_NAME_BAR = "bar"; @JsonbProperty(SERIALIZED_NAME_BAR) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java index 10cb8983e320..83bc07d10396 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -33,7 +33,7 @@ /** * FooGetDefaultResponse */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FooGetDefaultResponse { public static final String SERIALIZED_NAME_STRING = "string"; @JsonbProperty(SERIALIZED_NAME_STRING) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FormatTest.java index 3349ba34916a..70e5e953da76 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FormatTest.java @@ -37,7 +37,7 @@ /** * FormatTest */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FormatTest { public static final String SERIALIZED_NAME_INTEGER = "integer"; @JsonbProperty(SERIALIZED_NAME_INTEGER) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java index 20a9aa9a51eb..1fa131f4eb12 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java @@ -33,7 +33,7 @@ /** * FreeFormObjectTestClass */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FreeFormObjectTestClass { public static final String SERIALIZED_NAME_NAME = "name"; @JsonbProperty(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java index 25ae55b9bc45..906e304c7796 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java @@ -34,7 +34,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FreeFormObjectTestClassProperties extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(FreeFormObjectTestClassProperties.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Fruit.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Fruit.java index 15d4f4e0991e..9a312a568f7a 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Fruit.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Fruit.java @@ -36,7 +36,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Fruit extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Fruit.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FruitReq.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FruitReq.java index 0248f08bbff7..4be29f9864de 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FruitReq.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/FruitReq.java @@ -36,7 +36,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FruitReq extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(FruitReq.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GmFruit.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GmFruit.java index e08eaf7e907f..296050ae6c78 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GmFruit.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GmFruit.java @@ -36,7 +36,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class GmFruit extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(GmFruit.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GrandparentAnimal.java index efeb132c73d8..25bbd90f42df 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GrandparentAnimal.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -32,7 +32,7 @@ /** * GrandparentAnimal */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class GrandparentAnimal { public static final String SERIALIZED_NAME_PET_TYPE = "pet_type"; @JsonbProperty(SERIALIZED_NAME_PET_TYPE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 79159dd8c199..305040d01d97 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -32,7 +32,7 @@ /** * HasOnlyReadOnly */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HasOnlyReadOnly { public static final String SERIALIZED_NAME_BAR = "bar"; @JsonbProperty(SERIALIZED_NAME_BAR) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HealthCheckResult.java index e58501f7b0ca..07e5c28a80b5 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -33,7 +33,7 @@ /** * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HealthCheckResult { public static final String SERIALIZED_NAME_NULLABLE_MESSAGE = "NullableMessage"; @JsonbProperty(SERIALIZED_NAME_NULLABLE_MESSAGE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java index e3f484ae64b0..9b67eeab0350 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -32,7 +32,7 @@ /** * IsoscelesTriangle */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class IsoscelesTriangle { public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; @JsonbProperty(SERIALIZED_NAME_SHAPE_TYPE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Mammal.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Mammal.java index 35e754488152..6c673ed4ddbc 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Mammal.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Mammal.java @@ -36,7 +36,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Mammal extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Mammal.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MammalAnyof.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MammalAnyof.java index 9bc9e18491a2..68c1a30c9554 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MammalAnyof.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MammalAnyof.java @@ -36,7 +36,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class MammalAnyof extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(MammalAnyof.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MapTest.java index 5b7a3f568519..392a98c7d9df 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MapTest.java @@ -34,7 +34,7 @@ /** * MapTest */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class MapTest { public static final String SERIALIZED_NAME_MAP_MAP_OF_STRING = "map_map_of_string"; @JsonbProperty(SERIALIZED_NAME_MAP_MAP_OF_STRING) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 916f8228bb42..3ca43bf3af0c 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -37,7 +37,7 @@ /** * MixedPropertiesAndAdditionalPropertiesClass */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class MixedPropertiesAndAdditionalPropertiesClass { public static final String SERIALIZED_NAME_UUID = "uuid"; @JsonbProperty(SERIALIZED_NAME_UUID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Model200Response.java index 708283508f22..c6d0bd626ae7 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Model200Response.java @@ -32,7 +32,7 @@ /** * Model for testing model name starting with number */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Model200Response { public static final String SERIALIZED_NAME_NAME = "name"; @JsonbProperty(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelApiResponse.java index b13c075fb0a1..63be980e765d 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -32,7 +32,7 @@ /** * ModelApiResponse */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @JsonbProperty(SERIALIZED_NAME_CODE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelFile.java index 3954a46adcb2..f7642eec6c5c 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelFile.java @@ -32,7 +32,7 @@ /** * Must be named `File` for test. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelFile { public static final String SERIALIZED_NAME_SOURCE_U_R_I = "sourceURI"; @JsonbProperty(SERIALIZED_NAME_SOURCE_U_R_I) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelList.java index 109909b69108..4d72669a552d 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelList.java @@ -32,7 +32,7 @@ /** * ModelList */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelList { public static final String SERIALIZED_NAME_123LIST = "123-list"; @JsonbProperty(SERIALIZED_NAME_123LIST) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelReturn.java index 03b374333add..47556bb1d8b5 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -32,7 +32,7 @@ /** * Model for testing reserved words */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelReturn { public static final String SERIALIZED_NAME_RETURN = "return"; @JsonbProperty(SERIALIZED_NAME_RETURN) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java index 276c8bed82fa..14e606617519 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java @@ -34,7 +34,7 @@ /** * ModelWithOneOfAnyOfProperties */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelWithOneOfAnyOfProperties { public static final String SERIALIZED_NAME_ONEOF_PROP = "oneof_prop"; @JsonbProperty(SERIALIZED_NAME_ONEOF_PROP) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Name.java index 8924f0a9605e..cb82ba2fb4d6 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Name.java @@ -32,7 +32,7 @@ /** * Model for testing model name same as property name */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Name { public static final String SERIALIZED_NAME_NAME = "name"; @JsonbProperty(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java index 5afb590614f2..9b6dc1d7e61e 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java @@ -35,7 +35,7 @@ /** * NestedArrayWithDefaultValues */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NestedArrayWithDefaultValues { public static final String SERIALIZED_NAME_NESTED_ARRAY = "nestedArray"; @JsonbProperty(SERIALIZED_NAME_NESTED_ARRAY) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPet.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPet.java index 3d2d331f10fa..4a275d9b752b 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPet.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPet.java @@ -38,7 +38,7 @@ /** * NewPet */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NewPet { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java index f69e39e1e057..989d243d1489 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java @@ -33,7 +33,7 @@ /** * NewPetCategoryInlineAllof */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NewPetCategoryInlineAllof { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java index ee0151338600..9dabf452cb4c 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java @@ -32,7 +32,7 @@ /** * NewPetCategoryInlineAllofAllOfCategoryTag */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NewPetCategoryInlineAllofAllOfCategoryTag { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableClass.java index 39e84cb4260e..b3ebee7a2efe 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableClass.java @@ -41,7 +41,7 @@ /** * NullableClass */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NullableClass { public static final String SERIALIZED_NAME_INTEGER_PROP = "integer_prop"; @JsonbProperty(SERIALIZED_NAME_INTEGER_PROP) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java index 2bac4c25bd3c..1d7954cf3bc1 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java @@ -32,7 +32,7 @@ /** * Error response */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NullableFieldsMapError { public static final String SERIALIZED_NAME_STATUS = "status"; @JsonbProperty(SERIALIZED_NAME_STATUS) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java index c56bb4744028..3d2a1ea91ff3 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java @@ -38,7 +38,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NullableFieldsMapResponse extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(NullableFieldsMapResponse.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java index 4b3e8f98e0d7..e233ba1162bd 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java @@ -35,7 +35,7 @@ /** * Success response containing a map of objects with nullable fields */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NullableFieldsMapSuccess { public static final String SERIALIZED_NAME_STATUS = "status"; @JsonbProperty(SERIALIZED_NAME_STATUS) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsValue.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsValue.java index 2886d1dc0d1f..87c5fca9a3a7 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsValue.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableFieldsValue.java @@ -32,7 +32,7 @@ /** * Object with required but nullable string fields */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NullableFieldsValue { public static final String SERIALIZED_NAME_BEFORE = "before"; @JsonbProperty(SERIALIZED_NAME_BEFORE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableShape.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableShape.java index b130ec456d68..310b4b9c128b 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableShape.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NullableShape.java @@ -35,7 +35,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NullableShape extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(NullableShape.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NumberOnly.java index 9f16b31a6c41..7f6b9a7cc8bb 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -33,7 +33,7 @@ /** * NumberOnly */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NumberOnly { public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; @JsonbProperty(SERIALIZED_NAME_JUST_NUMBER) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java index dc10af7fc79a..f0e25f3af50e 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -37,7 +37,7 @@ /** * ObjectWithDeprecatedFields */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ObjectWithDeprecatedFields { public static final String SERIALIZED_NAME_UUID = "uuid"; @JsonbProperty(SERIALIZED_NAME_UUID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Order.java index 91f8a24c7762..aed666bce7e1 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Order.java @@ -33,7 +33,7 @@ /** * Order */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Order { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterComposite.java index 523a87349bb4..93860ab0b46e 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -33,7 +33,7 @@ /** * OuterComposite */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OuterComposite { public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; @JsonbProperty(SERIALIZED_NAME_MY_NUMBER) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ParentPet.java index 4f5058b9ed09..8b2b06abf47c 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ParentPet.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ParentPet.java @@ -33,7 +33,7 @@ /** * ParentPet */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ParentPet extends GrandparentAnimal { public ParentPet() { this.petType = this.getClass().getSimpleName(); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pet.java index 05a917ec15b7..c1a8ccb61d20 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pet.java @@ -37,7 +37,7 @@ /** * Pet */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetComposition.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetComposition.java index 30a1a5330e03..7cdfd77cf48d 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetComposition.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetComposition.java @@ -37,7 +37,7 @@ /** * PetComposition */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class PetComposition { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetRef.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetRef.java index 4b27e0514af1..cd30bc688ab3 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetRef.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetRef.java @@ -37,7 +37,7 @@ /** * PetRef */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class PetRef { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetUsingAllOf.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetUsingAllOf.java index eb158771a79f..a60c6b1a7924 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetUsingAllOf.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetUsingAllOf.java @@ -37,7 +37,7 @@ /** * PetUsingAllOf */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class PetUsingAllOf { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java index 3d3f6e544c57..d85651ef2408 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java @@ -37,7 +37,7 @@ /** * PetWithRequiredTags */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class PetWithRequiredTags { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pig.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pig.java index 407d23324839..f6a59d8cafd6 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pig.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Pig.java @@ -35,7 +35,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pig extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Pig.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PropertyNameCollision.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PropertyNameCollision.java index 16e89bc51224..45082ce61e14 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PropertyNameCollision.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/PropertyNameCollision.java @@ -32,7 +32,7 @@ /** * PropertyNameCollision */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class PropertyNameCollision { public static final String SERIALIZED_NAME_UNDERSCORE_TYPE = "_type"; @JsonbProperty(SERIALIZED_NAME_UNDERSCORE_TYPE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Quadrilateral.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Quadrilateral.java index 1fce04f9562c..53222d4edbe8 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Quadrilateral.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Quadrilateral.java @@ -35,7 +35,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Quadrilateral extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Quadrilateral.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java index c71a0e402a6a..f503e76cde4e 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -32,7 +32,7 @@ /** * QuadrilateralInterface */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class QuadrilateralInterface { public static final String SERIALIZED_NAME_QUADRILATERAL_TYPE = "quadrilateralType"; @JsonbProperty(SERIALIZED_NAME_QUADRILATERAL_TYPE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 945e140a7f43..2f95bf49250f 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -32,7 +32,7 @@ /** * ReadOnlyFirst */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ReadOnlyFirst { public static final String SERIALIZED_NAME_BAR = "bar"; @JsonbProperty(SERIALIZED_NAME_BAR) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/RequiredNullableBody.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/RequiredNullableBody.java index 9963baaad5ea..e46249573f9f 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/RequiredNullableBody.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/RequiredNullableBody.java @@ -41,7 +41,7 @@ /** * RequiredNullableBody */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RequiredNullableBody { public static final String SERIALIZED_NAME_INTEGER_PROP = "integer_prop"; @JsonbProperty(SERIALIZED_NAME_INTEGER_PROP) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Scalar.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Scalar.java index f4c2970ad6c0..221fa6f2d68f 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Scalar.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Scalar.java @@ -35,7 +35,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Scalar extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Scalar.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScalarAnyOf.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScalarAnyOf.java index e8952691b6db..78e8190887e3 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScalarAnyOf.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScalarAnyOf.java @@ -35,7 +35,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ScalarAnyOf extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(ScalarAnyOf.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScaleneTriangle.java index 6e7714f48522..f071fd83dc2a 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScaleneTriangle.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -32,7 +32,7 @@ /** * ScaleneTriangle */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ScaleneTriangle { public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; @JsonbProperty(SERIALIZED_NAME_SHAPE_TYPE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Shape.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Shape.java index 64282b8b346a..2dbb1ac32c2e 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Shape.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Shape.java @@ -35,7 +35,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Shape extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Shape.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeInterface.java index 627aad206277..a44046e763f0 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeInterface.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -32,7 +32,7 @@ /** * ShapeInterface */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ShapeInterface { public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; @JsonbProperty(SERIALIZED_NAME_SHAPE_TYPE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeOrNull.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeOrNull.java index 4662fb2245a1..0d95d12c21f9 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeOrNull.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/ShapeOrNull.java @@ -35,7 +35,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ShapeOrNull extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(ShapeOrNull.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java index d50ab340fe18..d887a8fd27c0 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -32,7 +32,7 @@ /** * SimpleQuadrilateral */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class SimpleQuadrilateral { public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; @JsonbProperty(SERIALIZED_NAME_SHAPE_TYPE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SpecialModelName.java index 990bd344d2df..ff75714207a3 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -32,7 +32,7 @@ /** * SpecialModelName */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class SpecialModelName { public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; @JsonbProperty(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Tag.java index d7f20cbc2633..2933cfd34992 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Tag.java @@ -32,7 +32,7 @@ /** * Tag */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java index 2dd73e4cea8e..50d7e32aec61 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -32,7 +32,7 @@ /** * TestInlineFreeformAdditionalPropertiesRequest */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class TestInlineFreeformAdditionalPropertiesRequest { public static final String SERIALIZED_NAME_SOME_PROPERTY = "someProperty"; @JsonbProperty(SERIALIZED_NAME_SOME_PROPERTY) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Triangle.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Triangle.java index 3f8814efeef5..a6db4ab41e1c 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Triangle.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Triangle.java @@ -36,7 +36,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Triangle extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Triangle.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TriangleInterface.java index 562ca8bef641..a94424b12622 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TriangleInterface.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -32,7 +32,7 @@ /** * TriangleInterface */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class TriangleInterface { public static final String SERIALIZED_NAME_TRIANGLE_TYPE = "triangleType"; @JsonbProperty(SERIALIZED_NAME_TRIANGLE_TYPE) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/User.java index 47131a8b9b29..124579d2b858 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/User.java @@ -33,7 +33,7 @@ /** * User */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class User { public static final String SERIALIZED_NAME_ID = "id"; @JsonbProperty(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Value.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Value.java index be6b4ca0d414..5473da9aeda6 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Value.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Value.java @@ -35,7 +35,7 @@ import org.openapitools.client.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Value extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Value.class.getName()); diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Variable.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Variable.java index d5c16a4e5ae6..6ce1260dfd12 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Variable.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Variable.java @@ -33,7 +33,7 @@ /** * Value object */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Variable { public static final String SERIALIZED_NAME_NAME = "name"; @JsonbProperty(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Whale.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Whale.java index 4e53b92a932c..c0e7f29388b8 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Whale.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Whale.java @@ -32,7 +32,7 @@ /** * Whale */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Whale { public static final String SERIALIZED_NAME_HAS_BALEEN = "hasBaleen"; @JsonbProperty(SERIALIZED_NAME_HAS_BALEEN) diff --git a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Zebra.java b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Zebra.java index 7f3af51fd761..d583bd883ff7 100644 --- a/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Zebra.java +++ b/samples/client/petstore/java/okhttp-jsonb/src/main/java/org/openapitools/client/model/Zebra.java @@ -32,7 +32,7 @@ /** * Zebra */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Zebra { /** * Gets or Sets type diff --git a/samples/client/petstore/java/okhttp-jspecify/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-jspecify/.openapi-generator/FILES index e09edc0a22f5..ea3ff6e50ca3 100644 --- a/samples/client/petstore/java/okhttp-jspecify/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-jspecify/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -39,5 +38,3 @@ src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/package-info.java src/main/java/org/openapitools/client/package-info.java -src/test/java/org/openapitools/client/api/DefaultApiTest.java -src/test/java/org/openapitools/client/model/FooTest.java diff --git a/samples/client/petstore/java/okhttp-jspecify/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-jspecify/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp-jspecify/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp-jspecify/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-jspecify/README.md b/samples/client/petstore/java/okhttp-jspecify/README.md index 16fe287379b2..0fcd71c11571 100644 --- a/samples/client/petstore/java/okhttp-jspecify/README.md +++ b/samples/client/petstore/java/okhttp-jspecify/README.md @@ -2,7 +2,7 @@ jspecify - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT test fully qualified name and jspecify diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiException.java index e6f66e6f66d7..8ed4a081a6de 100644 --- a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Configuration.java index 346a6c9e5d3d..2fc0cc4d614e 100644 --- a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Pair.java index 414a027f27b9..a4f638e2dbcb 100644 --- a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerConfiguration.java index eb6154a87dca..0cce5ebf21db 100644 --- a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerVariable.java index 37a829200ca5..ccd97310c655 100644 --- a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/StringUtil.java index 5f33d5c2fe88..692a517b09f3 100644 --- a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 5a774e51a741..4aa3caa42a2d 100644 --- a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/Authentication.java index bbd20697f755..5c886b0e89f4 100644 --- a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index 8a458fa8cd8a..f96fd2769e64 100644 --- a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index 42ab195d76a7..bb88975b0544 100644 --- a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index 5aeec8303388..dd6ff726d2ff 100644 --- a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/Foo.java index d346b11e1aa7..f54b8fb9039b 100644 --- a/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/okhttp-jspecify/src/main/java/org/openapitools/client/model/Foo.java @@ -55,7 +55,7 @@ /** * Foo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Foo { public static final String SERIALIZED_NAME_DT = "dt"; @SerializedName(SERIALIZED_NAME_DT) diff --git a/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/FILES index 98c355b15f63..c15c94b1c501 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -58,14 +57,3 @@ src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases1.java src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases2.java src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/User.java -src/test/java/org/openapitools/client/api/PetApiTest.java -src/test/java/org/openapitools/client/api/StoreApiTest.java -src/test/java/org/openapitools/client/api/UserApiTest.java -src/test/java/org/openapitools/client/model/CategoryTest.java -src/test/java/org/openapitools/client/model/ModelApiResponseTest.java -src/test/java/org/openapitools/client/model/OrderTest.java -src/test/java/org/openapitools/client/model/PetTest.java -src/test/java/org/openapitools/client/model/PetWithRequiredNullableCases1Test.java -src/test/java/org/openapitools/client/model/PetWithRequiredNullableCases2Test.java -src/test/java/org/openapitools/client/model/TagTest.java -src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp-nullable-required/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-nullable-required/README.md b/samples/client/petstore/java/okhttp-nullable-required/README.md index 05f7bd054640..0bca233f7a7c 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/README.md +++ b/samples/client/petstore/java/okhttp-nullable-required/README.md @@ -2,7 +2,7 @@ OpenAPI Petstore - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiException.java index bbe1b2c8ee33..9485c28b6f26 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Configuration.java index ba56d6cab13d..0ed7ce6f5a7a 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Pair.java index 8b84ab37c82a..aa0e33c628b8 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerConfiguration.java index ae47d8bdb452..29afa7de9e13 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerVariable.java index 1b09cdb8d75c..dfc4e3418738 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/StringUtil.java index a4859da9a700..dcde7de52e55 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 334ae1f6fd40..b4aecef2c8d4 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/Authentication.java index 07839e9966cf..3a053490df87 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index 85d6556f1f68..566f23165854 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index f728b306c358..f45c6ba8b3be 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuth.java index 0b5e71fe6212..eda5efa2c900 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 0de7ae9fc491..136f78f5a053 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -16,7 +16,7 @@ /** * OAuth flows that are supported by this client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public enum OAuthFlow { ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 IMPLICIT, diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index bdd0ae91976f..f19d8a4b6628 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Category.java index 1332de3a1697..75170905851e 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Category.java @@ -48,7 +48,7 @@ /** * A category for a pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 1bc343bd5338..bcb71975111c 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -48,7 +48,7 @@ /** * Describes the result of uploading an image resource */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Order.java index db0571d69be1..7b8899c3232c 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Order.java @@ -49,7 +49,7 @@ /** * An order for a pets from the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Pet.java index 385b0eb2ad13..847f5f2df2cf 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Pet.java @@ -53,7 +53,7 @@ /** * A pet for sale in the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases1.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases1.java index 13c7a7de5ff4..e5c5a4976696 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases1.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases1.java @@ -54,7 +54,7 @@ /** * A pet for sale in the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class PetWithRequiredNullableCases1 { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases2.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases2.java index 32bdf8ba0d06..448fede4f5e6 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases2.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/PetWithRequiredNullableCases2.java @@ -53,7 +53,7 @@ /** * A pet for sale in the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class PetWithRequiredNullableCases2 { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Tag.java index de14a3aee9b3..c2492b60898a 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/Tag.java @@ -48,7 +48,7 @@ /** * A tag for a pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/User.java index 01d7a093236a..3e41dd625c81 100644 --- a/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-nullable-required/src/main/java/org/openapitools/client/model/User.java @@ -48,7 +48,7 @@ /** * A User who is purchasing from the pet store */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/FILES index 4d513a032b3c..6d48b6ee2d33 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -138,54 +137,3 @@ src/main/java/org/openapitools/client/model/TypeHolderDefault.java src/main/java/org/openapitools/client/model/TypeHolderExample.java src/main/java/org/openapitools/client/model/User.java src/main/java/org/openapitools/client/model/XmlItem.java -src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java -src/test/java/org/openapitools/client/api/FakeApiTest.java -src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java -src/test/java/org/openapitools/client/api/PetApiTest.java -src/test/java/org/openapitools/client/api/StoreApiTest.java -src/test/java/org/openapitools/client/api/UserApiTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java -src/test/java/org/openapitools/client/model/AnimalTest.java -src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java -src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java -src/test/java/org/openapitools/client/model/ArrayTestTest.java -src/test/java/org/openapitools/client/model/BigCatTest.java -src/test/java/org/openapitools/client/model/CapitalizationTest.java -src/test/java/org/openapitools/client/model/CatTest.java -src/test/java/org/openapitools/client/model/CategoryTest.java -src/test/java/org/openapitools/client/model/ClassModelTest.java -src/test/java/org/openapitools/client/model/ClientTest.java -src/test/java/org/openapitools/client/model/DogTest.java -src/test/java/org/openapitools/client/model/EnumArraysTest.java -src/test/java/org/openapitools/client/model/EnumClassTest.java -src/test/java/org/openapitools/client/model/EnumTestTest.java -src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java -src/test/java/org/openapitools/client/model/FormatTestTest.java -src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java -src/test/java/org/openapitools/client/model/MapTestTest.java -src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java -src/test/java/org/openapitools/client/model/Model200ResponseTest.java -src/test/java/org/openapitools/client/model/ModelApiResponseTest.java -src/test/java/org/openapitools/client/model/ModelFileTest.java -src/test/java/org/openapitools/client/model/ModelListTest.java -src/test/java/org/openapitools/client/model/ModelReturnTest.java -src/test/java/org/openapitools/client/model/NameTest.java -src/test/java/org/openapitools/client/model/NumberOnlyTest.java -src/test/java/org/openapitools/client/model/OrderTest.java -src/test/java/org/openapitools/client/model/OuterCompositeTest.java -src/test/java/org/openapitools/client/model/OuterEnumTest.java -src/test/java/org/openapitools/client/model/PetTest.java -src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java -src/test/java/org/openapitools/client/model/SpecialModelNameTest.java -src/test/java/org/openapitools/client/model/TagTest.java -src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java -src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java -src/test/java/org/openapitools/client/model/UserTest.java -src/test/java/org/openapitools/client/model/XmlItemTest.java diff --git a/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp-parcelableModel/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-parcelableModel/README.md b/samples/client/petstore/java/okhttp-parcelableModel/README.md index 0810e597b2c8..84efb8acc3c1 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/README.md +++ b/samples/client/petstore/java/okhttp-parcelableModel/README.md @@ -2,7 +2,7 @@ OpenAPI Petstore - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiException.java index 0c0f52846910..9c908da3a538 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Configuration.java index 79955372fb33..91277dc82ed7 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Pair.java index 505e6f786f4c..2302aff4c8ae 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerConfiguration.java index 1787a231e76b..66eef5d718f2 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerVariable.java index bc81f54d83a6..d0c4814493ad 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/StringUtil.java index 6473166843d5..647c1e11fabc 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index ed5f5fbc16ef..aa7a99f8b6bc 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/Authentication.java index bd5e463d0b42..5fcf0aad8212 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index f655936f3a78..d7b733e2c91e 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index 5aff174aff81..bd3d7a329545 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuth.java index 6f945f45ed46..427a031ad1e2 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 59009502c11e..8d5408d02164 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -16,7 +16,7 @@ /** * OAuth flows that are supported by this client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public enum OAuthFlow { ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 IMPLICIT, diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index fc0f2c973b8d..f93e3410e7a0 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 602900e9389e..f39c3a064eca 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -50,7 +50,7 @@ /** * AdditionalPropertiesAnyType */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesAnyType implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 6b6996931b92..e2b61afd6149 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -51,7 +51,7 @@ /** * AdditionalPropertiesArray */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesArray implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 4ffc837355f9..4d994adf6b3a 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -50,7 +50,7 @@ /** * AdditionalPropertiesBoolean */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesBoolean implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index d50efcbfdca2..6de7d2613d07 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -54,7 +54,7 @@ /** * AdditionalPropertiesClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesClass implements Parcelable { public static final String SERIALIZED_NAME_MAP_STRING = "map_string"; @SerializedName(SERIALIZED_NAME_MAP_STRING) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index a22b2f4510ea..b7973026aee6 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -50,7 +50,7 @@ /** * AdditionalPropertiesInteger */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesInteger implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index 70d30227ed49..bc8cda38f159 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -51,7 +51,7 @@ /** * AdditionalPropertiesNumber */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesNumber implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index cb6f990496b6..8db014cec32a 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -51,7 +51,7 @@ /** * AdditionalPropertiesObject */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesObject implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 7906ac1c747f..b029b86fd6f6 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -50,7 +50,7 @@ /** * AdditionalPropertiesString */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesString implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java index 94188920b996..e218ce49da0d 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java @@ -50,7 +50,7 @@ /** * Animal */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Animal implements Parcelable { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 74bc2f563440..c012a0fe2833 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -54,7 +54,7 @@ /** * ArrayOfArrayOfNumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOfArrayOfNumberOnly implements Parcelable { public static final String SERIALIZED_NAME_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_NUMBER) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index f94c3fffb59c..64154b72f469 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -54,7 +54,7 @@ /** * ArrayOfNumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOfNumberOnly implements Parcelable { public static final String SERIALIZED_NAME_ARRAY_NUMBER = "ArrayNumber"; @SerializedName(SERIALIZED_NAME_ARRAY_NUMBER) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java index 0df50c70cedc..ae7bc407a703 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -54,7 +54,7 @@ /** * ArrayTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayTest implements Parcelable { public static final String SERIALIZED_NAME_ARRAY_OF_STRING = "array_of_string"; @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRING) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java index d9d79ee3199f..533f41279b4e 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java @@ -51,7 +51,7 @@ /** * BigCat */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class BigCat extends Cat implements Parcelable { /** * Gets or Sets kind diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java index 2c22a0756006..e77ef758d537 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java @@ -50,7 +50,7 @@ /** * Capitalization */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Capitalization implements Parcelable { public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java index 72ee935334e2..78ea16e27041 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java @@ -51,7 +51,7 @@ /** * Cat */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Cat extends Animal implements Parcelable { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @SerializedName(SERIALIZED_NAME_DECLAWED) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Category.java index bf6b9f5ca0eb..c6a375fbe4e5 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Category.java @@ -50,7 +50,7 @@ /** * Category */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Category implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java index 451250be39a9..3891a84dd69a 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java @@ -50,7 +50,7 @@ /** * Model for testing model with \"_class\" property */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ClassModel implements Parcelable { public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Client.java index 44eee7933cb2..324545f7b9ea 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Client.java @@ -50,7 +50,7 @@ /** * Client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Client implements Parcelable { public static final String SERIALIZED_NAME_CLIENT = "client"; @SerializedName(SERIALIZED_NAME_CLIENT) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java index 1522e8fd7680..1da85cede44e 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java @@ -51,7 +51,7 @@ /** * Dog */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Dog extends Animal implements Parcelable { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java index e9bc1ed7ae57..07ed32425f25 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -53,7 +53,7 @@ /** * EnumArrays */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class EnumArrays implements Parcelable { /** * Gets or Sets justSymbol diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java index af5e51713762..0c4e643ec715 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java @@ -51,7 +51,7 @@ /** * EnumTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class EnumTest implements Parcelable { /** * Gets or Sets enumString diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 0369a55a0cee..8d1f2a8d88db 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -54,7 +54,7 @@ /** * FileSchemaTestClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FileSchemaTestClass implements Parcelable { public static final String SERIALIZED_NAME_FILE = "file"; @SerializedName(SERIALIZED_NAME_FILE) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java index b4430e0d982b..7c29e639260e 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java @@ -55,7 +55,7 @@ /** * FormatTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FormatTest implements Parcelable { public static final String SERIALIZED_NAME_INTEGER = "integer"; @SerializedName(SERIALIZED_NAME_INTEGER) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 5f67b6d5e431..98480826c8a1 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -50,7 +50,7 @@ /** * HasOnlyReadOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HasOnlyReadOnly implements Parcelable { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java index 3207de750d39..9cf982f4f4b9 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java @@ -52,7 +52,7 @@ /** * MapTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class MapTest implements Parcelable { public static final String SERIALIZED_NAME_MAP_MAP_OF_STRING = "map_map_of_string"; @SerializedName(SERIALIZED_NAME_MAP_MAP_OF_STRING) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 3f66272cfb6b..7e38c79590fb 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -55,7 +55,7 @@ /** * MixedPropertiesAndAdditionalPropertiesClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class MixedPropertiesAndAdditionalPropertiesClass implements Parcelable { public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java index b126b3e708a2..08d558eb70f8 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java @@ -50,7 +50,7 @@ /** * Model for testing model name starting with number */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Model200Response implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java index a8b8783b40e5..068a4302bfc7 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -50,7 +50,7 @@ /** * ModelApiResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelApiResponse implements Parcelable { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java index 441e4591d3aa..c61e9277ae14 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java @@ -50,7 +50,7 @@ /** * Must be named `File` for test. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelFile implements Parcelable { public static final String SERIALIZED_NAME_SOURCE_U_R_I = "sourceURI"; @SerializedName(SERIALIZED_NAME_SOURCE_U_R_I) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java index 695dad98276e..ce0ab608405d 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java @@ -50,7 +50,7 @@ /** * ModelList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelList implements Parcelable { public static final String SERIALIZED_NAME_123LIST = "123-list"; @SerializedName(SERIALIZED_NAME_123LIST) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java index b29b4e979f31..5c81ad33a30b 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -50,7 +50,7 @@ /** * Model for testing reserved words */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelReturn implements Parcelable { public static final String SERIALIZED_NAME_RETURN = "return"; @SerializedName(SERIALIZED_NAME_RETURN) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Name.java index 581806256eaf..c91e02678707 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Name.java @@ -50,7 +50,7 @@ /** * Model for testing model name same as property name */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Name implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java index 7cad5073f7a9..338110743eca 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -51,7 +51,7 @@ /** * NumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NumberOnly implements Parcelable { public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; @SerializedName(SERIALIZED_NAME_JUST_NUMBER) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Order.java index 8a995433060d..02699d9b30c0 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Order.java @@ -51,7 +51,7 @@ /** * Order */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Order implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java index 0664a715c7d4..d10e523e3170 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -51,7 +51,7 @@ /** * OuterComposite */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OuterComposite implements Parcelable { public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; @SerializedName(SERIALIZED_NAME_MY_NUMBER) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java index b782d78b8ecb..823ebb7028af 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java @@ -57,7 +57,7 @@ /** * Pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pet implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 8ecee5d6f8f0..5933864cd380 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -50,7 +50,7 @@ /** * ReadOnlyFirst */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ReadOnlyFirst implements Parcelable { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java index ced5d6d7f35b..7d59bdf8ad88 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -50,7 +50,7 @@ /** * SpecialModelName */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class SpecialModelName implements Parcelable { public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java index 9463d5e46ea6..f6587230d4c5 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java @@ -50,7 +50,7 @@ /** * Tag */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Tag implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 128b87187565..4dd723fa371a 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -54,7 +54,7 @@ /** * TypeHolderDefault */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class TypeHolderDefault implements Parcelable { public static final String SERIALIZED_NAME_STRING_ITEM = "string_item"; @SerializedName(SERIALIZED_NAME_STRING_ITEM) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java index bc6d9e994a68..88eeaa482089 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -54,7 +54,7 @@ /** * TypeHolderExample */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class TypeHolderExample implements Parcelable { public static final String SERIALIZED_NAME_STRING_ITEM = "string_item"; @SerializedName(SERIALIZED_NAME_STRING_ITEM) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/User.java index 6880182477cc..17692faf92ff 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/User.java @@ -50,7 +50,7 @@ /** * User */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class User implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java index f80bdcf46ef2..004809b6113a 100644 --- a/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java @@ -54,7 +54,7 @@ /** * XmlItem */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class XmlItem implements Parcelable { public static final String SERIALIZED_NAME_ATTRIBUTE_STRING = "attribute_string"; @SerializedName(SERIALIZED_NAME_ATTRIBUTE_STRING) diff --git a/samples/client/petstore/java/okhttp-swagger1/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-swagger1/.openapi-generator/FILES index dcc56b6dd665..df49e1eede44 100644 --- a/samples/client/petstore/java/okhttp-swagger1/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-swagger1/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -50,10 +49,3 @@ src/main/java/org/openapitools/client/model/Order.java src/main/java/org/openapitools/client/model/Pet.java src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/User.java -src/test/java/org/openapitools/client/api/CommonApiTest.java -src/test/java/org/openapitools/client/model/CategoryTest.java -src/test/java/org/openapitools/client/model/ModelApiResponseTest.java -src/test/java/org/openapitools/client/model/OrderTest.java -src/test/java/org/openapitools/client/model/PetTest.java -src/test/java/org/openapitools/client/model/TagTest.java -src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/okhttp-swagger1/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-swagger1/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp-swagger1/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp-swagger1/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-swagger1/README.md b/samples/client/petstore/java/okhttp-swagger1/README.md index 6a628851f9df..b26bb967fafc 100644 --- a/samples/client/petstore/java/okhttp-swagger1/README.md +++ b/samples/client/petstore/java/okhttp-swagger1/README.md @@ -2,7 +2,7 @@ OpenAPI Petstore - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiException.java index bbe1b2c8ee33..9485c28b6f26 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Configuration.java index ba56d6cab13d..0ed7ce6f5a7a 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Pair.java index 8b84ab37c82a..aa0e33c628b8 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerConfiguration.java index ae47d8bdb452..29afa7de9e13 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerVariable.java index 1b09cdb8d75c..dfc4e3418738 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/StringUtil.java index a4859da9a700..dcde7de52e55 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 334ae1f6fd40..b4aecef2c8d4 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/Authentication.java index 07839e9966cf..3a053490df87 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index 85d6556f1f68..566f23165854 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index f728b306c358..f45c6ba8b3be 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuth.java index 0b5e71fe6212..eda5efa2c900 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 0de7ae9fc491..136f78f5a053 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -16,7 +16,7 @@ /** * OAuth flows that are supported by this client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public enum OAuthFlow { ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 IMPLICIT, diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index bdd0ae91976f..f19d8a4b6628 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Category.java index 82d792a7ddd2..851a3e76d6d8 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Category.java @@ -51,7 +51,7 @@ * A category for a pet */ @ApiModel(description = "A category for a pet") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 25747805ed7e..18a458c325a5 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -51,7 +51,7 @@ * Describes the result of uploading an image resource */ @ApiModel(description = "Describes the result of uploading an image resource") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Order.java index d6abcf24cbcb..abbc6cf4c0b5 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Order.java @@ -52,7 +52,7 @@ * An order for a pets from the pet store */ @ApiModel(description = "An order for a pets from the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Pet.java index ed879297876a..078ba1aadf0c 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Pet.java @@ -56,7 +56,7 @@ * A pet for sale in the pet store */ @ApiModel(description = "A pet for sale in the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Tag.java index face50a10b61..3847173046c3 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/Tag.java @@ -51,7 +51,7 @@ * A tag for a pet */ @ApiModel(description = "A tag for a pet") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/User.java index 09935beb3fb2..4ca7d5c5d745 100644 --- a/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-swagger1/src/main/java/org/openapitools/client/model/User.java @@ -51,7 +51,7 @@ * A User who is purchasing from the pet store */ @ApiModel(description = "A User who is purchasing from the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-swagger2/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-swagger2/.openapi-generator/FILES index 7acc559f04eb..17a72297a173 100644 --- a/samples/client/petstore/java/okhttp-swagger2/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-swagger2/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -54,12 +53,3 @@ src/main/java/org/openapitools/client/model/Order.java src/main/java/org/openapitools/client/model/Pet.java src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/User.java -src/test/java/org/openapitools/client/api/PetApiTest.java -src/test/java/org/openapitools/client/api/StoreApiTest.java -src/test/java/org/openapitools/client/api/UserApiTest.java -src/test/java/org/openapitools/client/model/CategoryTest.java -src/test/java/org/openapitools/client/model/ModelApiResponseTest.java -src/test/java/org/openapitools/client/model/OrderTest.java -src/test/java/org/openapitools/client/model/PetTest.java -src/test/java/org/openapitools/client/model/TagTest.java -src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/okhttp-swagger2/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp-swagger2/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp-swagger2/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp-swagger2/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp-swagger2/README.md b/samples/client/petstore/java/okhttp-swagger2/README.md index d599bdb7d9a2..67c5d8e9e2bf 100644 --- a/samples/client/petstore/java/okhttp-swagger2/README.md +++ b/samples/client/petstore/java/okhttp-swagger2/README.md @@ -2,7 +2,7 @@ OpenAPI Petstore - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiException.java index bbe1b2c8ee33..9485c28b6f26 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Configuration.java index ba56d6cab13d..0ed7ce6f5a7a 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Pair.java index 8b84ab37c82a..aa0e33c628b8 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerConfiguration.java index ae47d8bdb452..29afa7de9e13 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerVariable.java index 1b09cdb8d75c..dfc4e3418738 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/StringUtil.java index a4859da9a700..dcde7de52e55 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index 334ae1f6fd40..b4aecef2c8d4 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/Authentication.java index 07839e9966cf..3a053490df87 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index 85d6556f1f68..566f23165854 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index f728b306c358..f45c6ba8b3be 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuth.java index 0b5e71fe6212..eda5efa2c900 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 0de7ae9fc491..136f78f5a053 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -16,7 +16,7 @@ /** * OAuth flows that are supported by this client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public enum OAuthFlow { ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 IMPLICIT, diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index bdd0ae91976f..f19d8a4b6628 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Category.java index 7af8c4639a6c..46d8e56cd180 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Category.java @@ -50,7 +50,7 @@ * A category for a pet */ @Schema(description = "A category for a pet") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/ModelApiResponse.java index ea0615681b44..8089d4f94d70 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -50,7 +50,7 @@ * Describes the result of uploading an image resource */ @Schema(description = "Describes the result of uploading an image resource") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Order.java index 4dbce3b0ec10..015bc31d0178 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Order.java @@ -51,7 +51,7 @@ * An order for a pets from the pet store */ @Schema(description = "An order for a pets from the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Pet.java index 9b632594dec8..20cdfd75f49a 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Pet.java @@ -55,7 +55,7 @@ * A pet for sale in the pet store */ @Schema(description = "A pet for sale in the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Tag.java index 4f7dc76635ff..500f4f806402 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/Tag.java @@ -50,7 +50,7 @@ * A tag for a pet */ @Schema(description = "A tag for a pet") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/User.java index 7d4027bd4675..6bb8d4659bb1 100644 --- a/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-swagger2/src/main/java/org/openapitools/client/model/User.java @@ -50,7 +50,7 @@ * A User who is purchasing from the pet store */ @Schema(description = "A User who is purchasing from the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/.openapi-generator/FILES b/samples/client/petstore/java/okhttp/.openapi-generator/FILES index b42e6848a138..6d284356ea3d 100644 --- a/samples/client/petstore/java/okhttp/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp/.openapi-generator/FILES @@ -1,6 +1,5 @@ .github/workflows/maven.yml .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -278,124 +277,3 @@ src/main/java/org/openapitools/client/model/Value.java src/main/java/org/openapitools/client/model/Variable.java src/main/java/org/openapitools/client/model/Whale.java src/main/java/org/openapitools/client/model/Zebra.java -src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java -src/test/java/org/openapitools/client/api/DefaultApiTest.java -src/test/java/org/openapitools/client/api/FakeApiTest.java -src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java -src/test/java/org/openapitools/client/api/PetApiTest.java -src/test/java/org/openapitools/client/api/StoreApiTest.java -src/test/java/org/openapitools/client/api/UserApiTest.java -src/test/java/org/openapitools/client/api/ValuesApiTest.java -src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesCTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Test.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1ValueTest.java -src/test/java/org/openapitools/client/model/AllOfModelArrayAnyOfTest.java -src/test/java/org/openapitools/client/model/AllOfRefToDoubleTest.java -src/test/java/org/openapitools/client/model/AllOfRefToFloatTest.java -src/test/java/org/openapitools/client/model/AllOfRefToLongTest.java -src/test/java/org/openapitools/client/model/AnimalTest.java -src/test/java/org/openapitools/client/model/AppleReqTest.java -src/test/java/org/openapitools/client/model/AppleTest.java -src/test/java/org/openapitools/client/model/ArrayAnyOfTest.java -src/test/java/org/openapitools/client/model/ArrayDefaultTest.java -src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java -src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerTest.java -src/test/java/org/openapitools/client/model/ArrayOfInlineAllOfTest.java -src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java -src/test/java/org/openapitools/client/model/ArrayOneOfTest.java -src/test/java/org/openapitools/client/model/ArrayTestTest.java -src/test/java/org/openapitools/client/model/BananaReqTest.java -src/test/java/org/openapitools/client/model/BananaTest.java -src/test/java/org/openapitools/client/model/BasquePigTest.java -src/test/java/org/openapitools/client/model/CapitalizationTest.java -src/test/java/org/openapitools/client/model/CatTest.java -src/test/java/org/openapitools/client/model/CategoryTest.java -src/test/java/org/openapitools/client/model/ClassModelTest.java -src/test/java/org/openapitools/client/model/ClientTest.java -src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java -src/test/java/org/openapitools/client/model/DanishPigTest.java -src/test/java/org/openapitools/client/model/DeprecatedObjectTest.java -src/test/java/org/openapitools/client/model/DogTest.java -src/test/java/org/openapitools/client/model/DrawingTest.java -src/test/java/org/openapitools/client/model/EnumArraysTest.java -src/test/java/org/openapitools/client/model/EnumClassTest.java -src/test/java/org/openapitools/client/model/EnumStringDiscriminatorTest.java -src/test/java/org/openapitools/client/model/EnumTestTest.java -src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java -src/test/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200ResponseTest.java -src/test/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200ResponseTest.java -src/test/java/org/openapitools/client/model/FakeRefParameterPetIdParameterTest.java -src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java -src/test/java/org/openapitools/client/model/FooGetDefaultResponseTest.java -src/test/java/org/openapitools/client/model/FooTest.java -src/test/java/org/openapitools/client/model/FormatTestTest.java -src/test/java/org/openapitools/client/model/FreeFormObjectTestClassPropertiesTest.java -src/test/java/org/openapitools/client/model/FreeFormObjectTestClassTest.java -src/test/java/org/openapitools/client/model/FruitReqTest.java -src/test/java/org/openapitools/client/model/FruitTest.java -src/test/java/org/openapitools/client/model/GmFruitTest.java -src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java -src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java -src/test/java/org/openapitools/client/model/HealthCheckResultTest.java -src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java -src/test/java/org/openapitools/client/model/MammalAnyofTest.java -src/test/java/org/openapitools/client/model/MammalTest.java -src/test/java/org/openapitools/client/model/MapTestTest.java -src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java -src/test/java/org/openapitools/client/model/Model200ResponseTest.java -src/test/java/org/openapitools/client/model/ModelApiResponseTest.java -src/test/java/org/openapitools/client/model/ModelFileTest.java -src/test/java/org/openapitools/client/model/ModelListTest.java -src/test/java/org/openapitools/client/model/ModelReturnTest.java -src/test/java/org/openapitools/client/model/ModelWithOneOfAnyOfPropertiesTest.java -src/test/java/org/openapitools/client/model/NameTest.java -src/test/java/org/openapitools/client/model/NestedArrayWithDefaultValuesTest.java -src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTagTest.java -src/test/java/org/openapitools/client/model/NewPetCategoryInlineAllofTest.java -src/test/java/org/openapitools/client/model/NewPetTest.java -src/test/java/org/openapitools/client/model/NullableClassTest.java -src/test/java/org/openapitools/client/model/NullableEnumTest.java -src/test/java/org/openapitools/client/model/NullableFieldsMapErrorTest.java -src/test/java/org/openapitools/client/model/NullableFieldsMapResponseTest.java -src/test/java/org/openapitools/client/model/NullableFieldsMapSuccessTest.java -src/test/java/org/openapitools/client/model/NullableFieldsValueTest.java -src/test/java/org/openapitools/client/model/NullableShapeTest.java -src/test/java/org/openapitools/client/model/NumberOnlyTest.java -src/test/java/org/openapitools/client/model/ObjectWithDeprecatedFieldsTest.java -src/test/java/org/openapitools/client/model/OrderTest.java -src/test/java/org/openapitools/client/model/OuterCompositeTest.java -src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java -src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java -src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java -src/test/java/org/openapitools/client/model/OuterEnumTest.java -src/test/java/org/openapitools/client/model/ParentPetTest.java -src/test/java/org/openapitools/client/model/PetCompositionTest.java -src/test/java/org/openapitools/client/model/PetRefTest.java -src/test/java/org/openapitools/client/model/PetTest.java -src/test/java/org/openapitools/client/model/PetUsingAllOfTest.java -src/test/java/org/openapitools/client/model/PetWithRequiredTagsTest.java -src/test/java/org/openapitools/client/model/PigTest.java -src/test/java/org/openapitools/client/model/PropertyNameCollisionTest.java -src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java -src/test/java/org/openapitools/client/model/QuadrilateralTest.java -src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java -src/test/java/org/openapitools/client/model/RequiredNullableBodyTest.java -src/test/java/org/openapitools/client/model/ScalarAnyOfTest.java -src/test/java/org/openapitools/client/model/ScalarTest.java -src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java -src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java -src/test/java/org/openapitools/client/model/ShapeOrNullTest.java -src/test/java/org/openapitools/client/model/ShapeTest.java -src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java -src/test/java/org/openapitools/client/model/SpecialModelNameTest.java -src/test/java/org/openapitools/client/model/TagTest.java -src/test/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequestTest.java -src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java -src/test/java/org/openapitools/client/model/TriangleTest.java -src/test/java/org/openapitools/client/model/UserTest.java -src/test/java/org/openapitools/client/model/ValueTest.java -src/test/java/org/openapitools/client/model/VariableTest.java -src/test/java/org/openapitools/client/model/WhaleTest.java -src/test/java/org/openapitools/client/model/ZebraTest.java diff --git a/samples/client/petstore/java/okhttp/.openapi-generator/VERSION b/samples/client/petstore/java/okhttp/.openapi-generator/VERSION index 186c33c96ed8..8fc8df61083a 100644 --- a/samples/client/petstore/java/okhttp/.openapi-generator/VERSION +++ b/samples/client/petstore/java/okhttp/.openapi-generator/VERSION @@ -1 +1 @@ -7.24.0-SNAPSHOT +7.25.0-SNAPSHOT diff --git a/samples/client/petstore/java/okhttp/README.md b/samples/client/petstore/java/okhttp/README.md index 4d341765fa52..72c2b4ec7b34 100644 --- a/samples/client/petstore/java/okhttp/README.md +++ b/samples/client/petstore/java/okhttp/README.md @@ -2,7 +2,7 @@ OpenAPI Petstore - API version: 1.0.0 - - Generator version: 7.24.0-SNAPSHOT + - Generator version: 7.25.0-SNAPSHOT This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiException.java index 0c0f52846910..9c908da3a538 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiException extends Exception { private static final long serialVersionUID = 1L; diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Configuration.java index 79955372fb33..91277dc82ed7 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Pair.java index 505e6f786f4c..2302aff4c8ae 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/Pair.java @@ -13,7 +13,7 @@ package org.openapitools.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pair { private final String name; private final String value; diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java index 1787a231e76b..66eef5d718f2 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerConfiguration { public String URL; public String description; diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java index bc81f54d83a6..d0c4814493ad 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ServerVariable { public String description; public String defaultValue; diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java index 6473166843d5..647c1e11fabc 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index ed5f5fbc16ef..aa7a99f8b6bc 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java index bd5e463d0b42..5fcf0aad8212 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/Authentication.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public interface Authentication { /** * Apply authentication settings to header and query params. diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index f655936f3a78..d7b733e2c91e 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index 5aff174aff81..bd3d7a329545 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuth.java index 6f945f45ed46..427a031ad1e2 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OAuth implements Authentication { private String accessToken; diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 59009502c11e..8d5408d02164 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -16,7 +16,7 @@ /** * OAuth flows that are supported by this client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public enum OAuthFlow { ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 IMPLICIT, diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index fc0f2c973b8d..f93e3410e7a0 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 9a942f853305..95402e1b8893 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -53,7 +53,7 @@ /** * AdditionalPropertiesClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AdditionalPropertiesClass { public static final String SERIALIZED_NAME_MAP_PROPERTY = "map_property"; @SerializedName(SERIALIZED_NAME_MAP_PROPERTY) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java index cb9f28576030..ef700b0cdb11 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOf.java @@ -52,7 +52,7 @@ /** * AllOfModelArrayAnyOf */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfModelArrayAnyOf { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java index 42492a7bba37..e4ac6b5d4886 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributes.java @@ -51,7 +51,7 @@ /** * AllOfModelArrayAnyOfAllOfAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfModelArrayAnyOfAllOfAttributes { public static final String SERIALIZED_NAME_C = "C"; @SerializedName(SERIALIZED_NAME_C) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java index ca40d898e196..508f04d5bd9e 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java @@ -65,7 +65,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfModelArrayAnyOfAllOfAttributesC extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(AllOfModelArrayAnyOfAllOfAttributesC.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java index 7af298e4c85a..55545979f28c 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java @@ -54,7 +54,7 @@ /** * AllOfModelArrayAnyOfAllOfLinkListColumn1 */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfModelArrayAnyOfAllOfLinkListColumn1 { public static final String SERIALIZED_NAME_VALUE = "value"; @SerializedName(SERIALIZED_NAME_VALUE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java index 7d275b241bc1..3f55030eab3a 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java @@ -60,7 +60,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfModelArrayAnyOfAllOfLinkListColumn1Value extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(AllOfModelArrayAnyOfAllOfLinkListColumn1Value.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java index 7ea931ebc3c1..a7fe4ce6e7b8 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToDouble.java @@ -50,7 +50,7 @@ /** * Object with allOf ref to double */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfRefToDouble { public static final String SERIALIZED_NAME_HEIGHT = "height"; @SerializedName(SERIALIZED_NAME_HEIGHT) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java index 142d5b5fb97c..5feacc4ff0ae 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToFloat.java @@ -50,7 +50,7 @@ /** * Object with allOf ref to float */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfRefToFloat { public static final String SERIALIZED_NAME_WEIGHT = "weight"; @SerializedName(SERIALIZED_NAME_WEIGHT) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToLong.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToLong.java index 0839c14fec78..bf3785e90319 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToLong.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AllOfRefToLong.java @@ -50,7 +50,7 @@ /** * Object with allOf ref to long */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AllOfRefToLong { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Animal.java index ea75748cb338..9ce03ac128b6 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Animal.java @@ -50,7 +50,7 @@ /** * Animal */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Apple.java index 95c35d8413c8..ebfd20ee97dc 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Apple.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Apple.java @@ -50,7 +50,7 @@ /** * Apple */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Apple { public static final String SERIALIZED_NAME_CULTIVAR = "cultivar"; @SerializedName(SERIALIZED_NAME_CULTIVAR) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AppleReq.java index 0b1f7a338d39..918ab5294eb8 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AppleReq.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/AppleReq.java @@ -50,7 +50,7 @@ /** * AppleReq */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class AppleReq { public static final String SERIALIZED_NAME_CULTIVAR = "cultivar"; @SerializedName(SERIALIZED_NAME_CULTIVAR) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayAnyOf.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayAnyOf.java index 0e036d0c0b01..bfab2f239588 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayAnyOf.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayAnyOf.java @@ -52,7 +52,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayAnyOf extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(ArrayAnyOf.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayDefault.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayDefault.java index c636a81e6cdb..12e26e9cbe4f 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayDefault.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayDefault.java @@ -53,7 +53,7 @@ /** * ArrayDefault */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayDefault { public static final String SERIALIZED_NAME_WITH_DEFAULT_EMPTY_BRACKET = "WithDefaultEmptyBracket"; @SerializedName(SERIALIZED_NAME_WITH_DEFAULT_EMPTY_BRACKET) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 16a26c30c502..3eef2e457a00 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -54,7 +54,7 @@ /** * ArrayOfArrayOfNumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOfArrayOfNumberOnly { public static final String SERIALIZED_NAME_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; @SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_NUMBER) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java index eb4f1bbb8620..d1b773bbd21b 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java @@ -54,7 +54,7 @@ /** * ArrayOfInlineAllOf */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOfInlineAllOf { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java index 97c4683361d5..b78c8b70e927 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java @@ -50,7 +50,7 @@ /** * ArrayOfInlineAllOfArrayAllofDogPropertyInner */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOfInlineAllOfArrayAllofDogPropertyInner { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index ee2a27a3f4e5..d94e3f391567 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -54,7 +54,7 @@ /** * ArrayOfNumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOfNumberOnly { public static final String SERIALIZED_NAME_ARRAY_NUMBER = "ArrayNumber"; @SerializedName(SERIALIZED_NAME_ARRAY_NUMBER) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOneOf.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOneOf.java index e59166ba77e4..150b099ce6ed 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOneOf.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayOneOf.java @@ -52,7 +52,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayOneOf extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(ArrayOneOf.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayTest.java index e5c2af23fb29..af4451d38dda 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -54,7 +54,7 @@ /** * ArrayTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ArrayTest { public static final String SERIALIZED_NAME_ARRAY_OF_STRING = "array_of_string"; @SerializedName(SERIALIZED_NAME_ARRAY_OF_STRING) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Banana.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Banana.java index a010046995ff..de009364886f 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Banana.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Banana.java @@ -51,7 +51,7 @@ /** * Banana */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Banana { public static final String SERIALIZED_NAME_LENGTH_CM = "lengthCm"; @SerializedName(SERIALIZED_NAME_LENGTH_CM) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BananaReq.java index 279c7d3dcece..a4c4d17ff167 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BananaReq.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BananaReq.java @@ -51,7 +51,7 @@ /** * BananaReq */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class BananaReq { public static final String SERIALIZED_NAME_LENGTH_CM = "lengthCm"; @SerializedName(SERIALIZED_NAME_LENGTH_CM) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BasquePig.java index 2f1619523ed5..eb3af1d980cf 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BasquePig.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/BasquePig.java @@ -50,7 +50,7 @@ /** * BasquePig */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class BasquePig { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Capitalization.java index 65be8dfbd6f1..c68f0c4b4b8f 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Capitalization.java @@ -50,7 +50,7 @@ /** * Capitalization */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Capitalization { public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Cat.java index db41997dfb06..8c75fc138e38 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Cat.java @@ -52,7 +52,7 @@ /** * Cat */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Cat extends Animal { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @SerializedName(SERIALIZED_NAME_DECLAWED) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Category.java index b7c91558201d..e967f81d0d0b 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Category.java @@ -50,7 +50,7 @@ /** * Category */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ClassModel.java index eca1910a42b3..e6be52f75d10 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ClassModel.java @@ -50,7 +50,7 @@ /** * Model for testing model with \"_class\" property */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ClassModel { public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Client.java index 4b8c454f80fd..3f1b62e49355 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Client.java @@ -50,7 +50,7 @@ /** * Client */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Client { public static final String SERIALIZED_NAME_CLIENT = "client"; @SerializedName(SERIALIZED_NAME_CLIENT) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java index 402051a3bcaf..3758a1a278ec 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -50,7 +50,7 @@ /** * ComplexQuadrilateral */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ComplexQuadrilateral { public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; @SerializedName(SERIALIZED_NAME_SHAPE_TYPE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DanishPig.java index a58a020e2a85..292a5b3fe582 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DanishPig.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DanishPig.java @@ -50,7 +50,7 @@ /** * DanishPig */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class DanishPig { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DeprecatedObject.java index 972df8fdd7f0..a2022241be7e 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DeprecatedObject.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -52,7 +52,7 @@ * @deprecated */ @Deprecated -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class DeprecatedObject { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Dog.java index e9d79ef18972..fac39b52967b 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Dog.java @@ -51,7 +51,7 @@ /** * Dog */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Dog extends Animal { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Drawing.java index a49ee9e2ef66..711d631bee94 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Drawing.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Drawing.java @@ -58,7 +58,7 @@ /** * Drawing */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Drawing { public static final String SERIALIZED_NAME_MAIN_SHAPE = "mainShape"; @SerializedName(SERIALIZED_NAME_MAIN_SHAPE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumArrays.java index 077261bd7378..f776868fcb35 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -53,7 +53,7 @@ /** * EnumArrays */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class EnumArrays { /** * Gets or Sets justSymbol diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java index f84d7fbc3198..b5488f1ee415 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java @@ -50,7 +50,7 @@ /** * An object to test discriminator of enum string */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class EnumStringDiscriminator { /** * enum string type diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumTest.java index 3fb6a980ddd7..365971a98f59 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EnumTest.java @@ -55,7 +55,7 @@ /** * EnumTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class EnumTest { /** * Gets or Sets enumString diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EquilateralTriangle.java index 6e6e4d97fe4c..b132f80d309c 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EquilateralTriangle.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -50,7 +50,7 @@ /** * EquilateralTriangle */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class EquilateralTriangle { public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; @SerializedName(SERIALIZED_NAME_SHAPE_TYPE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java index 25943fee31c4..ca7b729906aa 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java @@ -52,7 +52,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FakeAnyOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(FakeAnyOfWIthSameErasureGet200Response.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java index 9fcd59fd7e55..7fa4bd8ee65c 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java @@ -52,7 +52,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FakeOneOfWIthSameErasureGet200Response extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(FakeOneOfWIthSameErasureGet200Response.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java index 6f15c6670464..472b91e46b87 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java @@ -51,7 +51,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FakeRefParameterPetIdParameter extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(FakeRefParameterPetIdParameter.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index ea7f4733ff1c..f9ee454497bb 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -54,7 +54,7 @@ /** * FileSchemaTestClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FileSchemaTestClass { public static final String SERIALIZED_NAME_FILE = "file"; @SerializedName(SERIALIZED_NAME_FILE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Foo.java index 81a798767518..8f4874cff64c 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Foo.java @@ -50,7 +50,7 @@ /** * Foo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Foo { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java index 113254eade4d..9a47c6e9857e 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -51,7 +51,7 @@ /** * FooGetDefaultResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FooGetDefaultResponse { public static final String SERIALIZED_NAME_STRING = "string"; @SerializedName(SERIALIZED_NAME_STRING) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FormatTest.java index 6997016b4f46..a5b6a2ab5c1e 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FormatTest.java @@ -55,7 +55,7 @@ /** * FormatTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FormatTest { public static final String SERIALIZED_NAME_INTEGER = "integer"; @SerializedName(SERIALIZED_NAME_INTEGER) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java index d059e2f789ba..72fd9f76b760 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClass.java @@ -51,7 +51,7 @@ /** * FreeFormObjectTestClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FreeFormObjectTestClass { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java index 8a57bb75d9a3..2f5b075df738 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java @@ -52,7 +52,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FreeFormObjectTestClassProperties extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(FreeFormObjectTestClassProperties.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Fruit.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Fruit.java index 66be88b29f53..1a8079d09086 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Fruit.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Fruit.java @@ -60,7 +60,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Fruit extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Fruit.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FruitReq.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FruitReq.java index cb6448fbc4e9..63e0a4256db8 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FruitReq.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/FruitReq.java @@ -60,7 +60,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class FruitReq extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(FruitReq.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GmFruit.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GmFruit.java index e39193a1f28a..7cde7a34b623 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GmFruit.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GmFruit.java @@ -60,7 +60,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class GmFruit extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(GmFruit.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GrandparentAnimal.java index 7c938f2f50c1..63c237237c0b 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GrandparentAnimal.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -50,7 +50,7 @@ /** * GrandparentAnimal */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class GrandparentAnimal { public static final String SERIALIZED_NAME_PET_TYPE = "pet_type"; @SerializedName(SERIALIZED_NAME_PET_TYPE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 002a172518be..8629fca4634f 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -50,7 +50,7 @@ /** * HasOnlyReadOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HasOnlyReadOnly { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HealthCheckResult.java index 7491f3df24fb..cedc11c170f1 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -51,7 +51,7 @@ /** * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class HealthCheckResult { public static final String SERIALIZED_NAME_NULLABLE_MESSAGE = "NullableMessage"; @SerializedName(SERIALIZED_NAME_NULLABLE_MESSAGE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java index 764c3cce713e..6e94ce53754f 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -50,7 +50,7 @@ /** * IsoscelesTriangle */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class IsoscelesTriangle { public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; @SerializedName(SERIALIZED_NAME_SHAPE_TYPE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Mammal.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Mammal.java index 3788e0e69ed6..814a68d85bbb 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Mammal.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Mammal.java @@ -60,7 +60,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Mammal extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Mammal.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MammalAnyof.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MammalAnyof.java index a81387130a2f..5cc5ef751c5f 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MammalAnyof.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MammalAnyof.java @@ -60,7 +60,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class MammalAnyof extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(MammalAnyof.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MapTest.java index c7bbc83c79a4..3c583cf11d21 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MapTest.java @@ -52,7 +52,7 @@ /** * MapTest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class MapTest { public static final String SERIALIZED_NAME_MAP_MAP_OF_STRING = "map_map_of_string"; @SerializedName(SERIALIZED_NAME_MAP_MAP_OF_STRING) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 47e7d76a5eec..4daeebc07de2 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -55,7 +55,7 @@ /** * MixedPropertiesAndAdditionalPropertiesClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class MixedPropertiesAndAdditionalPropertiesClass { public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Model200Response.java index 0786d7bbd133..8ccf4cb0288a 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Model200Response.java @@ -50,7 +50,7 @@ /** * Model for testing model name starting with number */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Model200Response { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelApiResponse.java index ff143aa112b3..f065513aae2b 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -50,7 +50,7 @@ /** * ModelApiResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelFile.java index 706e2cc011a8..d6682d4b445a 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelFile.java @@ -50,7 +50,7 @@ /** * Must be named `File` for test. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelFile { public static final String SERIALIZED_NAME_SOURCE_U_R_I = "sourceURI"; @SerializedName(SERIALIZED_NAME_SOURCE_U_R_I) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelList.java index 8b8fa5c98666..cb0390dca022 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelList.java @@ -50,7 +50,7 @@ /** * ModelList */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelList { public static final String SERIALIZED_NAME_123LIST = "123-list"; @SerializedName(SERIALIZED_NAME_123LIST) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelReturn.java index ed6111f4da31..e7fa804b32b8 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -50,7 +50,7 @@ /** * Model for testing reserved words */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelReturn { public static final String SERIALIZED_NAME_RETURN = "return"; @SerializedName(SERIALIZED_NAME_RETURN) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java index 197be8d545f8..54870d5a66b2 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ModelWithOneOfAnyOfProperties.java @@ -52,7 +52,7 @@ /** * ModelWithOneOfAnyOfProperties */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ModelWithOneOfAnyOfProperties { public static final String SERIALIZED_NAME_ONEOF_PROP = "oneof_prop"; @SerializedName(SERIALIZED_NAME_ONEOF_PROP) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Name.java index 19178b6eb66d..28a3d4a2643a 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Name.java @@ -50,7 +50,7 @@ /** * Model for testing model name same as property name */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Name { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java index 8b2e830674f5..6fa2c5e811f4 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NestedArrayWithDefaultValues.java @@ -53,7 +53,7 @@ /** * NestedArrayWithDefaultValues */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NestedArrayWithDefaultValues { public static final String SERIALIZED_NAME_NESTED_ARRAY = "nestedArray"; @SerializedName(SERIALIZED_NAME_NESTED_ARRAY) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPet.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPet.java index bbf98a9a0625..56c30090b82c 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPet.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPet.java @@ -56,7 +56,7 @@ /** * NewPet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NewPet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java index 4dcea1f1c077..2a8567588a46 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllof.java @@ -51,7 +51,7 @@ /** * NewPetCategoryInlineAllof */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NewPetCategoryInlineAllof { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java index 8bcc47e723af..53ac532f01bd 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NewPetCategoryInlineAllofAllOfCategoryTag.java @@ -50,7 +50,7 @@ /** * NewPetCategoryInlineAllofAllOfCategoryTag */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NewPetCategoryInlineAllofAllOfCategoryTag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableClass.java index 9bf8affa9c56..80cd9d7736cf 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableClass.java @@ -59,7 +59,7 @@ /** * NullableClass */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NullableClass { public static final String SERIALIZED_NAME_INTEGER_PROP = "integer_prop"; @SerializedName(SERIALIZED_NAME_INTEGER_PROP) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java index 266d75552634..53209212c772 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapError.java @@ -50,7 +50,7 @@ /** * Error response */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NullableFieldsMapError { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java index 30f8f5d54842..21cd3b4a04ae 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java @@ -62,7 +62,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NullableFieldsMapResponse extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(NullableFieldsMapResponse.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java index b8d9e60408f4..07258da905ce 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsMapSuccess.java @@ -53,7 +53,7 @@ /** * Success response containing a map of objects with nullable fields */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NullableFieldsMapSuccess { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsValue.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsValue.java index 0ab19b8b6628..4794904b7c92 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsValue.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableFieldsValue.java @@ -50,7 +50,7 @@ /** * Object with required but nullable string fields */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NullableFieldsValue { public static final String SERIALIZED_NAME_BEFORE = "before"; @SerializedName(SERIALIZED_NAME_BEFORE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableShape.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableShape.java index 2a7a24b85b42..bc4a2045f2f0 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableShape.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NullableShape.java @@ -59,7 +59,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NullableShape extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(NullableShape.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NumberOnly.java index 794d7e9d7adb..199c49ee4866 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -51,7 +51,7 @@ /** * NumberOnly */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class NumberOnly { public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; @SerializedName(SERIALIZED_NAME_JUST_NUMBER) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java index 0fb863c58247..5ba8a628e73f 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -55,7 +55,7 @@ /** * ObjectWithDeprecatedFields */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ObjectWithDeprecatedFields { public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Order.java index de31104d402c..8e36f6ed726f 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Order.java @@ -51,7 +51,7 @@ /** * Order */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterComposite.java index 4d694ed47ef7..1842bf77cc3b 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -51,7 +51,7 @@ /** * OuterComposite */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class OuterComposite { public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; @SerializedName(SERIALIZED_NAME_MY_NUMBER) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ParentPet.java index 322f93d39aa8..ed8da628523e 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ParentPet.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ParentPet.java @@ -51,7 +51,7 @@ /** * ParentPet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ParentPet extends GrandparentAnimal { public ParentPet() { this.petType = this.getClass().getSimpleName(); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java index ba7138f376da..9af65ba1af97 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pet.java @@ -55,7 +55,7 @@ /** * Pet */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetComposition.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetComposition.java index fd59b7e23890..5c8320aaf95f 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetComposition.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetComposition.java @@ -55,7 +55,7 @@ /** * PetComposition */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class PetComposition { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetRef.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetRef.java index eb3cf43fff4a..f4084c09dc0e 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetRef.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetRef.java @@ -55,7 +55,7 @@ /** * PetRef */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class PetRef { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetUsingAllOf.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetUsingAllOf.java index 53276b7d0a48..7d16d702dfcf 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetUsingAllOf.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetUsingAllOf.java @@ -55,7 +55,7 @@ /** * PetUsingAllOf */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class PetUsingAllOf { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java index df3415785ffe..31d4dfdd0375 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java @@ -55,7 +55,7 @@ /** * PetWithRequiredTags */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class PetWithRequiredTags { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pig.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pig.java index 57c47baa05e9..acf88e1eaa0d 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pig.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Pig.java @@ -59,7 +59,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Pig extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Pig.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PropertyNameCollision.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PropertyNameCollision.java index 2a817ea0c20f..c5c2a4cdd44b 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PropertyNameCollision.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/PropertyNameCollision.java @@ -50,7 +50,7 @@ /** * PropertyNameCollision */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class PropertyNameCollision { public static final String SERIALIZED_NAME_UNDERSCORE_TYPE = "_type"; @SerializedName(SERIALIZED_NAME_UNDERSCORE_TYPE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Quadrilateral.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Quadrilateral.java index a41c62e412e1..0ed49ec1e0a0 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Quadrilateral.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Quadrilateral.java @@ -59,7 +59,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Quadrilateral extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Quadrilateral.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java index 5877de915e54..f6a86fae52c1 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -50,7 +50,7 @@ /** * QuadrilateralInterface */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class QuadrilateralInterface { public static final String SERIALIZED_NAME_QUADRILATERAL_TYPE = "quadrilateralType"; @SerializedName(SERIALIZED_NAME_QUADRILATERAL_TYPE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index fc2b0af77be0..8531cd141c8b 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -50,7 +50,7 @@ /** * ReadOnlyFirst */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ReadOnlyFirst { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/RequiredNullableBody.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/RequiredNullableBody.java index 83ccf9bfd21f..90a78688c89b 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/RequiredNullableBody.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/RequiredNullableBody.java @@ -59,7 +59,7 @@ /** * RequiredNullableBody */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class RequiredNullableBody { public static final String SERIALIZED_NAME_INTEGER_PROP = "integer_prop"; @SerializedName(SERIALIZED_NAME_INTEGER_PROP) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Scalar.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Scalar.java index cfcd916a4ea1..a7644cb73fbd 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Scalar.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Scalar.java @@ -53,7 +53,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Scalar extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Scalar.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScalarAnyOf.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScalarAnyOf.java index db9abb5b317c..0f3f628ac24d 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScalarAnyOf.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScalarAnyOf.java @@ -53,7 +53,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ScalarAnyOf extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(ScalarAnyOf.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScaleneTriangle.java index 94abdbef5cf0..789a155086a5 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScaleneTriangle.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -50,7 +50,7 @@ /** * ScaleneTriangle */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ScaleneTriangle { public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; @SerializedName(SERIALIZED_NAME_SHAPE_TYPE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Shape.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Shape.java index 16252a40c4c9..b2b7c3ea8e24 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Shape.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Shape.java @@ -59,7 +59,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Shape extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Shape.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeInterface.java index 6f7d0647d188..a2956b1912a6 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeInterface.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -50,7 +50,7 @@ /** * ShapeInterface */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ShapeInterface { public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; @SerializedName(SERIALIZED_NAME_SHAPE_TYPE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeOrNull.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeOrNull.java index 5effa81354a2..9ffb20d8552a 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeOrNull.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/ShapeOrNull.java @@ -59,7 +59,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class ShapeOrNull extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(ShapeOrNull.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java index 91fbd0808784..a9c15687b004 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -50,7 +50,7 @@ /** * SimpleQuadrilateral */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class SimpleQuadrilateral { public static final String SERIALIZED_NAME_SHAPE_TYPE = "shapeType"; @SerializedName(SERIALIZED_NAME_SHAPE_TYPE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SpecialModelName.java index 9d934aabf957..abe700706aca 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -50,7 +50,7 @@ /** * SpecialModelName */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class SpecialModelName { public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java index 6c17f6c0b3f8..e0aca0794f9f 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Tag.java @@ -50,7 +50,7 @@ /** * Tag */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java index 04cac3da4091..06f0fb168878 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -50,7 +50,7 @@ /** * TestInlineFreeformAdditionalPropertiesRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class TestInlineFreeformAdditionalPropertiesRequest { public static final String SERIALIZED_NAME_SOME_PROPERTY = "someProperty"; @SerializedName(SERIALIZED_NAME_SOME_PROPERTY) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Triangle.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Triangle.java index 41144288c2ea..8c5e0c8681bb 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Triangle.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Triangle.java @@ -60,7 +60,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Triangle extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Triangle.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TriangleInterface.java index 26c6a87cd68e..e9ea9eee25b0 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TriangleInterface.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -50,7 +50,7 @@ /** * TriangleInterface */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class TriangleInterface { public static final String SERIALIZED_NAME_TRIANGLE_TYPE = "triangleType"; @SerializedName(SERIALIZED_NAME_TRIANGLE_TYPE) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/User.java index e976dcbab924..b612103218b6 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/User.java @@ -51,7 +51,7 @@ /** * User */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Value.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Value.java index 9114b57d1dfc..f496aaaffa67 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Value.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Value.java @@ -53,7 +53,7 @@ import org.openapitools.client.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Value extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Value.class.getName()); diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Variable.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Variable.java index 9f51c20aa4fd..8df41495117f 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Variable.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Variable.java @@ -51,7 +51,7 @@ /** * Value object */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Variable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Whale.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Whale.java index 44c6fc66c399..5cc1ac70b4f1 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Whale.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Whale.java @@ -50,7 +50,7 @@ /** * Whale */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Whale { public static final String SERIALIZED_NAME_HAS_BALEEN = "hasBaleen"; @SerializedName(SERIALIZED_NAME_HAS_BALEEN) diff --git a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Zebra.java b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Zebra.java index c35ec184d495..927f9e6fd7d5 100644 --- a/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Zebra.java +++ b/samples/client/petstore/java/okhttp/src/main/java/org/openapitools/client/model/Zebra.java @@ -50,7 +50,7 @@ /** * Zebra */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.24.0-SNAPSHOT") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT") public class Zebra { /** * Gets or Sets type From e785b11f5578407db4f3448518fc09a7f66eeab2 Mon Sep 17 00:00:00 2001 From: rar91279 Date: Tue, 21 Jul 2026 00:57:35 +0200 Subject: [PATCH 4/5] Update samples/client/echo_api/java/okhttp/build.sbt Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- samples/client/echo_api/java/okhttp/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/client/echo_api/java/okhttp/build.sbt b/samples/client/echo_api/java/okhttp/build.sbt index 464090415c47..70b786d12ed0 100644 --- a/samples/client/echo_api/java/okhttp/build.sbt +++ b/samples/client/echo_api/java/okhttp/build.sbt @@ -1 +1 @@ -# TODO +// TODO From 1b81c6378c045e5b5052b48d8d0d991904f623b5 Mon Sep 17 00:00:00 2001 From: rar91279 Date: Tue, 21 Jul 2026 00:58:02 +0200 Subject: [PATCH 5/5] Switch to fully qualified `java.math.BigDecimal` in templates and improve auth parameter handling. Add missing Gson and JSON-B annotations (from AI review). --- .../Java/libraries/native/modelEnum.mustache | 2 +- .../Java/libraries/okhttp-gson/ApiClient.mustache | 11 ++++++++++- .../resources/Java/libraries/okhttp-gson/api.mustache | 2 +- .../Java/libraries/okhttp-gson/modelEnum.mustache | 4 ++-- .../libraries/okhttp-gson/modelInnerEnum.mustache | 4 ++-- .../Java/libraries/okhttp-gson/pojo.mustache | 2 ++ .../Java/libraries/okhttp/ApiClient.mustache | 11 ++++++++++- .../main/resources/Java/libraries/okhttp/api.mustache | 2 +- .../Java/libraries/okhttp/modelEnum.mustache | 4 ++-- .../Java/libraries/okhttp/modelInnerEnum.mustache | 4 ++-- .../resources/Java/libraries/okhttp/pojo.mustache | 2 ++ .../src/main/resources/Java/modelEnum.mustache | 2 +- .../src/main/resources/Java/modelInnerEnum.mustache | 2 +- 13 files changed, 37 insertions(+), 15 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/modelEnum.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/modelEnum.mustache index 6db13f884a38..312a3d96d856 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/modelEnum.mustache @@ -96,7 +96,7 @@ import java.net.URI; @Override public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{^isNumber}}{{^isInteger}}next{{{dataType}}}(){{/isInteger}}{{/isNumber}}; - return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new java.math.BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); } } {{/gson}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache index 499469238d2f..b5bb126f01aa 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache @@ -1539,8 +1539,17 @@ public class ApiClient { List updatedQueryParams = new ArrayList<>(queryParams); + String localVarPayload = requestBodyToString(reqBody); + // update parameters with authentication settings - updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + URI currentUri = URI.create(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + auth.applyToParams(updatedQueryParams, headerParams, cookieParams, localVarPayload, method, currentUri); + } final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache index 9519ce13c75e..0e03ab7d194a 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache @@ -235,7 +235,7 @@ public class {{classname}} { {{/headerParams}} {{/dynamicOperations}} - String[] localVarAuthNames = new String[] { {{#withAWSV4Signature}}"AWS4Auth"{{/withAWSV4Signature}}{{#authMethods}}{{#-first}}{{#withAWSV4Signature}}, {{/withAWSV4Signature}}{{/-first}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{#-last}}{{#withAWSV4Signature}}, {{/withAWSV4Signature}}{{/-last}}{{/authMethods}}{{#withAWSV4Signature}}"AWS4Auth"{{/withAWSV4Signature}} }; return localVarApiClient.buildCall(basePath, localVarPath, {{^dynamicOperations}}"{{httpMethod}}"{{/dynamicOperations}}{{#dynamicOperations}}apiOperation.getMethod(){{/dynamicOperations}}, localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache index a89b1578d7bd..1a526075cf24 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache @@ -61,13 +61,13 @@ import com.google.gson.stream.JsonWriter; @Override public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}}{{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; - return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new java.math.BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isUri}}URI.create({{/isUri}}jsonElement.{{#isNumber}}getAsString(){{/isNumber}}{{#isInteger}}getAsInt(){{/isInteger}}{{#isUri}}getAsString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}getAs{{{dataType}}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; - {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new java.math.BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); } {{#supportUrlQuery}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache index 1d23f2da527b..31d6281b07f6 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/modelInnerEnum.mustache @@ -55,12 +55,12 @@ @Override public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}} {{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; - return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new java.math.BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isUri}}URI.create({{/isUri}}jsonElement.{{#isNumber}}getAsString(){{/isNumber}}{{#isInteger}}getAsInt(){{/isInteger}}{{#isUri}}getAsString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}getAs{{{dataType}}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; - {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new java.math.BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache index 349e6fc6a798..ed8ee8c481c2 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache @@ -11,6 +11,8 @@ import com.google.gson.reflect.TypeToken; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; import java.io.IOException; import java.util.HashMap; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiClient.mustache index 485dcb1d1499..6a489eea3004 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/ApiClient.mustache @@ -1539,8 +1539,17 @@ public class ApiClient { List updatedQueryParams = new ArrayList<>(queryParams); + String localVarPayload = requestBodyToString(reqBody); + // update parameters with authentication settings - updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + URI currentUri = URI.create(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + auth.applyToParams(updatedQueryParams, headerParams, cookieParams, localVarPayload, method, currentUri); + } final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); processHeaderParams(headerParams, reqBuilder); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api.mustache index 699de9167f40..29e9d152a37d 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/api.mustache @@ -241,7 +241,7 @@ public class {{classname}} { {{/headerParams}} {{/dynamicOperations}} - String[] localVarAuthNames = new String[] { {{#withAWSV4Signature}}"AWS4Auth"{{/withAWSV4Signature}}{{#authMethods}}{{#-first}}{{#withAWSV4Signature}}, {{/withAWSV4Signature}}{{/-first}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{#-last}}{{#withAWSV4Signature}}, {{/withAWSV4Signature}}{{/-last}}{{/authMethods}}{{#withAWSV4Signature}}"AWS4Auth"{{/withAWSV4Signature}} }; return localVarApiClient.buildCall(basePath, localVarPath, {{^dynamicOperations}}"{{httpMethod}}"{{/dynamicOperations}}{{#dynamicOperations}}apiOperation.getMethod(){{/dynamicOperations}}, localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelEnum.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelEnum.mustache index 73766d386305..bc63345aa9e6 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelEnum.mustache @@ -86,13 +86,13 @@ import jakarta.json.bind.annotation.JsonbValue; @Override public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}}{{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; - return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new java.math.BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isUri}}URI.create({{/isUri}}jsonElement.{{#isNumber}}getAsString(){{/isNumber}}{{#isInteger}}getAsInt(){{/isInteger}}{{#isUri}}getAsString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}getAs{{{dataType}}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; - {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new java.math.BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); } {{/isGson}} {{#supportUrlQuery}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelInnerEnum.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelInnerEnum.mustache index a9a4e8396afd..7250b6e36cb3 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelInnerEnum.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/modelInnerEnum.mustache @@ -70,13 +70,13 @@ @Override public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}} {{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; - return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new java.math.BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isUri}}URI.create({{/isUri}}jsonElement.{{#isNumber}}getAsString(){{/isNumber}}{{#isInteger}}getAsInt(){{/isInteger}}{{#isUri}}getAsString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}getAs{{{dataType}}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; - {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new java.math.BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); } {{/isGson}} } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/pojo.mustache index 5d7a30f8fbb5..745cd050ab0a 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp/pojo.mustache @@ -12,6 +12,7 @@ import com.google.gson.reflect.TypeToken; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; {{/isGson}} {{#isJackson}} @@ -25,6 +26,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; {{#isJsonb}} import jakarta.json.bind.annotation.JsonbProperty; import jakarta.json.bind.annotation.JsonbCreator; +import jakarta.json.bind.annotation.JsonbValue; {{/isJsonb}} import java.io.IOException; import java.util.Arrays; diff --git a/modules/openapi-generator/src/main/resources/Java/modelEnum.mustache b/modules/openapi-generator/src/main/resources/Java/modelEnum.mustache index 6738ef9edc16..b8570851d99a 100644 --- a/modules/openapi-generator/src/main/resources/Java/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/Java/modelEnum.mustache @@ -79,7 +79,7 @@ import java.net.URI; @Override public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}}{{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; - return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new java.math.BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); } } {{/gson}} diff --git a/modules/openapi-generator/src/main/resources/Java/modelInnerEnum.mustache b/modules/openapi-generator/src/main/resources/Java/modelInnerEnum.mustache index 9a50912fc780..fa1d3a610530 100644 --- a/modules/openapi-generator/src/main/resources/Java/modelInnerEnum.mustache +++ b/modules/openapi-generator/src/main/resources/Java/modelInnerEnum.mustache @@ -68,7 +68,7 @@ @Override public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}} {{#isUri}}URI.create({{/isUri}}jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{#isUri}}nextString()){{/isUri}}{{^isNumber}}{{^isInteger}}{{^isUri}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isUri}}{{/isInteger}}{{/isNumber}}; - return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new java.math.BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); } } {{/gson}}